Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Base Defense Team Change  () 1 Vote
Re: Base Defense Team Change [message #330966 is a reply to message #330814] Sun, 18 May 2008 03:11 Go to previous messageGo to previous message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma:
General (3 Stars)
void RequestSpawn(GameObject *obj) {
int RandomSpawn = Commands->Get_Random_Int(1,33);
		Vector3 NewPos;

	Spawn:

if (strcmp(The_Game()->MapName, "C&C_Under.mix") == 0) {
	if (RandomSpawn == 1 && Spawn1OK == true) {

		Spawn1OK = false;

		NewPos.X = 0.0f;
		NewPos.Y = 0.0f;
		NewPos.Z = 0.0f;

	}
	else if (RandomSpawn == 2 && Spawn2OK == true) {
		Spawn2OK = false;
		NewPos.X = 0.0f;
		NewPos.Y = 0.0f;
		NewPos.Z = 0.0f;

	}
	else if (RandomSpawn == 3 && Spawn3OK == true) {
		Spawn3OK = false;
		NewPos.X = 0.0f;
		NewPos.Y = 0.0f;
		NewPos.Z = 0.0f;

	}
GameObject *Refresh;

		Refresh = Commands->Create_Object("Invisible_Object",Vector3(0.0f,0.0f,0.0f));

		char param[5];
	sprintf(param,"%d",RandomSpawn);
	Commands->Attach_Script(Refresh,"KAK_DM_Refresh_Spawn",param);

	Commands->Set_Position(obj,NewPos);

}
else if (strcmp(The_Game()->MapName, "C&C_someothermap.mix") == 0) {
	if (RandomSpawn == 1 && Spawn1OK == true) {

		Spawn1OK = false;

		NewPos.X = 0.0f;
		NewPos.Y = 0.0f;
		NewPos.Z = 0.0f;

	}
	else if (RandomSpawn == 2 && Spawn2OK == true) {
		Spawn2OK = false;
		NewPos.X = 0.0f;
		NewPos.Y = 0.0f;
		NewPos.Z = 0.0f;

	}
	else if (RandomSpawn == 3 && Spawn3OK == true) {
		Spawn3OK = false;
		NewPos.X = 0.0f;
		NewPos.Y = 0.0f;
		NewPos.Z = 0.0f;

	}
GameObject *Refresh;

		Refresh = Commands->Create_Object("Invisible_Object",Vector3(0.0f,0.0f,0.0f));

		char param[5];
	sprintf(param,"%d",RandomSpawn);
	Commands->Attach_Script(Refresh,"KAK_DM_Refresh_Spawn",param);

	Commands->Set_Position(obj,NewPos);

}
}



void KAK_DM_Refresh_Spawn::Created(GameObject *obj) {
	Commands->Start_Timer(obj,this,5.0f,Get_Int_Parameter("SpawnNum"));
}

void KAK_DM_Refresh_Spawn::Timer_Expired(GameObject *obj, int number) {
	if (number == 1) Spawn1OK = true;	
	else if (number == 2) Spawn2OK = true;
	else if (number == 3) Spawn3OK = true;
	Commands->Destroy_Object(obj);
}


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




ScriptRegistrant<KAK_DM_Refresh_Spawn> KAK_DM_Refresh_Spawn_Registrant("KAK_DM_Refresh_Spawn","SpawnNum=0:int");





class teleChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {

GameObject *obj = Get_GameObj(ID);
RequestSpawn(obj);
}

};
ChatCommandRegistrant<teleChatCommand> teleChatCommandReg("!tele",CHATTYPE_ALL,0,GAMEMODE_ALL);



You will need to change the places it can spawn to, instead of 0,0,0, you can get these values from level edit, but I prefer to walk around ingame and decide for myself, when making allot I find it's quicker anyway...
Use this chat hook to get the precise floating point values for where you're standing (also gives some other info too, but don't worry about that).


class infoChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		GameObject *obj = Get_GameObj(ID);

const char *preset = Commands->Get_Preset_Name(obj);
const char *model = Get_Model(obj);
const char *weapon = Get_Current_Weapon(obj);
const char *shield = Get_Shield_Type(obj);
const char *skin = Get_Skin(obj); 
Vector3 CurPosition = Commands->Get_Position(obj);
Console_Input(StrFormat("msg Character preset name is: %s",preset).c_str());
Console_Input(StrFormat("msg Character model name is: %s",model).c_str());
Console_Input(StrFormat("msg The preset name of the weapon is: %s",weapon).c_str());
Console_Input(StrFormat("msg The shield type is: %s",shield).c_str());
Console_Input(StrFormat("msg The skin type is: %s",skin).c_str());
Console_Input(StrFormat("msg NewPos.X = %ff;",CurPosition.X).c_str());
Console_Input(StrFormat("msg NewPos.Y = %ff;",CurPosition.Y).c_str());
Console_Input(StrFormat("msg NewPos.Z = %ff;",CurPosition.Z).c_str());
	}
};
ChatCommandRegistrant<infoChatCommand> infoChatCommandReg("!info",CHATTYPE_TEAM,0,GAMEMODE_ALL);



That should make you spawn in any three random places based on whatever map you're on. You can easily extend it for as many maps as needed.



 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: W3d import error-dsp_shipradar.w3d
Next Topic: [Release]Some skins
Goto Forum:
  


Current Time: Tue Jul 22 01:27:58 MST 2025

Total time taken to generate the page: 0.01354 seconds