Having the ability to GetPosition() of defined Static_Models located in world, on map and in buildings.
The following method works with EVERY object except defined Static Objects.
This information would be very useful.
Having the ability to GetPosition() of defined Static_Models located in world, on map and in buildings.
The following method works with EVERY object except defined Static Objects.
This information would be very useful.
N/A
Should be able to return POS with the following:
modded class MissionServer { int GetStaticItem(vector startpoint, float maxdis) { array<Object> NearObjects = new array<Object>; GetGame().GetObjectsAtPosition3D( startpoint, maxdis, NearObjects, null ); int count; for ( int i = 0; i < NearObjects.Count(); i++ ) { if ( NearObjects[i].ClassName() == "Static_model_name" ) { count++; Print( "[Static_Model_Name] --" + NearObjects[i].GetPosition().ToString() ); } } return count; } GetStaticItem("7500 0 7500", 9000 ); }; //
config.cpp
class CfgNonAIVehicles { class StaticObject; class Static_Model_Name: StaticObject { scope=1; model="\DZ\structures\furniture\PATH\TO\MODEL\Model_Name.p3d"; };
Scripted class
class Static_Model_Name extends Object { string Get_StaticReturnItem() { return "Static_Model_Name "; } }
You can get the position from static objects just like with any other object. They also certainly appear in GetObjectsAtPosition3D because I use that on various occasions
can you please explain how.. as the method described above does not work at all...
HOWEVER this method works perfectly on Land_Models defines.. or anything other config defined object
You add that in your config.cpp and be done with it. The name is the name of the p3d
class CfgNonAIVehicles { class StaticObject; class Static_Train_Wagon_Tanker: StaticObject {}; }
The target object can now be treated as any other typed object. GetName() also works there, you do not need to add your own function for that.
My object is the Train_Wagon_Tanker(.p3d) and when I go ingame and get the cursor target, or get all objects in a radius and perform obj.GetName() on them "Train_Wagon_Tanker" appears in the list :)
Are you defining the model in the cpp class or no?
As explained above, with or with out the scripted class, the static items are never found.. cant get them in game with GetName() or GetPosition()
but with ANY other .cpp defined object it works with no issues.
but in OFFline with @BuilderItems;@BuilderStatics i can mouse click on them to get names, but NOT pos.. the pos is always the building POS..
In ONLine, no POS is ever returned.