spwaners code [message #354350] |
Tue, 14 October 2008 10:51 |
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 |
|
Jerad2142
Messages: 3811 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.
Visit Jerad's deer sweat shop
|
|
|