Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Purchase Vehicles
Purchase Vehicles [message #317947] Tue, 19 February 2008 09:22 Go to next message
SODPaddy is currently offline  SODPaddy
Messages: 232
Registered: August 2005
Location: Germany
Karma: 0
Recruit

Hi im a big n00b in c++,

at the moment i will test purchase Vehicles with commmands !buy reconbike

I thought that i can use the Vehicle Crate out of gmcrates.cpp but very difficult to do that, because I`m newbie in C++

Can someone tell me the Sourcecode for it Smile

Dont say "try and eventually you will get it working" or something like that Smile


Website: www.Area54.eu

Once 54, Always 54.
(\__/)
(O.o )
(___)
Visit us at www.Area54.eu

[Updated on: Tue, 19 February 2008 09:33]

Report message to a moderator

Re: Purchase Vehicles [message #317950 is a reply to message #317947] Tue, 19 February 2008 09:44 Go to previous messageGo to next message
SODPaddy is currently offline  SODPaddy
Messages: 232
Registered: August 2005
Location: Germany
Karma: 0
Recruit

		if (wcsicmp(Msg2, L"!buy recon") == 0) {
			if (Get_Vehicle(ID) || Settings->CrateVehSpawnPos[0].X == 0.0f || Settings->CrateVehSpawnPos[0].Y == 0.0f || Settings->CrateVehSpawnPos[0].Z == 0.0f || Settings->CrateVehSpawnPos[1].X == 0.0f || Settings->CrateVehSpawnPos[1].Y == 0.0f || Settings->CrateVehSpawnPos[1].Z == 0.0f) {
				goto CrateStart;
				}
				Vector3	Pos = Settings->CrateVehSpawnPos[Get_Object_Type(ID)];
				Damage_All_Vehicles_Area(999999.0f,"Laser_NoBuilding",Pos,2.0f,obj,0);
				Commands->Set_Position(ID,Pos);

				GameObject *Temp = Commands->Create_Object("Invisible_Object",Pos);
				Reselect2:
				int	Rnd	= Commands->Get_Random_Int(1,201);
				int	Index = 0;
				if (Rnd	<= 25) Index = 0;
				else if	(Rnd <=	50)	Index =	1;
				else if	(Rnd <=	70)	Index =	2;
				else if	(Rnd <=	90)	Index =	3;
				else if	(Rnd <=	110) Index = 4;
				else if	(Rnd <=	130) Index = 5;
				else if	(Rnd <=	145) Index = 6;
				else if	(Rnd <=	160) Index = 7;
				else if	(Rnd <=	170) Index = 8;
				else if	(Rnd <=	180) Index = 9;
				else if	(Rnd <=	190) Index = 10;
				else Index = 11;
				if (Settings->Is_Disabled(RandomVehicle[Index][2])) goto Reselect2;		
				StrFormat2(message2,"%ls picked up a Random Vehicle Crate.",Get_Wide_Player_Name(ID));
				StrFormat2(message1,"ppage %d [Crate] You got a %s from the Random Vehicle Crate.",Get_Player_ID(ID), RandomVehicle[Index][0]);
				Commands->Attach_Script(Temp,"Test_Cinematic",StrFormat("%sRVC_%s.txt",Commands->Get_Player_Type(ID)	== 0?"Nod":"GDI",RandomVehicle[Index][1]).c_str());
				Console_Input(StrFormat("msg Crate: Looks like %ls just got a random vehicle! Go them!",Get_Wide_Team_Name(Team)).c_str());
				if (Settings->Gamelog) {
					Vector3 pos = Commands->Get_Position(ID);
					StrFormat2(message3,"CRATE;VEHICLE;%s;%d;%s;%f;%f;%f;%f;%f;%f;%d", RandomVehicle[Index][0], Commands->Get_ID(ID),	Commands->Get_Preset_Name(ID), pos.Y,pos.X,pos.Z, Commands->Get_Facing(ID),	Commands->Get_Max_Health(ID),Commands->Get_Max_Shield_Strength(ID),Get_Object_Type(ID));
			} 
		} 
	}


i changed sender to ID but not running


Website: www.Area54.eu

Once 54, Always 54.
(\__/)
(O.o )
(___)
Visit us at www.Area54.eu
Re: Purchase Vehicles [message #317954 is a reply to message #317947] Tue, 19 February 2008 09:51 Go to previous messageGo to next message
crazfulla is currently offline  crazfulla
Messages: 667
Registered: September 2006
Location: Aotearoa
Karma: 0
Colonel
1. Use the edit button.
2. Dont stretch the tables.


"GEoDLeto wrote:"

so what you are saying it is gonna take even longer before this thing is finished
So the topic title should be changed to: a sucky little "teaser" from C&C Reborn has been released

"halo2pac wrote:"

Unless they are girls, I am not going to bone them.
Re: Purchase Vehicles [message #317956 is a reply to message #317947] Tue, 19 February 2008 09:56 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
What version of SSAOW/SSGM are you using?


Re: Purchase Vehicles [message #317957 is a reply to message #317947] Tue, 19 February 2008 09:58 Go to previous messageGo to next message
SODPaddy is currently offline  SODPaddy
Messages: 232
Registered: August 2005
Location: Germany
Karma: 0
Recruit

Im using SSGM 2.0.2 WFDS.

Website: www.Area54.eu

Once 54, Always 54.
(\__/)
(O.o )
(___)
Visit us at www.Area54.eu
Re: Purchase Vehicles [message #317963 is a reply to message #317947] Tue, 19 February 2008 10:28 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
if (wcsicmp(Msg2, L"!buy recon") == 0) 
{
     const int cost = 500;
     if(Purchase_Item(ID, cost))
     {
           Vector3 pos = Commands->Get_Position(Get_GameObj(ID));
           pos.X += 5;
           pos.Z += 3;
           Commands->Create_Object("RECON BIKE PRESET", pos);
     }
     else
     {
           char msg[128];
           sprintf(msg, "ppage %d You don't have enough credits to buy a recon bike.", ID);
           Console_Input(msg);
     }
}
      
Re: Purchase Vehicles [message #317964 is a reply to message #317947] Tue, 19 February 2008 10:44 Go to previous messageGo to next message
SODPaddy is currently offline  SODPaddy
Messages: 232
Registered: August 2005
Location: Germany
Karma: 0
Recruit

simple option... but didnt the correct

Website: www.Area54.eu

Once 54, Always 54.
(\__/)
(O.o )
(___)
Visit us at www.Area54.eu

[Updated on: Tue, 19 February 2008 10:44]

Report message to a moderator

Re: Purchase Vehicles [message #317982 is a reply to message #317947] Tue, 19 February 2008 12:01 Go to previous messageGo to next message
SODPaddy is currently offline  SODPaddy
Messages: 232
Registered: August 2005
Location: Germany
Karma: 0
Recruit

Commands->Attach_Script(Temp,"Test_Cinematic",StrFormat("NodRVC_recon.txt"),Commands->Get_Player_Type == 0?"Nod":"GDI").c_str();


something wrong .. can someone say me what?


Website: www.Area54.eu

Once 54, Always 54.
(\__/)
(O.o )
(___)
Visit us at www.Area54.eu
Re: Purchase Vehicles [message #317990 is a reply to message #317947] Tue, 19 February 2008 12:38 Go to previous messageGo to next message
Hex is currently offline  Hex
Messages: 858
Registered: March 2004
Karma: 0
Colonel
StrFormat("%sRVC_recon.txt",......)


Commands->Get_Player_Type(Get_GameObj(ID))


btw, dans is the easy way and prob best for you


goztow wrote on Tue, 11 May 2010 08:00

If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).


reborn wrote on Fri, 29 January 2010 23:37

std is for pro's. Razz

[Updated on: Tue, 19 February 2008 12:47]

Report message to a moderator

Re: Purchase Vehicles [message #317991 is a reply to message #317947] Tue, 19 February 2008 12:42 Go to previous messageGo to next message
SODPaddy is currently offline  SODPaddy
Messages: 232
Registered: August 2005
Location: Germany
Karma: 0
Recruit

Error C2197 "Too many parameters for a call to the function."
			Commands->Attach_Script(Temp,"Test_Cinematic",StrFormat("%sRVC_recon.txt"),Commands->Get_Player_Type(Get_GameObj(ID)));


Website: www.Area54.eu

Once 54, Always 54.
(\__/)
(O.o )
(___)
Visit us at www.Area54.eu

[Updated on: Tue, 19 February 2008 13:00]

Report message to a moderator

Re: Purchase Vehicles [message #317996 is a reply to message #317964] Tue, 19 February 2008 13:06 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
TGPaddy wrote on Tue, 19 February 2008 17:44

simple option... but didnt the correct


you wanted a !buy recon command, there it is.
Re: Purchase Vehicles [message #317998 is a reply to message #317991] Tue, 19 February 2008 13:10 Go to previous messageGo to next message
pvtschlag is currently offline  pvtschlag
Messages: 122
Registered: April 2004
Karma: 0
Recruit
void Create_Vehicle(const char *Preset_Name,float Delay,GameObject *Owner,int Team); //creates a vechicle,dont know what Delay is for,Owner is for the owner of the vechicle,Team says which sides factories to create it at

Never tried using it before but I assume it works.


-Lee
Re: Purchase Vehicles [message #318000 is a reply to message #317998] Tue, 19 February 2008 13:12 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
pvtschlag wrote on Tue, 19 February 2008 20:10

void Create_Vehicle(const char *Preset_Name,float Delay,GameObject *Owner,int Team); //creates a vechicle,dont know what Delay is for,Owner is for the owner of the vechicle,Team says which sides factories to create it at

Never tried using it before but I assume it works.


Creates it at vehicle factory

Re: Purchase Vehicles [message #318001 is a reply to message #318000] Tue, 19 February 2008 13:13 Go to previous messageGo to next message
pvtschlag is currently offline  pvtschlag
Messages: 122
Registered: April 2004
Karma: 0
Recruit
He didn't say that he didn't want it to be created there.

-Lee

[Updated on: Tue, 19 February 2008 13:16]

Report message to a moderator

Re: Purchase Vehicles [message #318004 is a reply to message #317998] Tue, 19 February 2008 13:20 Go to previous messageGo to next message
SODPaddy is currently offline  SODPaddy
Messages: 232
Registered: August 2005
Location: Germany
Karma: 0
Recruit

pvtschlag wrote on Tue, 19 February 2008 21:10

void Create_Vehicle(const char *Preset_Name,float Delay,GameObject *Owner,int Team); //creates a vechicle,dont know what Delay is for,Owner is for the owner of the vechicle,Team says which sides factories to create it at

Never tried using it before but I assume it works.


Yes Smile In CTF The Airstrip and Warfactory disabled - i have some erros look my post before


Website: www.Area54.eu

Once 54, Always 54.
(\__/)
(O.o )
(___)
Visit us at www.Area54.eu
Re: Purchase Vehicles [message #318005 is a reply to message #318004] Tue, 19 February 2008 13:26 Go to previous messageGo to next message
pvtschlag is currently offline  pvtschlag
Messages: 122
Registered: April 2004
Karma: 0
Recruit
That may still work even if the WF/Airstrip is disabled. But as I said, never tried it.

Commands->Attach_Script(Temp,"Test_Cinematic","NodRVC_recon.txt");


-Lee
Re: Purchase Vehicles [message #318008 is a reply to message #317990] Tue, 19 February 2008 13:45 Go to previous messageGo to next message
SODPaddy is currently offline  SODPaddy
Messages: 232
Registered: August 2005
Location: Germany
Karma: 0
Recruit

Hex wrote on Tue, 19 February 2008 20:38

StrFormat("%sRVC_recon.txt",......)


Commands->Get_Player_Type(Get_GameObj(ID))


btw, dans is the easy way and prob best for you



thats the correct one - your one gives not the team id for "%sRVC_recon.txt"

www.sodclan.de/Film.wmv look


Website: www.Area54.eu

Once 54, Always 54.
(\__/)
(O.o )
(___)
Visit us at www.Area54.eu
Re: Purchase Vehicles [message #318012 is a reply to message #317947] Tue, 19 February 2008 13:58 Go to previous messageGo to next message
Hex is currently offline  Hex
Messages: 858
Registered: March 2004
Karma: 0
Colonel
Team does not matter, the both use CnC_Nod_Recon_Bike

goztow wrote on Tue, 11 May 2010 08:00

If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).


reborn wrote on Fri, 29 January 2010 23:37

std is for pro's. Razz
Re: Purchase Vehicles [message #318018 is a reply to message #317947] Tue, 19 February 2008 14:10 Go to previous messageGo to next message
SODPaddy is currently offline  SODPaddy
Messages: 232
Registered: August 2005
Location: Germany
Karma: 0
Recruit

My code at the moment:

	if (Type == 0 || Type == 1) {
		if (wcsicmp(Msg2, L"!buy recon") == 0) {
	        int Cost = 500;
	        GameObject *obj = Get_GameObj(ID);
		if (Purchase_Item(obj,Cost)) {

		if (Get_GameObj(ID) || Settings->GameMode != 2 || Settings->CrateVehSpawnPos[0].X == 0.0f || Settings->CrateVehSpawnPos[0].Y == 0.0f || Settings->CrateVehSpawnPos[0].Z == 0.0f || Settings->CrateVehSpawnPos[1].X == 0.0f || Settings->CrateVehSpawnPos[1].Y == 0.0f || Settings->CrateVehSpawnPos[1].Z == 0.0f) {
      			}
			Vector3 Pos = Commands->Get_Position(Get_GameObj(ID));
			Damage_All_Vehicles_Area(999999.0f,"Laser_NoBuilding",Pos,2.0f,obj,0);
			Commands->Set_Position((obj), Pos);

			GameObject *Temp = Commands->Create_Object("Invisible_Object",Pos);
			int	Rnd	= Commands->Get_Random_Int(1,201);
			int	Index = 0;
			if (Rnd	<= 25) Index = 0;
			else if	(Rnd <=	50)	Index =	1;
			else if	(Rnd <=	70)	Index =	2;
			else if	(Rnd <=	90)	Index =	3;
			else if	(Rnd <=	110) Index = 4;
			else if	(Rnd <=	130) Index = 5;
			else if	(Rnd <=	145) Index = 6;
			else if	(Rnd <=	160) Index = 7;
			else if	(Rnd <=	170) Index = 8;
			else if	(Rnd <=	180) Index = 9;
			else if	(Rnd <=	190) Index = 10;
			else Index = 11;	
			Commands->Attach_Script(Temp,"Test_Cinematic",StrFormat("%sRVC_recon.txt",Commands->Get_Player_Type(Get_GameObj(ID))	== 0?"Nod":"GDI") .c_str());
			char Message[100];
			sprintf(Message,"ppage %d [PB] You Purchased a Recon Bike.", ID, Get_Player_Name_By_ID(ID));
			Console_Input(Message);

			} 
		} 
	}


I think the teams are very important because NodRVC_recon.txt and GDIRVC_recon.txt

Can somebody help me :-/ ?


Website: www.Area54.eu

Once 54, Always 54.
(\__/)
(O.o )
(___)
Visit us at www.Area54.eu

[Updated on: Tue, 19 February 2008 14:50]

Report message to a moderator

Re: Purchase Vehicles [message #318042 is a reply to message #318012] Tue, 19 February 2008 17:16 Go to previous messageGo to next message
Hex is currently offline  Hex
Messages: 858
Registered: March 2004
Karma: 0
Colonel
Hex wrote on Tue, 19 February 2008 15:58

Team does not matter, the both use CnC_Nod_Recon_Bike



goztow wrote on Tue, 11 May 2010 08:00

If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).


reborn wrote on Fri, 29 January 2010 23:37

std is for pro's. Razz
Re: Purchase Vehicles [message #318052 is a reply to message #317947] Tue, 19 February 2008 18:29 Go to previous messageGo to next message
wittebolx is currently offline  wittebolx
Messages: 332
Registered: May 2007
Location: the netherlands
Karma: 0
Recruit
this will drop a recon bike like when you get a vehicle crate:
also add the cost and made it so it only works of the airstrip is online.

gmmain.cpp
class reconChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		GameObject *obj = Get_GameObj(ID);
		float Credits = Commands->Get_Money(obj);
if(!Is_Building_Dead(Find_Airstrip(0)))
{
if(Credits >= 300){
		Commands->Give_Money(obj,-300,false);
		Commands->Attach_Script(obj,"reb_reconVehicle_reinforcements","");
	}
else {
	Console_Input(StrFormat("ppage %d [WGC] You need $300 to use this command, Your AirStrip needs to be Online!.",Get_Player_ID(obj)).c_str());
}
}
	}
};
ChatCommandRegistrant<reconChatCommand> reconChatCommandReg("!recon",CHATTYPE_TEAM,0,GAMEMODE_AOW);

/////////////////////////
//////////recon//////////
//Vehicle Reinforcements/
/////////////////////////
/////////////////////////

void reb_reconVehicle_reinforcements::Created(GameObject *obj) {

Vector3 position = Commands->Get_Position(obj);
GameObject *flare = Commands->Create_Object("Signal_Flares",position);
flareID = Commands->Get_ID(flare);
Commands->Attach_Script(flare,"JFW_Disable_Physical_Collision","");

Commands->Create_2D_WAV_Sound("m00gnod_secx0007r3nors_snd.wav");
Console_Input("msg a Nod Vehicle is Ordered!");
Console_Input(StrFormat("ppage %d [Mission Controll at WGC] You have called in a Nod Vehicle, Your Vehicle will be arriving at your position soon.",Get_Player_ID(obj)).c_str());

Commands->Start_Timer(obj,this,3.0f,1);
Commands->Start_Timer(obj,this,6.0f,2);
Commands->Start_Timer(obj,this,9.0f,3);

}

void reb_reconVehicle_reinforcements::Timer_Expired(GameObject *obj, int number) {

GameObject *flare = Commands->Find_Object(flareID);

if(number == 1){

		Commands->Create_2D_WAV_Sound("m00gnod_kill0030a2nsmg_snd.wav");
		Commands->Attach_Script(flare,"Test_Cinematic","reconVehicle_Paratroopers.txt");
	}
if(number == 2){

	Console_Input("msg a Nod Vehicle is arriving!");	
	}
if(number == 3){

		Commands->Create_2D_WAV_Sound("m00evag_dsgn0006i1evag_snd.wav");
	}
}


ScriptRegistrant<reb_reconVehicle_reinforcements> reb_reconVehicle_reinforcements_Registrant("reb_reconVehicle_reinforcements","");


gmmain.h
class reb_reconVehicle_reinforcements : public ScriptImpClass {
	void Created(GameObject *obj);
	void Timer_Expired(GameObject *obj,int number);
	int flareID;
};


and the txt file for in your data folder.
reconVehicle_Paratroopers.txt
;************************* Transport Helicopter Hummvee Drop  ************************

; ****************************** Trajectory Transport

-1	Create_Object,		1, "XG_TransprtBone",			0, 0, 0, 0
-1	Play_Animation,		1, "XG_TransprtBone.XG_HD_TTraj", 1

; ****************************** Transport

-1	Create_Real_Object,	2, "CnC_GDI_Transport", 1, "BN_Trajectory"
-1	Attach_Script,		2, "KAK_Prevent_Destruction_Until_Entered"
-1	Set_Primary,		2
-1	Attach_to_Bone,		2, 1, "BN_Trajectory"
-1	Play_Animation,		2, "v_GDI_trnspt.XG_HD_Transport",1
-700	destroy_object,		2

; ****************************** Trajectory Nod_Light_Tank

-1	Create_Object,		3, "XG_HD_HTraj",			0, 0, 0, 0
-1	Play_Animation,		3, "XG_HD_HTraj.XG_HD_HTraj", 1

; ****************************** Nod_Light_Tank

-1	Create_Real_Object,	4, "Nod_Recon_Bike_Player", 3, "BN_Trajectory" 
-1	Attach_Script,		4, "M02_Player_Vehicle", "0"
-1	Attach_Script,		4, "KAK_Prevent_Destruction_Until_Entered"
-1	Attach_to_Bone,		4, 3, "BN_Trajectory"
-437	Attach_to_Bone,		4, -1, "BN_Trajectory"
-437	Move_Slot,		7, 4

; ****************************** Harness

-1	Create_Object,		6, "XG_HD_Harness",			0, 0, 0, 0
-1	Play_Animation,		6, "XG_HD_Harness.XG_HD_Harness", 0

; ****************************** Primary Destroyed

1000000 Destroy_Object, 1
1000000 Destroy_Object, 2
1000000 Destroy_Object, 3
1000000 Destroy_Object, 4
1000000 Destroy_Object, 5
1000000 Destroy_Object, 6


thats all Wink
have fun


Re: Purchase Vehicles [message #318126 is a reply to message #317947] Wed, 20 February 2008 06:38 Go to previous messageGo to next message
SODPaddy is currently offline  SODPaddy
Messages: 232
Registered: August 2005
Location: Germany
Karma: 0
Recruit

I dont know in what line in gmmain.h i must add

class reb_reconVehicle_reinforcements : public ScriptImpClass {
	void Created(GameObject *obj);
	void Timer_Expired(GameObject *obj,int number);
	int flareID;
};


Website: www.Area54.eu

Once 54, Always 54.
(\__/)
(O.o )
(___)
Visit us at www.Area54.eu

[Updated on: Wed, 20 February 2008 06:40]

Report message to a moderator

Re: Purchase Vehicles [message #318141 is a reply to message #317947] Wed, 20 February 2008 10:18 Go to previous messageGo to next message
ExEric3 is currently offline  ExEric3
Messages: 746
Registered: February 2005
Location: Slovakia
Karma: 0
Colonel
Under last class.
Re: Purchase Vehicles [message #318152 is a reply to message #317947] Wed, 20 February 2008 11:33 Go to previous messageGo to next message
SODPaddy is currently offline  SODPaddy
Messages: 232
Registered: August 2005
Location: Germany
Karma: 0
Recruit

i addet but i become

error C2653 1>.\gmmain.cpp(678) : error C2653: 'reb_reconVehicle_reinforcements': No Class ....


Website: www.Area54.eu

Once 54, Always 54.
(\__/)
(O.o )
(___)
Visit us at www.Area54.eu
Re: Purchase Vehicles [message #318156 is a reply to message #317947] Wed, 20 February 2008 11:57 Go to previous messageGo to previous message
SODPaddy is currently offline  SODPaddy
Messages: 232
Registered: August 2005
Location: Germany
Karma: 0
Recruit

Some error too ...

index.php?t=getfile&id=5924&private=0
  • Attachment: Unbenannt.JPG
    (Size: 51.22KB, Downloaded 305 times)


Website: www.Area54.eu

Once 54, Always 54.
(\__/)
(O.o )
(___)
Visit us at www.Area54.eu
Previous Topic: CnC Reborn isn't Duke Nukem Forever...
Next Topic: Harvester controllers
Goto Forum:
  


Current Time: Tue Sep 17 15:18:16 MST 2024

Total time taken to generate the page: 0.01137 seconds