Question about LUA (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series



Message


snowburn -> Question about LUA (12/7/2014 6:23:05 PM)

Hello!!

i want to add some reserve aircraft to a mission when 5 sam sites where destroyed.
can we do something like this with the new LUA editor?



Event scenario_start:
trigger: T1
action: init_variables


Event: SAM Site destroyed
trigger: sam_site_hit
action: sam_site_count
add_fighters




Action init_variables:
ScenEdit_SetKeyValue('sam_site_destroyed', 0 )


Action: sam_site_count:
ScenEdit_SetKeyValue('sam_site_destroyed', ScenEdit_GetKeyValue('sam_site_destroyed') +1 )


Action add_fighters:
if(ScenEdit_GetKeyValue('sam_site_destroyed') == 5) {
ScenEdit_AssignUnitToMission('ac1', 'CAP')
ScenEdit_AssignUnitToMission('ac2', 'CAP')
ScenEdit_AssignUnitToMission('ac3', 'CAP')
ScenEdit_AssignUnitToMission('ac4', 'CAP')
ScenEdit_AssignUnitToMission('ac5', 'CAP')
}








ckfinite -> RE: Question about LUA (12/7/2014 6:25:16 PM)

Yep, that should work.




snowburn -> RE: Question about LUA (12/7/2014 6:26:42 PM)

thanks :)
i hope we can have a release canditate soon




mx1 -> RE: Question about LUA (12/10/2014 9:35:32 PM)

Is the ScenEdit_SetKeyValue part of API? I don't see it documented on github site.





snowburn -> RE: Question about LUA (12/10/2014 9:49:35 PM)


quote:

ORIGINAL: mx1

Is the ScenEdit_SetKeyValue part of API? I don't see it documented on github site.




http://wiki.baloogancampaign.com/index.php/ScenEdit_SetKeyValue




ckfinite -> RE: Question about LUA (12/10/2014 11:43:11 PM)

I knew I forgot something, sorry about that. Yes, SetKeyValue and GetKeyValue are both valid functions.




ckfinite -> RE: Question about LUA (12/10/2014 11:49:07 PM)

They are now documented, again sorry about that.




mx1 -> RE: Question about LUA (1/22/2015 9:40:41 PM)

I've also found that ScenEdit_GetReferencePoint() works as expected but is not documented. It is pretty useful function to check whether unit is within certain area defined by RPs.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.671875