Puddlemonkey Posted February 6, 2014 Posted February 6, 2014 Hi, Is it possible to spawn static objects using lua in a similar way to spawning groups? Thanks PM
Yurgon Posted February 6, 2014 Posted February 6, 2014 Is it possible to spawn static objects using lua in a similar way to spawning groups? I just did that in a mission. Use coalition.addStaticObject. Parameter 1 is the coalition, parameter 2 takes the object as it appears in a mission file. In my case, it looks like this: kutaisi_hog_stand_in = { ["type"] = "A-10C", ["unitId"] = 999, ["livery_id"] = "81st FS Spangdahlem AB, Germany (SP) 1", ["y"] = 695048.85714287, ["x"] = -275882.2857143, ["name"] = "Kutaisi Hog Stand-In", ["category"] = "Planes", ["canCargo"] = false, ["heading"] = 6.0562925044203, } coalition.addStaticObject(2, kutaisi_hog_stand_in) I simply placed the object in the ME, saved the mission, and then Copy&Pasted the block from the mission file. (I'm assuming that you're familiar with these steps; if not, I can go into more detail, no problems.)
Puddlemonkey Posted February 20, 2014 Author Posted February 20, 2014 Thanks Yurgon - I didn't realise that function existed.
Yurgon Posted February 20, 2014 Posted February 20, 2014 Quick follow-up, parameter 1 for coalition.addStaticObject() is a country ID, not a coalition ID, and it can be written like so: local country_id = country.id.USA local obj_data = {} -- Just a placeholder coalition.addStaticObject(country_id, obj_data) The list of countries is documented in the Hoggit Wiki.
HiJack Posted February 21, 2014 Posted February 21, 2014 OK, thats a good way to recreate static objects from mission to mission! This would be the best way to have predefined groups of static objects. Thanks :D
Recommended Posts