IF Else with Wait action not triggering

Just started using Construct 2? Post your questions here

Post » Sat Mar 01, 2014 9:03 pm

In the event below I'm finding that the Wait time is not being triggered based on instance variable. If I remove the Else conditions then it works fine. What's the correct way to use Wait with an If-Else block?

On Key R pressed:
Player - Weapon = "gun"
> set Reload gun animation
> wait 2 seconds
> set ammo to 5
> set Idle animation

Player - Weapon = "uzi"
> set Reload uzi animation
> wait 3 seconds
> set ammo to 10
> set Idle animation

Player - Weapon = "AK47"
> set Reload AK47 animation
> wait 4 seconds
> set ammo to 15
> set Idle animation
Posts: 44
Reputation: 690

Post » Sat Mar 01, 2014 10:15 pm

You don't need the "Else" as the "Player-Weapon==" condition determines which sub event of the condition "On key R pressed" will run. Effectively you are trying to use an Else as an Else/If which isn't quite the same thing but tends to work in C2 as each condition is effectively an "If" condition with a redundant If statement. ie you are saying IF key R is pressed and IF player weapon = Else IF Player weapon = Else IF player weapon =.

It's much better practice to write it:

{If} key R is pressed - condition

{If} weapon = 1=> do something - subevent1
{if} weapon = 2 => do something else - subevent2
ELSE do whatever it is you want to do if weapon doesn't equal either 1 or 2. - subevent3
There are 10 types of people in the World, those that understand binary and those who don't.
Posts: 93
Reputation: 797

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 5 guests