Why Trigger Once don't work as expected in this event?

From the Asset Store
Change the size and position of everything without calculating anything!
  • Why Trigger Once don't work as expected in this event?

  • "Trigger once while true

    Turn an ordinary event (which is tested every tick) in to a trigger. For example, if an event plays a sound when lives equals 0, normally this event runs every tick. This plays about 60 sounds a second and would sound pretty bad. Adding Trigger once while true after the other conditions makes the event run just once when it first becomes true. This makes the previous example only play a sound once the first time your lives reaches 0. It must be the last condition in an event."

    construct.net/en/make-games/manuals/construct-3/system-reference/system-conditions

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If you test it, you will see that Trigger Once condition is ignored. The text "on" should be displayed only once.

  • Its because you do not have a condition for the trigger once..

    Trigger once works if the condition is true.

    Like this:

    If var = 1 it will trigger only once while it is = 1 instead of trigger it every tick...

  • No. The issue is pressent when you put the action Go to Layout. For some reason it seems that this action is causing Trigger Once to not work.

  • I see.. is this text on Layout 1?

  • Tried it here.. If you have different event sheet for each layout, you have to include the event sheet of the first layout to the second one.

    Otherwise it can not reach the Text object.

  • In the first example I only have 1 Layout, the Layout 1.

    In this new example I have two Layouts, booth are linked to the same eventsheet1.

    The effect is the same, Trigger Once condition is ignored.

    Perhaps there is some kind of conflict between the Layout call and the Trigger Once condition.

    I wonder if it can be consider as a bug.

  • You have a condition setting the text to "" on Every tick... remove it.

  • I put Set text to "" on purpose. If you think about it, with that line, the text displayed should remain blank. Instead, the Layout name is displayed on each tick, as if Trigger Once did not exist.

    I'll put another example, to see if you understand better the fact that TriggerOnce is not working.

    In this case Variable2 should only increment when you press 1 or 2 with the keyboard. However the variable keeps incrementing, completely ignoring the TriggerOnce condition.

  • "trigger once" will reset on a layout change. This is expected.

  • oh.. Now I understood.. i´ve been testing because I thought that the problem was the second action not being triggered.. but is not.. the problem is that is triggering more than once. Sorry about that.

  • "trigger once" will reset on a layout change. This is expected.

    Thats a good explanation. It may not deserve to be treated as a mistake. Don't worry Klabundee, that was'n simple to explain.

  • You can have a trigger in another event that activates the group that you have that in. Just make the group inactive at startup and activate it when you want to use it. And add in the triggered once event to deactivate the group at the end. Might work

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)