SharkTooth Posted June 28, 2016 Posted June 28, 2016 Hey guys, so I'm having an issue with creating overworld legendary encounters in Black 2. I've been able to create both the NPC itself and the general battling script, which runs as intended, however the Pokemon NPC continues to reappear after I exit or enter the map even if I have captured it. This is the template script code I'm using which was provided in the tutorial I followed plus a few changes of my own. 10 00 93 01 // StoreFlag 3A0 Is the pokemon captured? 08 00 00 00 // Condition 0 Flag not set, spawn not disabled. 11 00 01 00 // Equal? If_False (flag not set, disable not true) skip 1F 00 FF 04 00 00 00 6C 00 [00 00] //remove NPC 2E 00 -- LockAll A6 00 47 05 -- PlaySound Clink 74 00 -- FacePlayer AB 00 [7D 02] 00 00 cry [dex] 03 00 0A 00 wait a fraction 74 01 [7D 02] [41 00] 01 00 StartWildBattle [dex=0x027D] @ [level 0x41], parameters=0x0001 ---Battle Ends, script continues--- 77 01 10 80 Check if KO'd 09 00 10 80 08 00 01 00 11 00 01 00 1F 00 FF 14 00 00 00 Incapacitation Logic 23 00 A0 03 Set disablespawn flag 23 00 94 01 Set encountered at least once flag 6C 00 [00 00] Remove NPC [id] 75 01 EndWildBattle 1E 00 02 00 00 00 76 01 EndWildBattle1 78 01 10 80 19 00 10 80 00 00 Check if captured 1F 00 01 06 00 00 00 1E 00 0A 00 00 00 23 00 93 01 Set captured flag, goto end 1E 00 30 00 00 00 19 00 10 80 01 00 Check if player was defeated? 1F 00 01 13 00 00 00 19 00 10 80 02 00 Check if defeated 1F 00 01 06 00 00 00 Goto #defeated 1E 00 10 00 00 00 Goto end 00 00 00 00 00 00 Padding cause Im stupid (defeated tag) 00 00 00 00 1E 00 00 00 00 00 Goto end 30 00 2F 00 02 00 00 00 end Any help is really appreciated.
Kaphotics Posted June 28, 2016 Posted June 28, 2016 Did you edit the overworld file so that the NPC has the same spawn flag the as the one you're setting to hide the trainer?
SharkTooth Posted June 28, 2016 Author Posted June 28, 2016 Yep, the NPC disappears like its supposed to when defeated, captured etc however it doesn't stay that way when I reenter the map --edit-- Actually are you referring to the ID or something else?
Kaphotics Posted June 28, 2016 Posted June 28, 2016 Yep, the NPC disappears like its supposed to when defeated, captured etc however it doesn't stay that way when I reenter the map--edit-- Actually are you referring to the ID or something else? I'm referring to the overworld file that defines the NPC's map coordinates and sprite. There's a spawn flag which determines if the game spawns it or not (depending on if the specific flag is set or not).
SharkTooth Posted June 28, 2016 Author Posted June 28, 2016 I'm referring to the overworld file that defines the NPC's map coordinates and sprite. There's a spawn flag which determines if the game spawns it or not (depending on if the specific flag is set or not). Ah ok, I found what you were referring to. No I didn't set it. Which Hex value should this be set to? The 'captured flag' or the 'disablespawn flag' if I want the NPC to stop appearing after being captured but NOT after being defeated?
Kaphotics Posted June 28, 2016 Posted June 28, 2016 disablespawn (aka defeated); the 'captured' flag is used for respawn logic (normally when defeating the elite four; if flag is not set then the defeated flag is cleared)
SharkTooth Posted June 28, 2016 Author Posted June 28, 2016 Thanks a bunch! Was worried that I would need to do something super hacky to get it to work. Does that mean that the captured flag is useless in this context?
Kaphotics Posted June 28, 2016 Posted June 28, 2016 Thanks a bunch! Was worried that I would need to do something super hacky to get it to work. Does that mean that the captured flag is useless in this context? Unless you're using that flag in later logic, yes, it is useless.
SharkTooth Posted June 28, 2016 Author Posted June 28, 2016 Just a quick follow up. Do all spawn flags need to be unique? I assume yes, if so is there a list of free flags to use?
Kaphotics Posted June 28, 2016 Posted June 28, 2016 Just a quick follow up. Do all spawn flags need to be unique? I assume yes, if so is there a list of free flags to use? https://projectpokemon.org/forums/showthread.php?24589-B2W2-General-ROM-Info&p=161428&viewfull=1#post161428
SharkTooth Posted June 28, 2016 Author Posted June 28, 2016 Right so I was able to set it up so that it remains despawned. However my intended effect to have the pokemon RESPAWN (i.e the flag isnt set) if not captured is still failing? It looks like the game treats 'killed' and 'captured' as the same defeated logic even though I'm checking the captured logic and clearing the flag? At this point I'm totally lost This is my attempt at trying to make it respawn, now it always respawns as if its always being captured. EDIT I did it! Wasn't using the logic properly. Moved the disable spawn into the captured part and its all good now! My code for future reference. Ignore the 'padding', it was so that i didn't have to fiddle with the jumps and if statements 2E 00 -- LockAll A6 00 47 05 -- PlaySound Clink 74 00 -- FacePlayer AB 00 [7D 02] 00 00 cry dex 03 00 0A 00 wait a fraction 74 01 [7D 02] [41 00] 01 00 StartWildBattle dex=0x027D @ level 0x41, parameters=0x0001 ---Battle Ends, script continues--- 77 01 10 80 Check if KO'd 09 00 10 80 08 00 01 00 11 00 01 00 1F 00 FF 14 00 00 00 Incapacitation Logic 00 00 00 00 pdding 00 00 00 00 Padding 6C 00 [00 00] Remove NPC [id] 75 01 EndWildBattle 1E 00 02 00 00 00 76 01 EndWildBattle1 78 01 10 80 19 00 10 80 00 00 Check if captured 1F 00 01 06 00 00 00 1E 00 0A 00 00 00 23 00 [F5 01] set disablespawn flag (NPCE FLAG) 1E 00 30 00 00 00 goto end 19 00 10 80 01 00 Check if player was defeated? 1F 00 01 13 00 00 00 19 00 10 80 02 00 Check if defeated 1F 00 01 06 00 00 00 Goto #defeated 1E 00 10 00 00 00 Goto end 00 00 00 00 00 00 Padding cause Im stupid (defeated tag) 00 00 00 00 1E 00 00 00 00 00 Goto end 30 00 2F 00 02 00 00 00 end
SharkTooth Posted June 30, 2016 Author Posted June 30, 2016 Argh another issue! Created this script from scratch and I'm almost certain that its 100% correct but it seems to only run the first player movement (line 4) then 'unlocks' and ends. Can anyone tell me what I've done wrong? 2E 00 LockAll A6 00 47 05 Playsound Clink 30 00 wait a bit 4F 02 FF 00 Move Player [69 00] [b7 02] [01 00] [0C 00] to XYZ for proper positioning at speed 12 00 00 Facing Up 65 00 Wait for movement to finish 003C 0004 [1E 00] [09 00] 00 00 0000 Message, [text line id], [NPC ID], top, simple border 3200 Wait 3E00 Close message 7400 face player 30 00 wait a bit 64 00 [09 00] 08 00 00 00 Read the movement script 8 bytes down [NPC ID] 65 00 Wait for movement to finish 1E 00 08 00 00 00 Jump 8 bytes past the movement calls --Movement-- 4B 00 01 00 Exclaim FE 00 00 00 End Movement instructions 003C 0004 [1F 00] [09 00] 00 00 0000 Message, [text line id], [NPC ID], top, simple border 3200 Wait for button press 3E00 Close message 64 00 [09 00] 08 00 00 00 Read the movement script 8 bytes down [NPC ID] 65 00 Wait for movement to finish 1E 00 20 00 00 00 Jump 32 bytes past the movement calls --Movement-- 9F 00 01 00 Question 0E 00 01 00 Walk Left 1 0D 00 02 00 Walk Down 2 0F 00 02 00 Walk Right 2 0C 00 02 00 Walk Up 2 0E 00 01 00 Walk Left 1 01 00 00 00 Face Down FE 00 00 00 End Movement instructions 003C 0004 [20 00] [09 00] 00 00 0000 Message, [text line id], [NPC ID], top, simple border 3200 Wait for button press 3E00 Close message 64 00 [09 00] 08 00 00 00 Read the movement script 8 bytes down [NPC ID] 65 00 Wait for movement to finish 1E 00 08 00 00 00 Jump 8 bytes past the movement calls --Movement-- A1 00 01 00 "..." FE 00 00 00 End Movement instructions 003C 0004 [21 00] [09 00] 00 00 0000 Message, [text line id], [NPC ID], top, simple border 3200 Wait for button press 3E00 Close message 64 00 [09 00] 08 00 00 00 Read the movement script 8 bytes down [NPC ID] 65 00 Wait for movement to finish 1E 00 0C 00 00 00 Jump 12 bytes past the movement calls --Movement-- 0F 00 01 00 Walk Right 1 0D 00 01 00 Walk Down 1 FE 00 00 00 End Movement instructions 003C 0004 [22 00] [09 00] 00 00 0000 Message, [text line id], [NPC ID], top, simple border 3200 Wait for button press 3E00 Close Message 64 00 [09 00] 08 00 00 00 Read the movement script 8 bytes down [NPC ID] 65 00 Wait for movement to finish 1E 00 08 00 00 00 Jump 8 bytes past the movement calls --Movement-- 0F 00 03 00 Walk Right 3 FE 00 00 00 End Movement instructions 64 00 FF 00 08 00 00 00 Read the movement script 8 bytes down (Player) 65 00 Wait for movement to finish 1E 00 08 00 00 00 Jump 8 bytes past the movement calls --Movement-- 03 00 00 00 Face Right FE 00 00 00 End Movement instructions 003C 0004 [23 00] [09 00] 00 00 0000 Message, [text line id], [NPC ID], top, simple border 3200 Wait for button press 3E00 Close Message 4F 02 [09 00] Move NPC [71 00] [AC 02] [01 00] [0C 00] to XYZ at speed 12 03 00 Facing Right 65 00 Wait for movement to finish 6C 00 09 00 Remove NPC 23 00 [1C 04] set disablespawn flag (NPC FLAG) 30 00 2F 00 02 00 00 00 end
SharkTooth Posted June 30, 2016 Author Posted June 30, 2016 Yep its official, I'm stupid. I'm calling the message lines backwards 0032 -> 3200
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now