Trigger Once in a Layout When True the first time only

  • hey all,

    Trying to trigger a Once While True only the first time something happens, and then never again for that layout.

    Other than setting a flag variable is there a better way to do this?

    PlayerHealth < 10

    NoAudioIsPlaying = true

    Trigger Once While True

    ----------------PlayAudio "Blue wizard is about to die.."

    Since the NoAudioIsPlaying variable changes throughout the layout the only way I see to make this happen once is to make yet another variable "PlayOnce"

    PlayerHealth < 10

    NoAudioIsPlaying = true

    PlayOnce = 0

    Trigger Once While True

    ----------------PlayAudio "Blue wizard is about to die.."

    ----------------PlayOnce set to 1

    I only ask because I have a whole mess of these conditions (and I'd have to create a unique flag for each) that I only want to happen once in a layout.. was wondering if there was a cleaner way...

    thanks...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You don't need the "Trigger Once" in the second case. You dealt with it yourself.

  • ah right.. yes.. so I guess in the case of a true Trigger ONLY Once, you have to set it up yourself?

  • unless your only condition is Trigger Once, but then it triggers right away...without a condition

    or the only other way is that your condition can never be untrue, and then true again...

  • I had to use an external flag to do this. You could try using a global variable defaulted to 1, and set it to 0. Then have the event conditioned on if flag == 1.

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