DCS func addStaticObject

From DCS World Wiki - Hoggitworld.com

Scripting Root

Envrioment: Mission Scripting
Function: addStaticObject Added with: 1.2.4
Member Of: coalition
Syntax: Static Object coalition.addStaticObject(enum countryId , table groupData )
Description: Dynamically spawns a static object belonging to the specified country into the mission. This function follows the same rules as coalition.addGroup except for the object table not perfectly matching the format of a static object as seen in the mission file.

- Static Objects name cannot be shared with an existing object, if it is the existing object will be destroyed on the spawning of the new object. - If unitId is not specified or matches an existing object, a new Id will be generated. - Coalition of the object is defined based on the country the object is spawning to.

Return Value: Static Object
Return Example: none
Examples: Basic table for a static object

local staticObj = {
	["heading"] = 0,
	["groupId"] = 3,
	["shape_name"] = "stolovaya",
	["type"] = "Cafe",
	["unitId"] = 3,
	["rate"] = 100,
	["name"] = "dynBuilding",
	["category"] = "Fortifications",
	["y"] = 621528.57142856,
	["x"] = -294100,
	["dead"] = false,

coalition.addStaticObject(country.id.USA, staticObj)

Required values

 name         string for the static object name
 type         string for the type of object
 x            number for x coordinate
 y            number for y coordinate

Optional Values

 dead         boolean for whether or not the object will appear as a wreck
 rate         number value for the "score" of the object when it is killed
 groupId      number groupId
 unitId       number unitId
 heading      number heading of the object in radians
 linkOffset   boolean for whether or not the static object will be attached to a ship. 
 linkUnit     number unitId corresponding to the ship that the offset is based off of. 
 offsets      table defining the position and orientation of the static object relative to the center of the offset unit. Table is simply in the format: {x, y, angle}

Cargo Object values

 mass        number how much the cargo object will weigh. Some cargo objects have fixed mass
 canCargo    boolean for whether or not the cargo object can be lifted

Aircraft and Helicopter values

 livery_id   string name of the livery for the aircraft
Related Functions: Coalition Functions: addGroup, addStaticObject, getGroups, getStaticObjects, getAirbases. getPlayers, getServiceProviders, addRefPoint, getRefPoints, getMainRefPoint, getCountryCoalition
Notes: Required entries differ from object to object.

FARPs are spawned using coalition.addGroup