Jump to content

Recommended Posts

Posted
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.)

  • 2 weeks later...
Posted

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.

Posted

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

  • Recently Browsing   0 members

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