Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Question...
Re: Question... [message #466348 is a reply to message #466347] Wed, 18 April 2012 20:01 Go to previous messageGo to previous message
Whitedragon is currently offline  Whitedragon
Messages: 832
Registered: February 2003
Location: California
Karma:
Colonel
robbyke wrote on Wed, 18 April 2012 17:55

i do everything trough scripting

I also prefer doing stuff through scripts.

For what you want to do you should create the zone in the level loaded hook.

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.
}


Black-Cell.net
Network Administrator (2003 - )

DragonServ, Renegade's first IRC interface bot
Creator and lead coder (2002 - )

Dragonade, Renegade's first server side modification
Lead coder (2005 - )

[Updated on: Wed, 18 April 2012 20:02]

Report message to a moderator

 
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 06:08:01 MST 2024

Total time taken to generate the page: 0.01107 seconds