Jump to content

[SOLVED] Pokémon Black & White - Event (script) that occurs on a certain day


Recommended Posts

Hi everyone,

While rounding up my rom hack, I am trying to implement some new events / wild Pokémon that are battleable on a current day (or time). Of course, this is already in the game (think of Musharna, which is only battleable in Dreamyard on Fridays).

Now, I have found two important parts in the script for Dreamyard's Musharna:

  • The first part contains the usual script handler for Musharna, with the battle handler, which also sets flags after the battle
  • The second part, which is a totally different script, first of all sets the flag of Musharna (by setting the flag, Musharna will NOT appear) and thereafter, checks if the conditions are true (i.e., if it is indeed Friday). If the condition is true, the flag of Musharna is cleared, such that it will appear:

28 00 20 80 00 00			Create internal variable 20 80 and set value to 00 00
CF 00 20 80				Store current day in variable 20 80
09 00 20 80				Take variable 20 80
08 00 05 00				If equal to 5 (5 = Friday)
11 00 01 00				Condition equal
10 00 60 09				Check flag 60 09
08 00 01 00				If equal to 1
11 00 01 00				Condition equal
10 00 BC 0A				Check flag BC 0A
08 00 00 00				If equal to 0 (unset)
11 00 01 00				Condition equal
11 00 07 00				?
11 00 07 00				?
1F 00 FF 0A 00 00 00			Jump A steps to (*)
24 00 EC 02				Clear flag EC 02 (makes Musharna appear)
1E 00 04 00 00 00			Jump 4 steps to (&)
23 00 EC 02				(*) Set flag EC 02 (makes Musharna disappear)
28 00 20 80 00 00			(&) Set internal variable 20 80 to value 00 00
02 00					End script

This part (as showed in the code above) is very interesting and it appears in the Dreamyard's map_event_data file as the first script. It also lacks "2E 00 Start script" and "02 00 End script", so it rather seems to be a global check. There is one main problem: I do not know how this script is called. My idea is that it somehow is set as a global script that is ran whenever the player enters the Dreamyard basement - but I'm not sure!

The script is quite straightforward, but for this to work on other maps, I need to know how it is activated.

Any help is appreciated, thanks a lot!

NB: Also, the flag BC 0A that is checked for during the script is set after Musharna has been defeated, such that Musharna is not reappearing on Fridays if it has already been battled. I also do not know when and how this flag BC 0A is unset. If anyone knows more about this part specifically, please let me know! As a workaround, for new events I'm thinking about creating a custom flag that is unset everytime the Champion is beaten.

Edited by Oxnite
Link to comment
Share on other sites

OK, so after a lot of investigation, I found out how to handle this!

This post shows a breakdown of the map_overworlds narc a/1/2/5. We see that map_overworlds consists of a header, furniture, NPCs, warp and trigger. Additionally, Kaphotics justly notes that there is more to it:

  Extra Stuff (Trigger Related?)
 0x06 long
 0x00-0x01 - Selects One of something
 0x02-0x05 - Does something to it

I have found out that this part in fact refers to a global script, which is loaded whenever the map is entered, and should be interpreted as follows:

  Global Script Trigger
 0x06 long
 0x00-0x01 - 02 00
 0x02-0x03 - Script number that should be activated globally
 0x04-0x05 - 00 00

NOTE: The 0x04-0x05 - 00 00 part is usually left out.

Thus, the global script trigger always starts with 02 00, followed by the script number that should be activated when entering the specific map, followed by 00 00. Maps without global scripts therefore also lack this part of the map_overworlds data.

With this known, I can finally add Pokémon and events that only occur on a certain day or time!

Edited by Oxnite
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...