How do I use Trigger once correctly?

Here I make Lena run with a speed of 100 p/s—it’s programmed to run “at the beginning of the scene”, so the permanent force is applied once. This works fine.

But then I add the same permanent force to francis trigged once as soon as lena has gone past the middle of the screen.

The expected behavior is that both run at the same speed (with Francis behind Lena since she got a head start)

But what actually happens is that Francis immediately starts moving faster than Lena even though both have the same permanent force. So it seems that the “trigger once” is applied more than once.

Is this a sub-event?

AFAIK, a Trigger once event won’t be triggered again unless the event has been false and true again.

this is not a subevent…

a Trigger once event won’t be triggered again unless the event has been false and true again.

if i understand you correctly, the event refires anytime the event goes from false to true…

I don’t understand then why that would happen. Lena moves only from the left of the screen to the right. So once the condition is true, it will stay true for the duration of the scene.

That’s why it has to be a sub-event :grimacing:

Could it be the invert doing something funny? Try "X position is > " :man_shrugging:

Can you clarify what you mean? I tried this:

In the above, francisDirection controls the force. A later condition sets it to 0. But I’m having the same issue where francisDirection is always “1”. Note that I also removed the inverted condition.

I also went to the debugger—the set francisDirection=0 condition DOES fire… the other just always fires.

UPDATE: wait a minute… i think this might work… lemme triple check!!!

UPDATE: Yea this works… francis was stopping outside the screen. Can you explain how subevents work then?

Hmm, did you try removing the inverted before doing all that? I wonder if that’s what fixed it…

Sub-events inherit from their parents, so if a parent becomes false, the child becomes false. If the parent becomes true again, the Trigger once sub-event can execute again.