Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Release Forum » MapFix Plugin
Re: MapFix Plugin [message #492314 is a reply to message #492305] Fri, 28 April 2017 05:41 Go to previous messageGo to previous message
jonwil is currently offline  jonwil
Messages: 3557
Registered: February 2003
Karma:
General (3 Stars)

If you want to find the exact position/facing of, say, the Nod Refinery MCT (that is, the physics object that counts as the MCT and will take the extra MCT damage when hit), do this:

#include "buildingaggregateclass.h"
#include "buildinggameobj.h"
#include "matrix3d.h"

//somewhere in your code
BuildingGameObj *obj = Find_Refinery(0);
BuildingAggregateClass *ba = obj->Find_MCT();
Matrix3D tm = ba->Get_Transform();
Vector3 position = tm.Get_Translation();
float rotation = RAD2DEG(tm.Get_Z_Rotation());


Change the first line of code as appropriate to find the MCT for different buildings.
The position/rotation values you just obtained can be passed to Commands->Set_Position and Commands->Set_Facing as appropriate.

The values you get here should match exactly to what you would see if you opened up the .lvl file in LevelEdit and double clicked on the MCT 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
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Some simple C# code for retrieving servers and server info from the GameSpy master list
Next Topic: [SSGM 4.0 Plugin] Building Revival Console Commands v2.0
Goto Forum:
  


Current Time: Thu Jan 02 18:29:08 MST 2025

Total time taken to generate the page: 0.00744 seconds