"Trigger Once" Not Working

Get help using Construct 2

Post » Tue Feb 11, 2014 6:25 am


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?Sushin2014-02-11 06:39:05
B
10
S
3
G
3
Posts: 234
Reputation: 3,467

Post » Tue Feb 11, 2014 7:07 am

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.
B
27
S
6
G
6
Posts: 267
Reputation: 3,750

Post » Tue Feb 11, 2014 7:35 am

Thanks. That makes sense.
Unfortunately, It's still not working.
Here's how I set it up. Am I still doing something wrong here?

B
10
S
3
G
3
Posts: 234
Reputation: 3,467

Post » Tue Feb 11, 2014 7:39 am

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)roracle2014-02-11 07:40:28
B
27
S
6
G
6
Posts: 267
Reputation: 3,750

Post » Tue Feb 11, 2014 7:58 am

[QUOTE=roracle] 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)[/QUOTE]
Sent you a message
B
10
S
3
G
3
Posts: 234
Reputation: 3,467

Post » Tue Feb 11, 2014 8:26 am

No luck. Any one else have an idea?
B
10
S
3
G
3
Posts: 234
Reputation: 3,467

Post » Tue Feb 11, 2014 8:34 am

Could I see the event where you change the capturepoints.capturetimer?LittleStain2014-02-11 08:34:43
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Feb 11, 2014 9:08 am

[QUOTE=LittleStain] Could I see the event where you change the capturepoints.capturetimer?[/QUOTE]

B
10
S
3
G
3
Posts: 234
Reputation: 3,467

Post » Tue Feb 11, 2014 9:24 am

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.PixelRebirth2014-02-11 09:27:40
B
23
S
6
G
11
Posts: 1,045
Reputation: 8,061

Post » Tue Feb 11, 2014 9:26 am

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?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 44 guests