Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Question...
Re: Question... [message #466835 is a reply to message #466348] Sat, 28 April 2012 16:19 Go to previous messageGo to previous message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma:
Recruit
Whitedragon wrote on Thu, 19 April 2012 05:01


The code below will create a zone at the base center. For some maps, like Canyon and Glacier, you'll need more than one zone to properly cover the base.


Vector3 Get_Base_Center(int Team) {
	Vector3 ReturnPos(0.0f,0.0f,0.0f);
	BaseControllerClass *Base = BaseControllerClass::Find_Base(Team);
	if (Base) {
		int Num = 0;
		for (Num = 0;Num < Base->BuildingList.Count();Num++) {
			ReturnPos += Commands->Get_Position(Base->BuildingList[Num]);
		}
		if (Num) {
			ReturnPos /= (float)Num;
		}
	}
	return ReturnPos;
}

void LevelLoaded() {
	Vector3 Size = Vector3(50.0f,50.0f,50.0f); //Should load the size per map from a config file.
	Matrix3 Rotation(true);
	Rotation.Rotate_Z(1.0f); //Should load a rotation per map from a config file.
	OBBoxClass Box(Get_Base_Center(0),Size,Rotation); //Create the bounding box with the position of the Nod base, and the size and rotation defined earlier.
	GameObject* Zone = Create_Zone("Script_Zone_All",Box);
	//Attach whatever script you want to the zone now.
}



i wanted to use this but i cant, buildinglist is inaccesible, so i cant do it this


Owner of kambot TT server

kambot.freeforums.org
 
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: scripts when changing character
Next Topic: C&C Hourglass Amsterdam's Red Light District Progress
Goto Forum:
  


Current Time: Mon Dec 23 05:57:06 MST 2024

Total time taken to generate the page: 0.00994 seconds