Player: Regression: Random movement sometimes moves more than 1 tile

Created on 5 Dec 2020  路  4Comments  路  Source: EasyRPG/Player

Create an event with Movement Type: Random and Frequency: 3.

Run the game, sometimes the event will move more than one tile which is incorrect, they always only move 1 tile.

Thanks to Jan/Deep8 for reporting.

Move Routes Patch available Regression

All 4 comments

This bug happens even on all move frequencies except of 8 if the movement type is set to random.

The culprit is most likely in the function Game_Event::SetMaxStopCountForRandom() in the file game_event.cpp: The random function there returns a multiplier of 0 or 1 (both with 50% probability). If the multiplier is 0, then the maximum stop count is set to 0, which makes the event move another tile without waiting which is incorrect behavior if the move frequency is below 8. It looks like the multiplier is supposed to be a floating point type (most likely double). If we change the line from st *= (Rand::GetRandomNumber(0, 3) + 3) / 5; to st *= (Rand::GetRandomNumber(0, 3) + 3) / 5.0;, then one of the following multipliers are returned: 0.6, 0.8, 1 and 1.2 which makes probably more sense. But sadly I don't know if this is correct behavior. Probably @CherryDT can elaborate on the random multiplier. I recall the multiplier got mentioned in #1638.

Reported as still broken on IRC. Re-opening this issue as a reminder to check the random movement code.

For me this works fine. I just tested this again.

I would prefer when @Br4ssman opens a new issue with an explanation of the other bug. Could be an unrelated other bug in the random movement code.

Closing this one now as this was for stuff with a Random move frequency < 8.

2436 is something completely different.

Was this page helpful?
0 / 5 - 0 ratings