Trigger on Hostilities Commence (Full Version)

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



Message


patpatpowercat -> Trigger on Hostilities Commence (12/6/2019 10:46:57 PM)

I am trying to figure out how to activate a list of missions once two sides commence hostilities. I understand how to activate the missions using lua ScenEdit_SetMission {isactive=true}, but I am trying to figure how to best trigger this action. Originally I was going to do it with a unit destroyed, but I don't want a 3rd side to commence hostilities between the two sides prematurely. So I was looking into firing a once a second trigger and using ScenEdit_GetSidePosture, have if it returns hostile than activate the missions. However, my lua knowledge isn't that great and I'm not sure how to take the return of the GetSidePosture and turn it into a variable for us in an if/then argument, or if this would be the optimal way of doing so.

Any suggestions?




Rory Noonan -> RE: Trigger on Hostilities Commence (12/6/2019 11:11:28 PM)

If it's important that the only variable that is counted is the side postures (i.e. you don't want to use a surrogate like a unit destroyed or a weapon fired) then I'd use a regular time trigger of whatever suits, 1s would be fine because this will be light performance wise until triggered, and have an if statement at the start of the script that checks if the sides are hostile and then activates the missions if that condition is true.

quote:


local sidePosture = ScenEdit_GetSidePosture('Side A','Side B')

if sidePosture == 'H' then

--your code here

end




patpatpowercat -> RE: Trigger on Hostilities Commence (12/6/2019 11:35:25 PM)

Thanks so much! I just had H instead of 'H' and it wasn't working.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
1.066406