"Move player" not working

Stuck at a level? Need help with R'n'D or anything R'n'D related? Post here!

Moderators: Flumminator, Zomis

Post Reply
Tomi
Posts: 339
Joined: Wed Aug 03, 2005 3:37 pm
Location: Slovakia

"Move player" not working

Post by Tomi »

I have a CE that does this:
- can move down
- when touching normal wall (at any side)
--- move player down

In an area like this:
SCSS (C=CE, S=sand, W=wall, -=empty)
S-WS (I'm too lazy to use levelsketch)
S-WS
S-WS
SSSS

However, the player doesn't move at all. (This was tested in 3.2.3 and 3.2.4-1.)

Some more weird facts:
- When using "exit player" instead of "move player", it works.
- When using "CE delay 1 second" instead of "touching normal wall", it works.
- When using both "CE delay 1 second" and "touching normal wall", it doesn't work (same as if only "touching" was there)

Is this a bug, or am I doing something wrong?
(Example level here: http://www.zomis.net/rnd/download.php?id=675 )
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Post by Holger »

> Is this a bug, or am I doing something wrong?

Definitely a bug -- weird! (Just reproduced this buggy behaviour.)
Tomi
Posts: 339
Joined: Wed Aug 03, 2005 3:37 pm
Location: Slovakia

Post by Tomi »

[obsolete info]Is it possible to somehow workaround it, or I'll have to wait for the next version? (I see that at the moment you probably don't know much about how the bug works, so post something when you'll know more.)[/obsolete info] The action is (almost...) crucial for a wraparound technique I'm making.

[EDIT] - I did some debugging:
- CE_TOUCHING_X has trigger_player=CH_PLAYER_ANY (which is 1+2+4+8 = 15)
- in CheckElementChangeExt, actual_trigger_player is set to EL_PLAYER_1+log_2(trigger_player), and as log_2(15) is 3.9 (rounded down to 3), it gets set to EL_PLAYER_4
- so the change action actually works, but doesn't move all players (as it should), but only player 4
Probable fix:
- actual_trigger_player should get set to some value that isn't EL_PLAYER_*, in that case ExecuteCustomElementAction sets trigger_player_bits to PLAYER_BITS_ANY.
- All actions that use trigger_player_bits, including "set shield" and "set keys", are affected, but actions that use action_arg_player_bits (like "exit player"), are not.
- "CE delay" event works because it explicitly sets actual_trigger_player to EL_PLAYER_1. This is also a bug, because then it only works for player 1, and not for all players.
- I don't know why it doesn't work when both 'CE delay' and 'touching' events are turned on.
Zomis
Posts: 1502
Joined: Mon Jun 21, 2004 1:27 pm
Location: Sweden
Contact:

Post by Zomis »

Nice debugging, Tomi!
I guess this debugging helps Holger a lot to fix it.
Tomi wrote:- I don't know why it doesn't work when both 'CE delay' and 'touching' events are turned on.
Only a guess: "CE Delay" is done before "touching" <end of guess>
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Post by Holger »

Thanks for the debugging work -- so far (after some quick debugging yesterday) I only found out that CE_TOUCHING_X only affects player 4 when it should affect all players (just as you described). I did not know the exact reason until now, but thanks to your debugging it's a bit more clear now what happens!

I'll try to fix this very soon!
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Post by Holger »

This bug is fixed now (by storing the full player bitmask now).

Tomi, thanks again for the extensive debugging work! :-)

> - "CE delay" event works because it explicitly sets actual_trigger_player to
> EL_PLAYER_1. This is also a bug, because then it only works for player 1,
> and not for all players.

This is not a bug -- the part of the code that I assume that you mean does not explicitly set the actual_trigger_player to EL_PLAYER_1 to trigger an action for player 1, but it completely resets all trigger action fields. However, as there is no such element as "EL_PLAYER_NONE", it has to use "EL_PLAYER_1" here.

The bug that caused only the first player to move also in this case (CE delay) is the same as above (that causes only player 1 to move when touching an element).

The fix will be available in the next pre-release (if any before 3.2.4).
Post Reply