Jump to content

Black 2 Overworld Pokemon Scripting Help


Recommended Posts

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.

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 :P

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

Link to comment
Share on other sites

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

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...