OR block not working? (SOLVED)


I’m making a mechanic where my character can glide, but only if certain specific values are true. I do this by decreasing the fall speed, then when the glide values aren’t true, reset the fall speed to normal.

Not necessarily looking for a solution, since what I already have works right now, but I thought I should bring it up:

This is the code that deactivates the glide and reverts the fall speed to normal.
THIS works:

But THIS does not???:

I have no idea why, but the OR block isn’t working. Shouldn’t it be functionally the same as the top screenshot though?

I believe it has to do with the way Or is processed. While it will trigger the action as long as one condition is true, it still checks all of the conditions and only picks the objects for conditions that are true. So, while it triggers the action if one of the other conditions are true, if the player is falling it doesn’t pick the player so there’s not a player object to change the maximum speed.

Try adding pick all player objects as either the last condition or the first action.


Nice, using Pick All Objects works out fantastically! Thanks!

Although, for future reference, let’s say that theoretically, my game supports multiplayer. Wouldn’t Pick All Objects choose the second player as well? Is there a way to narrow this down to only the one player?

1 Like

Not to my knowledge. I’ve had to do things like this and after the pick all I’ve used another condition. It’s a bit like starting over.

Another option is to rearrange things so you can use the same pick list or by keeping the events on separate events. It might take some creativity or the use of additional variables. It’s tough to say.

Sometimes, I’ll pair or conditions with and conditions.

If one of the following is true 
----- player is falling
------text = something 

---- if all of the following 
---------key is released
----------pick all players

That way the pick all only gets triggered if the key. Is pressed.

Sometimes you can arrange things so you can revisit indentations or pick lists. Sometimes it’s best to split things into separate events. You can still use the same actions if the events set a variable instead of triggering the actions.

Set jump to false
If something set jump = true
If something else set jump = true
If jump is true the do something

Other times you might be able to put the conditions inside a for each object

1 Like