LUA Question "size"

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
sarjen
Posts: 115
Joined: Wed Jul 14, 2004 5:10 pm
Contact:

LUA Question "size"

Post by sarjen »

I want to add a lonely tank for the Rebels. I only got the dbid = 813. But this is a platoon of tanks. I cant change the platoon to just one tank with the size value. I tried that already. Any insight?


So far this is my random insert script:

math.randomseed(os.time())
math.random(); math.random(); math.random()
r = 1
repeat
a = ( math.random( 1, 100 ) )
r = r + 1
until( r > 10 )

if a<30 then

ScenEdit_AddUnit({type = 'Facility', side = 'Huthi Rebels', name = 'Old Tank', dbid = 813, latitude='13.3421119994231', longitude='44.4575266120756', size=1})

elseif a>=30 and a<70 then

ScenEdit_AddUnit({type = 'Facility', side = 'Huthi Rebels', name = 'Elite Fighters', dbid = 3001, latitude='13.4361864266395', longitude='44.5714532192344', proficiency = 'Veteran'})

elseif a>=70 then

ScenEdit_AddUnit({type = 'Facility', side = 'Huthi Rebels', name = 'Old ZSU', dbid = 909, latitude='13.392123409137', longitude='44.495733037447'})

end
Attachments
YemenCivi..gonehot.zip
(68.69 KiB) Downloaded 12 times
User avatar
michaelm75au
Posts: 12464
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: LUA Question "size"

Post by michaelm75au »

You can use the ScenEdit_updateUnit() to remove mounts from the 'Old Tank' so there is only the one 'mount' left.
I can't download the latest 31.2 to write the Lua commands to show you.
There is a defect with "mode=remove_mount" which actually added mounts which was fixed in latest '1009.31.2' build
Michael
User avatar
michaelm75au
Posts: 12464
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: LUA Question "size"

Post by michaelm75au »

Quick and dirty way
math.randomseed(os.time())
math.random(); math.random(); math.random()
r = 1
repeat
a = ( math.random( 1, 100 ) )
r = r + 1
until( r > 10 )

if a<30 then

local u = ScenEdit_AddUnit({type = 'Facility', side = 'Huthi Rebels', name = 'Old Tank', dbid = 813, latitude='13.3421119994231', longitude='44.4575266120756', size=1})
ScenEdit_UpdateUnit({guid=u.guid, mode='remove_mount', dbid=1053})
ScenEdit_UpdateUnit({guid=u.guid, mode='remove_mount', dbid=1053})
ScenEdit_UpdateUnit({guid=u.guid, mode='remove_mount', dbid=1053})

elseif a>=30 and a<70 then

ScenEdit_AddUnit({type = 'Facility', side = 'Huthi Rebels', name = 'Elite Fighters', dbid = 3001, latitude='13.4361864266395', longitude='44.5714532192344', proficiency = 'Veteran'})

elseif a>=70 then

ScenEdit_AddUnit({type = 'Facility', side = 'Huthi Rebels', name = 'Old ZSU', dbid = 909, latitude='13.392123409137', longitude='44.495733037447'})

end
Michael
sarjen
Posts: 115
Joined: Wed Jul 14, 2004 5:10 pm
Contact:

RE: LUA Question "size"

Post by sarjen »

nothing to see


Many thanks Michael. I was blind.
Post Reply

Return to “Lua Legion”