Page 1 of 1

Combining Trigger Conditions...

Posted: Mon Mar 01, 2021 10:45 am
by jkgarner
OK,

I'd like to create a single event that will check that a unit enters an area, but only check for unit entry during a certain time-frame... in other words: At some time Y in the future, the event starts checking and continues to check for the unit entering the area until either the unit enters the area, or the unit is destroyed before entering the area, or it times out after some time with the unit not entering in the area.

So far, I have managed to get the behavior that I want by setting up 2 events to accomplish this:
1 a time event that generates a recurring event at time Y, and kills itself..
2. the recurring event checks for the end time, and kills itself
the recurring event checks for the unit's entry into the area...
does something and kills itself.
the recurring event check to see if the unit has been killed. If so, it kills itself.


In looking at the help/documentation, I do not see a simpler way to do this.

I see trigger an event to fire at a time.
I see trigger an event to fire every interval.
But no way to combine them except through a lua script on the condition, but this means that the trigger fires every interval (polling) from inception until the event is removed.

Is there a way to get the behavior with a single event and or trigger and condition that minimizes the number of fires, meaning to do this where the trigger ONLY fires every interval during the desired time window?












RE: Combining Trigger Conditions...

Posted: Mon Mar 01, 2021 12:59 pm
by TitaniumTrout
Why not use the built in time selector? Then it will only fire between a certain time when that unit enters the area.

Image

RE: Combining Trigger Conditions...

Posted: Mon Mar 01, 2021 4:17 pm
by jkgarner
I need to do it through Lua.[:)]

RE: Combining Trigger Conditions...

Posted: Mon Mar 01, 2021 6:38 pm
by KnightHawk75
Is there a way to get the behavior with a single event and or trigger and condition that minimizes the number of fires, meaning to do this where the trigger ONLY fires every interval during the desired time window?

As I understand this you have what you want working, but you're asking is there a simpler way. No I don't think there is a simpler one for specifically what you want. I guess you could make it all-in-one and gate the meat of it actually doing anything using start\stop UTC timestamps every second for "simplicity", but that's ultimately more event "fires" than your current method, just for sake of removing #1, and not something I'd recommend.