How to add a Satellite by using lua? (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion



Message


M1A2G -> How to add a Satellite by using lua? (5/19/2019 2:39:14 PM)

I entried this in the Lua Console:
ScenEdit_AddUnit({side='C',name='X',type='Satellite',dbid=70,orbit=15,lat='23',lon='112'})

It showed 'ScenEdit_AddUnit 0 : ,Unable to create new unit'.
Was it because of my wrong entrying or the function itself had a bug?[&:]




stilesw -> RE: How to add a Satellite by using lua? (5/19/2019 3:58:07 PM)

M1A2G,

I just checked the online Lua reference (http://commandlua.github.io/index.html#Unit) and it looks like you should include the "NewUnit" parameter within the ScenEdit_AddUnit command.

ScenEdit_AddUnit
New unit selector.
... lists minimum fields required. Other fields from Unit may be included.

type string The type of unit (Ship, Sub, Aircraft, Facility, Satellite)
unitname string The name of the unit
side string The side name or GUID to add unit to
dbid number The database id of the unit
latitude Latitude Not required if a base is defined
longitude Longitude Not required if a base is defined
base string Unit base name or GUID where the unit will be 'hosted' (applicable to AIR, SHIP, SUB)
loadoutid number Aircraft database loadout id (applicable to AIR)
altitude number Unit altitude (applicable to AIR)
depth number Unit depth (applicable to SUBMARINE - note no sign)
orbit number Orbit index (applicable to SATELLITE)
guid string Optional custom GUID to override auto one

-Wayne





Whicker -> RE: How to add a Satellite by using lua? (5/19/2019 4:46:20 PM)

if you drop the orbit it works but it is non functional - looks like it is on the ground. What is orbit=15? where did you get that?

I don't see any examples of adding a satellite via lua, only thing I found was something about changing an existing ones orbit:
https://steamcommunity.com/app/321410/discussions/0/3362406825547730620/




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
2.655762