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 Q: Aircraft availability change

 
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 Q: Aircraft availability change Page: [1]
Login
Message << Older Topic   Newer Topic >>
Lua Q: Aircraft availability change - 4/26/2019 9:23:34 AM   
Sardaukar


Posts: 7092
Joined: 11/28/2001
From: Finland/Israel/Bulgaria
Status: offline
I am total newbie with Lu...so have a questin:

Is it possible via Lua to change a/c randomly from Maintenance to Reserve/Ready?

It'd make those a/c potentially usable instead of pure targets. It'd resemble maintenance efforts or ground crews. Randomized with min. delay would be great.

_____________________________

"To meaningless French Idealism, Liberty, Fraternity and Equality...we answer with German Realism, Infantry, Cavalry and Artillery" -Prince von Bülov, 1870-

Post #: 1
RE: Lua Q: Aircraft availability change - 4/26/2019 10:11:04 AM   
Gunner98

 

Posts: 4196
Joined: 4/29/2005
From: The Great White North!
Status: offline
I'm certainly not one of the wizards with Lua but short answer is - yes you can. The best guide for Lua is here: http://commandlua.github.io/index.html

You can randomize a repeatable event. Triggered on 'regular time' and the action would be:

ScenEdit_SetLoadout (loadoutinfo)

If you go to the site and then go to 'Loadoutinfo' you will find the 5 things you need to consider in the command:

1. UnitName: this will be the tricky bit
2. LoadoutID: you find this in the DB entry far right hand column for loadouts (Reserve is universally '3' and Maint is '4' I think)
3. TimeToReady_Minutes: this might be '0' or whatever you want
4. IgnoreMagazines: this is probably one you would just omit
5. ExcludeOptionalWeapons: omit

So if it was only one unit in question:

ScenEdit_SetLoadout (UnitName= Arco #1, LoadoutID= 3, TimeToReady_Minutes=0)

You may be able to shortcut this as:

ScenEdit_SetLoadout (Arco #1, 3, 0) (or even omit the time variable)

But I find each command might be slightly different so you need to experiment.

Making this adaptable to fit multiple units is the trick and I'm not the best to talk about that. This is not a difficult one though.

B

_____________________________

Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/

(in reply to Sardaukar)
Post #: 2
RE: Lua Q: Aircraft availability change - 4/26/2019 4:10:04 PM   
Whicker

 

Posts: 635
Joined: 6/20/2018
Status: offline
ScenEdit_SetLoadout (UnitName= Arco #1, LoadoutID= 3, TimeToReady_Minutes=0)

- needs to be in curlies inside the parens as it is a table
- strings are always in quotes - double or single doesn't matter. Numbers and variables are not in quotes

ScenEdit_SetLoadout ({UnitName= 'Arco #1', LoadoutID= 3, TimeToReady_Minutes=0})


(in reply to Gunner98)
Post #: 3
RE: Lua Q: Aircraft availability change - 5/1/2019 2:15:53 PM   
Sharana


Posts: 247
Joined: 2/3/2016
Status: online
As for the random time needed I usually use it like this:

ScenEdit_SetLoadout({unitname='253sq #466', LoadoutID = 3, TimeToReady_Minutes = math.random(60,180), IgnoreMagazines='false'})

The time is in minutes, so in this example the unit will get "reserve" status at some point between 1 and 3 hours after the script gets activated.

_____________________________


(in reply to Whicker)
Post #: 4
RE: Lua Q: Aircraft availability change - 5/1/2019 8:59:50 PM   
SeaQueen


Posts: 1127
Joined: 4/14/2007
From: Washington D.C.
Status: offline
quote:

Is it possible via Lua to change a/c randomly from Maintenance to Reserve/Ready?


Yes. Use the script described here:

http://www.matrixgames.com/forums/tm.asp?m=4499127

but change the line

ScenEdit_SetLoadout({UnitName=v, LoadoutID=tonumber(defaultLoadouts[w.dbid]), IgnoreMagazines=true, TimeToReady_Minutes=0}) 


to read

ScenEdit_SetLoadout({UnitName=v, LoadoutID=3, IgnoreMagazines=true, TimeToReady_Minutes=0}) 

(in reply to Sardaukar)
Post #: 5
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Lua Q: Aircraft availability change 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.121