Terminating Events early

Ok, I’m not sure this is possible, but is there a way to make an event in progress terminate early? The reason I ask is because I have an event that lasts 5 seconds that acts as a check (We’ll call it the “Check” event), if it doesn’t detect anything before the event ends, nothing happens. But if it does detect something, another event triggers as a consequence (We’ll call this the “Trigger” event). But the issue is that the Trigger event doesn’t work properly due to the Check event’s actions still happening and causing bugs. I would like to make it to where the Check event terminates when the Trigger event is playing so this bug doesn’t happen. Any way to do this?

Can you provide a screen shot of your events? We may be able to suggest changes to get it working how you want it.

That might not be feasible due to the amount I would have to redact for security and personal reasons. but long story short, the issue is that both the “Check” and “Trigger” events has some sprite animation logic in it, and the bug I’m running into is that the animation logic from the “Check” event is interfering with the animation logic from the “Trigger” event. Causing the sprite to exhibit incorrect behavior.

Ok, then it’s extremely difficult for us to help. Your interpretation of what the events should do will not be an accurate reflection of what they are doing.

And I don’t understand the security or personal reasons. The only reason I can come up with are your real name and/or a folder structure. And those can be blurred or blanked out in a screen shot.

Problem is the names of the variables I’m using. However this is irrelevant as I am simply asking the question of “Is there a way to terminate an event mid-execution”. I’ve already triple checked to make sure I haven’t made any errors and I know the root cause of the issue, which I can only fix if I can figure out how to terminate an event. Not trying to be difficult, just how my situation is

Update, found a workaround after doing the equivalent of the “throwing everything at the wall and hope it sticks” method. That being said, there should be a feature that allows us to cancel event execution, would make the engine more flexible.

It doesn’t sound like you need to terminate events, only to have proper conditions for when they should execute. If you just need to switch between these two states then you could have a variable called “checking”. Include a condition “checking = 1” (or boolean true) for the checking event. When detection is positive, change checking to 0 or false. Then do the opposite for the trigger event… condition checking = 0, and at the end change checking back to 1/True.

Keep in mind, this by itself won’t prevent the events from firing repeatedly when the conditions are met. You would still need a trigger once or some action that breaks the condition to make sure the events fire “discretely” if that makes sense

This only works if you don’t have animations changes in the events. The issue is that in the “Check” event, an animation plays for about 5 seconds, and if the trigger isn’t detected, it switches back to the stand by animation. But if it does detect the trigger, then the “Trigger” event will happen and change the animation to the trigger animation, which has a 2.5 second duration. The core of the issue is that the “Check” event is still playing despite there being a hard “If animation is trigger animation, do not play event” in the condition for the “Check” event, which causes the “Trigger” event animation to not display correctly. And a trigger once condition does nothing to solve this.

That does sound like the core of the issue… the purpose of my example is to prevent exactly this. Do you happen to have Waits happening during the Check or something? If so then you would need the conditions again after every wait.

Yes, and the waits total 5 seconds, divided up into 2 waits, 1 with a .3 second delay for animation purposes, and the other 4.7 second delay for the bulk of the detection time. After that, assuming the Trigger event didn’t go off during the detection time, it resets the animation of the object. But due to events not terminating like it was suppose to, the Trigger event glitches out due to the command of the Check event still happening. Not sure that helps but that’s part of what is going on in the logic of the “check” event

Ah, then you will need to copy the conditions after every Wait action. Event conditions are only evaluated once.

Been thinking about my situation with the wait timer command. And I think I have a simple solution to it. How easy would it be to add a condition to the Wait timer command where if a condition is met, it cancels the wait timer, effectively cancelling the execution of rest of the code that would normally play after the timer has elapsed. Furthermore, you could also add a new command that cancels all active wait timer commands if you need to brute force the issue. This should resolve all future issues similar to what I’m dealing with

You can already restart and/or pause the timer. Isn’t that enough to accomplish what you want?

There is no way to cancel events - this would sort of be antithetical to the flow of events. When the conditions are met, the associated actions are executed. If you have actions that are running when they shouldn’t, then it should be possible to modify the conditions and event structure to compensate.

I was referring to the literal “Wait X Seconds” command. And no, for my particular application, it’s not possible to work around it. Had to literally program the game to hard-restart itself just so the bug wouldn’t happen (a band-aid fix at best which only works because my game is one scene). And it seems it would be too much trouble to make a suggestion on this forum. So I will not be talking about it any further. I’ll just accept that that is a hard limitation of the engine that I have to work around if I want to use it.

To be clear, “Wait” events are special asynchronous event actions. They cannot be terminated once triggered. This is (usually) true for any event, since events only fire once their conditions are true.

Generally you’re better off using timers and subevents (or separate events entirely that check a timer that was started by your prior event) if you want to have more control over the events firing based on time. You can start a timer (x) in Event A, and have Event B check for “Timer X is greater than 5 seconds” but in Event C pause the timer before 5 seconds has passed based off a condition, and Event B will never happen.