"Trigger Once" Not Working

0 favourites
  • 13 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • <img src="http://puu.sh/6ROQV.png" border="0" />

    This works if I take the trigger once away, but if I put it on, it works once, but only once.

    It's supposed to work for each "CapturePoints" once the timer reaches 5 or -5. There's more than one capture point that I need it to work for.

    Am I doing something wrong?

  • You should have your conditions first, then "trigger once" as a sub event, with the actions you want to run the one time. That's how I usually do it.

    You don't roll the dice and move at the same time, you have to get the condition first, then tell it what to do. The same conditions can be used for other things as well, and that can go in another subevent to the main conditions or in the main event itself.

    Example: In a platformer, You would have "user is pressing right" with three subevents: is pressing a, set speed to 500; is not pressing a, set speed to 250; run once, set char boolean moving true.

  • Thanks. That makes sense.

    Unfortunately, It's still not working.

    Here's how I set it up. Am I still doing something wrong here?

    <img src="http://puu.sh/6RRzI.png" border="0" />

  • Can I see your capx file? I see your "trigger once" has sub events. It shouldn't. I would set it up like this:

    Team = 0

    -Timer <=5

    --TriggerOnce

    -Timer >=5

    --TriggerOnce

    Team = 1

    -Timer <=5

    --TriggerOnce

    -Timer >=5

    --TriggerOnce

    (PS: I'm assuming you need both conditions for less and greater than 5)

  • Can I see your capx file? I see your "trigger once" has sub events. It shouldn't. I would set it up like this:

    Team = 0

    -Timer <=5

    --TriggerOnce

    -Timer >=5

    --TriggerOnce

    Team = 1

    -Timer <=5

    --TriggerOnce

    -Timer >=5

    --TriggerOnce

    (PS: I'm assuming you need both conditions for less and greater than 5)

    Sent you a message

  • No luck. Any one else have an idea?

  • Could I see the event where you change the capturepoints.capturetimer?

  • Could I see the event where you change the capturepoints.capturetimer?

    <img src="http://puu.sh/6RUqy.png" border="0" />

  • As long as a single member of the CapturePoints family has a CaptureTimer value of <= -5 (or >= 5) the condition holds true, therefore it's completely correct how it behaves with trigger once.

    Try setting the CapturePoints sprite inactive or resetting it after scoring, maybe using an additional value.

    Or using For Each might also do the trick.

  • So why are you using a for each here, but not at the event that is supposed to count the points?

    Actually, why don't you just add the events in the first post as subevent of this for each event?

    Also, where are you setting the capturepoints.team value?

  • As long as a single member of the CapturePoints family has a CaptureTimer value of <= -5 (or >= 5) the condition holds true, therefore it's completely correct how it behaves with trigger once.

    Try setting the CapturePoints sprite inactive or resetting it after scoring, maybe using an additional value.

    Oh. That makes sense.

    What do you mean setting it to inactive? And what exactly would I be resetting?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Basically you use a variable to define whether the CapturePoint has been scored yet and such...

    But yeah, like others also mentioned you could simply fix it by using For each.

  • Basically you use a variable to define whether the CapturePoint has been scored yet and such...

    But yeah, like others also mentioned you could simply fix it by using For each.

    Thanks for the advice. I ended up using a boolean that triggers if the base reaches 5 or -5 and resets when the capture point timer reaches 0.

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