Home » Renegade Discussions » Mod Forum » Purchase Vehicles
Purchase Vehicles [message #317947] |
Tue, 19 February 2008 09:22 |
|
SODPaddy
Messages: 233 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
Dont say "try and eventually you will get it working" or something like that
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 |
|
SODPaddy
Messages: 233 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 |
|
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 #317990 is a reply to message #317947] |
Tue, 19 February 2008 12:38 |
|
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.
|
[Updated on: Tue, 19 February 2008 12:47] Report message to a moderator
|
|
|
|
|
Re: Purchase Vehicles [message #317998 is a reply to message #317991] |
Tue, 19 February 2008 13:10 |
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 #318005 is a reply to message #318004] |
Tue, 19 February 2008 13:26 |
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 #318018 is a reply to message #317947] |
Tue, 19 February 2008 14:10 |
|
SODPaddy
Messages: 233 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 #318052 is a reply to message #317947] |
Tue, 19 February 2008 18:29 |
|
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
have fun
http://www.wittebolx.com
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sun Dec 29 17:58:54 MST 2024
Total time taken to generate the page: 0.01190 seconds
|