Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » spwaners code
spwaners code [message #354350] Tue, 14 October 2008 10:51 Go to next message
snazy2000 is currently offline  snazy2000
Messages: 67
Registered: December 2007
Karma: 0
Recruit
i have made this code bt it dont work in game

class gspawnerChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
GameObject *obj = Get_GameObj(ID);
Vector3 position;
position = Commands->Get_Position(obj);
position.Z += 1.20;
position.X += (float)(5*cos(Commands->Get_Facing(Get_GameObj(ID))*(3.14 / 180)));
position.Y += (float)(5*sin(Commands->Get_Facing(Get_GameObj(ID))*(3.14 / 180)));
GameObject *dave = Commands->Create_Object("Invisible_Object", position);
Commands->Attach_To_Object_Bone(dave, obj, "GDI Spawner");
}
};
ChatCommandRegistrant<gspawnerChatCommand> gspawnerChatCommandReg("!gdisp",CHATTYPE_ALL,0,GAMEMODE_ALL);


it doesnt crash but i dont no if makes spawner biut it never sends me to it have i done something rong??
Re: spwaners code [message #354450 is a reply to message #354350] Wed, 15 October 2008 08:27 Go to previous message
Jerad2142 is currently offline  Jerad2142
Messages: 3808
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
snazy2000 wrote on Tue, 14 October 2008 11:51

i have made this code bt it dont work in game
GameObject *dave = Commands->Create_Object("Invisible_Object", position);
Commands->Attach_To_Object_Bone(dave, obj, "GDI Spawner");
}



I could be wrong but I don't remember any object in the presets that goes by the name of "Invisible_Object" but in any case, you are attaching this "Invisible_Object" to the person that said the chat message I assume, notice, you are attaching this newly created object to a bone named "GDI Spawner"...

Commands->Attach_To_Object_Bone(dave, obj, "GDI Spawner");

My guess is that this line is pretty much useless unless you want the "Invisible_Object" to be stuck to the speaker's origin. Also, look through the presets list and choose an object that you want this script to create, then replace "Invisible_Object" with this new preset name, you can also remove that attach to bone line of code, it will spawn at the position you are finding fine if you do.


Previous Topic: Fix scope?
Next Topic: Presets:
Goto Forum:
  


Current Time: Fri Sep 06 09:35:15 MST 2024

Total time taken to generate the page: 0.00548 seconds