Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

LUA Question "size"

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> LUA Question "size" Page: [1]
Login
Message << Older Topic   Newer Topic >>
LUA Question "size" - 7/23/2019 3:54:34 PM   
sarjen

 

Posts: 111
Joined: 7/14/2004
Status: offline
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

Attachment (1)
Post #: 1
RE: LUA Question "size" - 7/24/2019 8:46:49 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
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

< Message edited by michaelm75au -- 7/24/2019 9:00:08 AM >


_____________________________

Michael

(in reply to sarjen)
Post #: 2
RE: LUA Question "size" - 7/24/2019 9:17:17 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
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

(in reply to michaelm75au)
Post #: 3
RE: LUA Question "size" - 7/24/2019 9:44:30 AM   
sarjen

 

Posts: 111
Joined: 7/14/2004
Status: offline
nothing to see


Many thanks Michael. I was blind.

< Message edited by sarjen -- 7/24/2019 9:45:34 AM >

(in reply to michaelm75au)
Post #: 4
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> LUA Question "size" Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.656