Skip to content

Disabling Union Room check when entering Pokémon Centers

Deokishisu edited this page Jul 28, 2024 · 12 revisions

Every time the player enters a Pokémon Center, the game checks for players that are currently in the Union Room. If it finds someone, the Pokémon Center nurse informs the player about them.

However, this has the side effect of pausing the game mid-transition to do this. If one wants to keep this functionality only when the Wireless Adapter is connected, they can remove this hitch in the vast majority of situations by checking if the Wireless Adapter is present first and only checking the Union Room if it is. Otherwise, they could just omit the function call that checks the Union Room entirely to completely disable it. Multiple methods to accomplish this will be presented here.

Method 1: Check the Union Room only when the Wireless Adapter is connected

Go to data/scripts/cable_club.inc and add this to it:

CableClub_OnResume:
+       specialvar VAR_0x8001, IsWirelessAdapterConnected
+       goto_if_eq VAR_0x8001, FALSE, CableClub_OnResume_DisableUnionRoomNurseText
	special InitUnionRoom
	end
+
+CableClub_OnResume_DisableUnionRoomNurseText:
+       setflag FLAG_NURSE_UNION_ROOM_REMINDER
+       end

That's it. You're done.

This first checks if the Wireless Adapter is connected. If not, it jumps to a new script that sets a flag preventing the nurse from mentioning Union Room players and ends. This new script is needed to stop the nurse from attempting to load a player name from an uninitialized Union Room, which will crash the game. If it is connected, only then is the Union Room checked.

This removes the hitch while warping into the Pokémon Center when the Wireless Adapter is not connected, which will fix this for almost all players. Presumably, a player with the Wireless Adapter connected will want Wireless Adapter-related functionality, and this preserves that for that minority of players.

Method 2: Check the Union Room only when the Wireless Adapter is connected AND move the check to the Nurse

This is essentially a more elegant Method 1, but has more involved changes. With this method, the check is hidden in the nurse's healing field effect animation which is right before it is actually needed. This way, there is no lag when entering the Pokémon Center with or without the Wireless Adapter connected. It also moves all the Wireless Adapter-related checks for the Pokémon Center out of scripts and into C to increase the speed at which it runs and reduce any lag. The nurse's check is also only run once per ON_MAP_RESUME to mimic the original check and prevent the check from happening again if the player heals more than once and still only runs when the Wireless Adapter is actually connected. There is still a small hitch that occurs, but it is negligible because it is hidden in the nurse's animation for putting Poké Balls on the healing machine.

As this is a little more work than method one, I will provide a commit from which the required changes can be copied. This CrystalDust commit shows what needs to be done to accomplish this. Completely ignore the changes that happen in the data/maps folder of that commit, as they are CrystalDust-specific and unnecessary.

For a potential alternate implementation, if you don't want to create a new flag (FLAG_SYS_ON_RESUME), you can change it to a temp flag in the nurse's script and maintain a MAP_SCRIPT_ON_RESUME in every Pokémon Center that clears that temp flag. This maintains the original functionality and doesn't use a new flag at the cost of still needing a MAP_SCRIPT_ON_RESUME in every Pokemon Center.

Method 3: Completely omit this check and remove the related scripts from the Pokémon Center nurse

First, go to data/scripts/cable_club.inc and comment out the following line:

CableClub_OnResume:
-	special InitUnionRoom
+	@special InitUnionRoom
	end

After that, go to data/scripts/pkmn_center_nurse.inc and change the following two scripts:

EventScript_PkmnCenterNurse_HealPkmn::
	incrementgamestat GAME_STAT_USED_POKECENTER
	call_if_eq VAR_0x8004, 0, EventScript_PkmnCenterNurse_IllTakeYourPkmn
	call_if_eq VAR_0x8004, 1, EventScript_PkmnCenterNurse_IllTakeYourPkmn2
	waitmessage
	call EventScript_PkmnCenterNurse_TakeAndHealPkmn
	goto_if_unset FLAG_POKERUS_EXPLAINED, EventScript_PkmnCenterNurse_CheckPokerus
-   goto EventScript_PkmnCenterNurse_CheckTrainerHillAndUnionRoom
+   goto EventScript_PkmnCenterNurse_ReturnPkmn
	end
EventScript_PkmnCenterNurse_CheckPokerus::
	specialvar VAR_RESULT, IsPokerusInParty
	goto_if_eq VAR_RESULT, TRUE, EventScript_PkmnCenterNurse_ExplainPokerus
-	goto_if_eq VAR_RESULT, FALSE, EventScript_PkmnCenterNurse_CheckTrainerHillAndUnionRoom
+	goto_if_eq VAR_RESULT, FALSE, EventScript_PkmnCenterNurse_ReturnPkmn
	end

In the latter's case, since we know in this instance that the VAR_RESULT can only hold a value of TRUE or FALSE, we can alternatively do:

EventScript_PkmnCenterNurse_CheckPokerus::
	specialvar VAR_RESULT, IsPokerusInParty
	goto_if_eq VAR_RESULT, TRUE, EventScript_PkmnCenterNurse_ExplainPokerus
-	goto_if_eq VAR_RESULT, FALSE, EventScript_PkmnCenterNurse_CheckTrainerHillAndUnionRoom
+	goto EventScript_PkmnCenterNurse_ReturnPkmn
	end

Naturally, the end is not required in this instance either, since you know that you'll end up jumping to one out of two scripts no matter what, but it's still good practice to include it.

And that's it!

Clone this wiki locally