Event Editor Lua Conditions

Post new mods and scenarios here.

Moderator: MOD_Command

Post Reply
Rory Noonan
Posts: 2418
Joined: Thu Dec 18, 2014 1:53 am
Location: Brooklyn, NY

Event Editor Lua Conditions

Post by Rory Noonan »

I tried adding a condition to an event so that it would only fire after 2 units had been destroyed. The set-up was as follows:

Event 1
Trigger: Scen start +1s
Action (Lua Script): Counter=0

Event 2
Trigger: Side A Aircraft Lost
Action (Lua Script): Counter=Counter + 1

Event 3
Trigger: Side A Aircraft Lost
Condition (Lua Script): Counter == 2
Action (Special Message): It worked.

When I ran this and killed off one of the aircraft on Side A the game crashed. Pretty sure this is my fault, not a bug. I saw that Event 2 was triggered but not Event 3; I am not sure if I'm using the condition field properly.

I ran the Lua commands one by one through the script console and everything seemed to work fine; Counter == 2 returned 'No' when it was 0 and 1, and 'Yes' when it was 2. No crashes.

I think I need to alter the Lua command for the condition but I'm not sure what to do. Can anyone point me in the right direction with this?
Image
Yokes
Posts: 298
Joined: Tue Mar 13, 2007 9:27 pm

RE: Event Editor Lua Conditions

Post by Yokes »

I didn't know you could use "conditions" like that. Is that new?

Could you just create a fake side and give it a point for each aircraft destroyed? Then you can use a "side points equals" trigger.

Yokes
Rory Noonan
Posts: 2418
Joined: Thu Dec 18, 2014 1:53 am
Location: Brooklyn, NY

RE: Event Editor Lua Conditions

Post by Rory Noonan »

ORIGINAL: Yokes

I didn't know you could use "conditions" like that. Is that new?

Could you just create a fake side and give it a point for each aircraft destroyed? Then you can use a "side points equals" trigger.

Yokes
Yep, it came in 1.10 (tm.asp?m=4011908&mpage=1&key= --took me about 20 minutes to find that, and I missed this feature on release too)

As for using a dummy side with points, that will work, thanks for the suggestion.

I was hoping to use this function to branch out into more complex conditions though.

A similar problem was reported here:
tm.asp?m=4028171&mpage=1&key=&#4028171

As I said earlier, I'm sure this is me not doing it properly rather than a problem with the program. Has anyone had success using this feature?
Image
Post Reply

Return to “Mods and Scenarios”