Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » finding *any* building
Re: finding *any* building [message #467582 is a reply to message #467517] Sun, 20 May 2012 18:48 Go to previous messageGo to previous message
jonwil is currently offline  jonwil
Messages: 3557
Registered: February 2003
Karma:
General (3 Stars)

Here is some code that should work:
#include "BuildingGameObj.h"
	SLNode<BuildingGameObj> *x = GameObjManager::BuildingGameObjList.Head();
	while (x)
	{
		BuildingGameObj *o = (GameObject *)x->Data();
		if (o && (Get_Object_Type(o) == 0 || Get_Object_Type(o) == 1))
		{
			StringClass str;
			str.Format("%d",Get_Object_Type(o));
			Vector3 Size = Vector3(40.0f,40.0f,80.0f); //Size of the script zone.
			Matrix3 Rotation(true);
			Rotation.Rotate_Z(DEG_TO_RADF(Commands->Get_Facing(o))); //Set the rotation of the script zone to the same as the building.
			Vector3 Pos = Commands->Get_Position(o);
			Pos.Z -= 20;
			OBBoxClass Box(Pos,Size,Rotation); //Create the bounding box with the position of the beacon, and the size and rotation defined earlier.
			GameObject* Zone = Create_Zone("Script_Zone_All",Box);
			Attach_Script_Once(Zone,"KB_Base_Zone",Team);
		}
		x = x->Next();
	}

The key here is Get_Object_Type to identify the type of the object.


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
 
Read Message
Read Message
Read Message
Previous Topic: Sounds like in irc but instead in C++
Next Topic: Can the SP maps be played in MP?
Goto Forum:
  


Current Time: Wed Dec 25 22:32:04 MST 2024

Total time taken to generate the page: 0.00697 seconds