Append to z.cpp or use where you want..:
void z_Teleport_Enter_Random_ID::Created(GameObject *obj)
{
RandomT = Commands->Get_Random_Int(1,4);
enablemsg = Get_Int_Parameter("EnableMessage");
disablemsg = Get_Int_Parameter("DisableMessage");
id1 = Get_Int_Parameter("ID1");
id2 = Get_Int_Parameter("ID2");
id3 = Get_Int_Parameter("ID3");
id4 = Get_Int_Parameter("ID4");
GotoObject1 = Commands->Find_Object(id1);
GotoObject2 = Commands->Find_Object(id2);
GotoObject3 = Commands->Find_Object(id3);
GotoObject4 = Commands->Find_Object(id4);
loc1 = Commands->Get_Position(GotoObject1);
loc2 = Commands->Get_Position(GotoObject2);
loc3 = Commands->Get_Position(GotoObject3);
loc4 = Commands->Get_Position(GotoObject4);
if (Get_Int_Parameter("Start_Enabled"))
{
Teleport = true;
}
else Teleport = false;
}
void z_Teleport_Enter_Random_ID::Entered(GameObject *obj, GameObject *enter)
{
team = Commands->Get_Player_Type(enter);
if (Teleport)
{
if (team == Get_Int_Parameter("Team"))
{
if (RandomT == 1)
{
Commands->Set_Position(enter,loc1);
}
if (RandomT == 2)
{
Commands->Set_Position(enter,loc2);
}
if (RandomT == 3)
{
Commands->Set_Position(enter,loc3);
}
if (RandomT == 4)
{
Commands->Set_Position(enter,loc4);
}
}
}
}
void z_Teleport_Enter_Random_ID::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
if (message == enablemsg)
{
Teleport = true;
}
if (message == disablemsg)
{
Teleport = false;
}
}
ScriptRegistrant<z_Teleport_Enter_Random_ID> z_Teleport_Enter_Random_ID_Registrant("z_Teleport_Enter_Random_ID","Team=0:int,Start_Enabled=1:int,EnableMessage=1000:int,DisableMessage=2000:int,ID1=123:int,ID2=123:int,ID3=123:int,ID4=123:int");
Append to z.h or use where you want..:
class z_Teleport_Enter_Random_ID : public ScriptImpClass {
void Created(GameObject *obj);
void Entered(GameObject *obj,GameObject *enter);
void Custom(GameObject *obj,int message,int param,GameObject *sender);
bool Teleport;
int RandomT;
int team;
int id1;
int id2;
int id3;
int id4;
int enablemsg;
int disablemsg;
GameObject *GotoObject1;
GameObject *GotoObject2;
GameObject *GotoObject3;
GameObject *GotoObject4;
Vector3 loc1;
Vector3 loc2;
Vector3 loc3;
Vector3 loc4;
};