Page 1 of 1

[FIXED v1.10] Unit Enters Area trigger

Posted: Thu Jan 07, 2016 9:53 pm
by Gunner98
Not sure if this is Working as designed or if something is amiss.

In the Clip you can see the event in question and the triggers. The game file is still being tested and is here: tm.asp?m=3997036

AndrewJ reported that units entering the trigger zone were constantly triggering the event. What I was hoping for was when a unit first entered the trigger zone it would trigger the event, then when the next unit entered it would trigger again and so on.

My deduction is that the game checks often (every second apparently) and if the trigger is satisfied, the event fires.

If this is not WAD, it might be an issue.

If this is WAD, would it be better to use a 'Unit remains in area' trigger? If this is the case and it was set for 1hr, would it fire every hour that the unit is in the area? (better but not desired)

Is there a way to set up Lua to delete each unit as it first triggers the event? There are about 120 AC which could meet the conditions.

Please advise.

B

Image

RE: Unit Enters Area trigger

Posted: Fri Jan 08, 2016 12:35 pm
by Yokes
Gunner,

I've run into this before, and I think the trigger doesn't consider if it has already fired or not.

There is a way to fix it, but it involves a lot of coding. You need to initialize a variable for each unit that could trigger it at startup. Then you have to have an event that uses the "UnitX" command to get the GUID of the unit that set off the trigger, and check if the variable has already been fired for this unit. If not, do whatever you want it to do (add points, it looks like) and set the variable to true (or whatever will fail the "if" logic).

This works, but it is a lot of coding.

Yokes

RE: Unit Enters Area trigger

Posted: Fri Jan 08, 2016 3:59 pm
by mx1
Regarding 'the unit stays in area' this is the only way of having Lua script being run every X minutes. If this behavior changes to 'fire once' then there is a need for additional trigger being introduced to CMANO called 'trigger every time interval'.

RE: Unit Enters Area trigger

Posted: Sat Jan 09, 2016 2:13 pm
by DeSade
ORIGINAL: Gunner98

Is there a way to set up Lua to delete each unit as it first triggers the event? There are about 120 AC which could meet the conditions.


If you want to keep units, solution given by Yokes is the one to go, its not so much coding if you could name them in some consistent way, like "27 TFW #1", "27 TFW #2" etc. It has however some bad side-effects regarding performance.

But if those aircrafts are disposable after triggering event (like they already finished mission and you grant VP for each survivor), than best way is indeed to remove them via Lua, by adding second action after +1 score with lua code like:

ScenEdit_DeleteUnit({guid=ScenEdit_UnitX().guid})

BTW, i setup small test scenario and trigger "Unit enters area" was fired only once per each unit crossing into area - I'm not sure why in your scenario its not working that way...

RE: Unit Enters Area trigger

Posted: Mon Jan 11, 2016 5:43 pm
by ComDev
Thanks, have added this to our to-do list [8D]

RE: Unit Enters Area trigger

Posted: Tue Jan 12, 2016 6:12 am
by Dimitris
Loaded the scenario but I cannot see the reference points "27 TFW Aircraft Arrival" anywhere on the map. Any chance you have accidentally removed them?

RE: Unit Enters Area trigger

Posted: Tue Jan 12, 2016 7:51 am
by Gunner98
The reference points are on Side 'Marker'

Tx

B

RE: Unit Enters Area trigger

Posted: Sun Jan 17, 2016 9:12 am
by Dimitris
OK, thanks.

Tested this again in Build 775.8 (v1.10 private beta) and it seems to work as desired. I used a single EF-111 as a test subject and entered the "27 TFW Aircraft Arrival" zone, and the trigger fired only once. It may have been fixed by one of the zone-related fixes that we have applied during v1.10 development.

Once v1.10 RC is made available (pretty soon) can you please re-check this to confirm?

Thanks.

RE: Unit Enters Area trigger

Posted: Sun Jan 17, 2016 9:36 am
by Gunner98
Will do. Thank you very much.

RE: Unit Enters Area trigger

Posted: Sun Jan 24, 2016 3:41 pm
by Dimitris
bump

RE: Unit Enters Area trigger

Posted: Sun Jan 24, 2016 4:15 pm
by Gunner98
Works like a charm now that I have the update installed properly. Thanks for the fix.

RE: Unit Enters Area trigger

Posted: Sun Jan 24, 2016 5:59 pm
by Dimitris
Thanks for the update! Relieved that we fixed it.