• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Legendary Encounter Script help

21
Posts
4
Years
  • Age 35
  • Seen Aug 6, 2022
Hello, again. I'm dealing with the last real hurdle in getting my game wrapped up. I have a number of legendary encounters that I put in copying the script from existing ones in the game and making changes. It all seems to work fine, with one little issue. If I catch the legendary, the sprite doesn't disappear. It does if I KO it, or if I run from the battle. But if I catch it, the sprite doesn't clear and remains interactable. I am very new to scripting, so I'm sure that I just screwed something up there, or maybe it's with the person ID I'm using (I've tried using the same as Mewtwo, Zapdos, and the same number as the flag used in the script and all had the same result). For reference, here is one of the scripts I have for an encounter with Celebi.

#org 0xB00750
special 0x187
compare LASTRESULT 0x2
if 0x1 goto 0x81A7AE0
special 0x188
lock
faceplayer
setwildbattle 0xFB 0x1E 0x0
checksound
cry 0xFB 0x2
preparemsg 0x8B20000 '"Biii!"
waitmsg
waitcry
pause 0x1A
playsong 0x156 0x0
waitkeypress
setflag 0x807
special 0x138
waitstate
clearflag 0x807
special2 LASTRESULT 0xB4
compare LASTRESULT 0x1
if 0x1 goto 0x8B50400
compare LASTRESULT 0x4
if 0x1 goto 0x8B50D00
compare LASTRESULT 0x5
#3# if 0x1 goto 0x8B50D00
setflag 0x204
release
end
'---------------
#org 0x1A7AE0
release
end

'---------------
#org 0xB50400
setflag 0x204
goto 0x81A922D

'---------------
#org 0xB50D00
setvar 0x8004 0xFB
goto 0x81A9236

'---------------
#org 0x1A922D
fadescreen 0x1
hidesprite LASTTALKED
fadescreen 0x0
release
end

'---------------
#org 0x1A9236
fadescreen 0x1
hidesprite LASTTALKED
fadescreen 0x0
bufferpokemon 0x0 0x8004
msgbox 0x81A63C4 MSG_KEEPOPEN '"The [buffer1] fled!"
release
end

'---------
' Strings
'---------
#org 0xB20000
= "Biii!"

#org 0x1A63C4
= The [buffer1] fled!

So what am I missing here?
 
46
Posts
17
Years
  • Seen Jan 23, 2024
Try either A: Adding a Person ID to Sprite Advanced Map like 1901 or something. Also try removing setflag 0x204 from the first and third strings. Try both methods individually and then together and see what works but that should get you to where you need to go!
 

DrFuji

[I]Heiki Hecchara‌‌[/I]
1,691
Posts
14
Years
The issue is with your script's use of special2 0xB4. That special works by returning a value to the chosen variable: 0x1 if the Pokemon fainted, 0x4 if it escaped and 0x7 if you caught it. In your script, you're checking for 0x5 instead of 0x7 so your script never branches if you catch the Celebi, resulting in you just setting the flag and then ending the script. In addition, you've mixed up the pointers for catching the Celebi and fainting it. With the way your script is now, even if you fix the special2 0xB4 value check, you will get a message saying the Celebi fled when you catch it and nothing if you defeat it.

Here's a revised version of your script that I've shortened a bit and made it easier to follow what's going on as there is now only one branching path:
Spoiler:
 
Last edited:
124
Posts
8
Years
  • Age 38
  • Seen Apr 5, 2024
I had a lot of trouble making legendary battles but I seem to get it now. This is a script I made for most of my legendary battles.
Spoiler:


And all that's left to do, add a Pikachu OW in AM, and give it the flag 200, it's simple and it works, a better and more complex battle would be to use FBI's custom wild pokemon asm, which is what I use nowadays.
 
21
Posts
4
Years
  • Age 35
  • Seen Aug 6, 2022
The issue is with your script's use of special2 0xB4. That special works by returning a value to the chosen variable: 0x1 if the Pokemon fainted, 0x4 if it escaped and 0x7 if you caught it. In your script, you're checking for 0x5 instead of 0x7 so your script never branches if you catch the Celebi, resulting in you just setting the flag and then ending the script. In addition, you've mixed up the pointers for catching the Celebi and fainting it. With the way your script is now, even if you fix the special2 0xB4 value check, you will get a message saying the Celebi fled when you catch it and nothing if you defeat it.

Here's a revised version of your script that I've shortened a bit and made it easier to follow what's going on as there is now only one branching path:
Spoiler:

Before I saw this response, I had tinkered with it and managed to get it to work. But I also tested out your script here, and the transitions are definitely smoother. Your explanation is also incredibly helpful. Thanks!
 
Back
Top