40Cakes/pokebot-gen3

safari zone rock smash walking issue

Closed this issue · 2 comments

if you are walking in the rocksmash safari zone you get stuck between routes
https://discord.com/channels/1057088810950860850/1139190426834833528/1228288850858872873
Teras mentioned to use a bike and it seems to resolve the issue , but walking the bot will stop after 4 or 5 loops at the same place each time

looking a bit more into it.. it seems to be a bug in emerald
when using rock smash and then getting a battle the global script context does not shut down completely:
image

so when the last rock the bot smashes starts a battle the global script context never shuts down completely.
instead sGlobalScriptContextStatus stays on 1 (CONTEXT_WAITING) instead of 0 (CONTEXT_SHUTDOWN)
and what the bot currently checks to see if the script context is active (self._data[1] != 0) is 1 (SCRIPT_MODE_BYTECODE) instead of 0 (SCRIPT_MODE_STOPPED)

question to solve this:
why is or get_global_script_context().is_active needed here:

case MapRSE.SAFARI_ZONE_SOUTH | MapRSE.SAFARI_ZONE_SOUTHEAST:
self._in_safari_zone = True
while (
get_player_avatar().map_group_and_number == MapRSE.SAFARI_ZONE_SOUTH
and get_player_avatar().local_coordinates in ((32, 33), (32, 34))
) or get_global_script_context().is_active:
yield
yield from wait_for_player_avatar_to_be_standing_still()

question to solve this:
why is or get_global_script_context().is_active needed here:

That code is responsible for handling the scripted scene where the player exits the entrance building, walks past the security guard and waits for the security guard to go and block the door -- since during that sequence you cannot control the player avatar, so the navigation function would fail.

It only needs to be active in the 'South' section of the Safari Zone (where the entrance building is located) but it didn't seem to be a problem to also have it run in the 'South-East' section. But that's obviously not true due to the in-game bug you've found.

Thanks for pointing it out!