Jump to content

how to access info about static objects?


Recommended Posts

Posted

How to access info about static objects, say an oil platform created in the mission editor. Say I want to get its position, or if it is destroyed or not. I would know how to do that for a unit (Unit.getPosition(Unit.getByName('unitname')).p), but that doesn't work for static objects.

 

I also tried Object.getPosition(Object.getByName('unitname')).p and Static.getPosition(Static.getByName('unitname')).p), results in error messages

 

:helpsmilie:

[sIGPIC][/sIGPIC]

 

Intel Core I7 4820K @4.3 GHz, Asus P9X79 motherboard, 16 GB RAM @ 933 MHz, NVidia GTX 1070 with 8 GB VRAM, Windows 10 Pro

Posted

I too am working on a mission that requires the knowledge of whether a static object has been destroyed or not.

 

My guess would have been

 

(Object.getByName('unitname')

 

Does this command alone not return anything?

 

 

How about trying the following below?

array of StaticObject function coalition.getStaticObjects(enum coalition.side coalition)

314-я смешанная авиационная дивизия

314th Mixed Aviation Division: The "Fighting Lemmings"- Forums: http://314thsquadron.enjin.com/ - ED Forum Group: http://forums.eagle.ru/group.php?groupid=119

Posted

Just tried this out in my mission and everything worked out fine.

 

local static_object = StaticObject.getByName('static_object_blah')
local health = static_object:getLife() -- Return an integer
local position = static_object:getPosition() -- Returns a vector 3 table

 

I you needed to use StaticObject instead of just Static

314-я смешанная авиационная дивизия

314th Mixed Aviation Division: The "Fighting Lemmings"- Forums: http://314thsquadron.enjin.com/ - ED Forum Group: http://forums.eagle.ru/group.php?groupid=119

Posted
Just tried this out in my mission and everything worked out fine.

 

local static_object = StaticObject.getByName('static_object_blah')
local health = static_object:getLife() -- Return an integer
local position = static_object:getPosition() -- Returns a vector 3 table

I you needed to use StaticObject instead of just Static

 

Thanks man! Much appreciated.

[sIGPIC][/sIGPIC]

 

Intel Core I7 4820K @4.3 GHz, Asus P9X79 motherboard, 16 GB RAM @ 933 MHz, NVidia GTX 1070 with 8 GB VRAM, Windows 10 Pro

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...