The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script Hidesprite won't work, reappears after walking

Notices
For all updates, view the main page.

Binary ROM Hacking Need a helping hand or just want to talk about binary ROM hacks? Get comments and answers to any ROM Hacking-related problems, questions or thoughts you have here.

Ad Content
Reply
 
Thread Tools
  #1   Link to this post, but load the entire thread.  
Old July 30th, 2018 (8:20 AM).
dearman4's Avatar
dearman4 dearman4 is offline
 
Join Date: Nov 2017
Location: Michigan
Age: 30
Gender: Male
Nature: Quirky
Posts: 620
I'm trying to have a stationary legendary battle, I can initiate it just fine, but when I try to get the sprite that initiates the battle, it will just reappear after walking a step, am I doing something wrong?

Here's the uncompiled script I am using to initiate a battle with Entei:
Spoiler:
#dynamic 0x800000
#org @start
lock
faceplayer
setwildbattle 0xF4 0x32 0x0
setflag 0x8C1
special 0x13B
waitstate
clearflag 0x8C1
special2 LASTRESULT 0xB7
compare LASTRESULT 0x1
if 0x1 goto @captured
compare LASTRESULT 0x4
if 0x1 goto @fail
compare LASTRESULT 0x5
if 0x1 goto @fail
release
end

#org @captured
setflag 0x1BC
goto @battleend

#org @fail
setvar 0x8004 0xFA
goto @fade

#org @battleend
fadescreen3 0x1
hidesprite LASTTALKED
fadescreen3 0x0
release
end

#org @fade
fadescreen3 0x1
hidesprite LASTTALKED
fadescreen3 0x0

bufferpokemon 0x0 0x8004
msgbox @fled MSG_KEEPOPEN //"The [buffer1] flew away!"
release
end

#org @fled
= The [buffer1] flew away!
__________________
My ROM hack, Pokemon Emerald Final:
https://www.pokecommunity.com/showthread.php?p=9898603
My beginner's devkit tutorial:
https://www.pokecommunity.com/showthread.php?t=411844
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old July 30th, 2018 (1:38 PM). Edited July 30th, 2018 by Karl.
Karl's Avatar
Karl Karl is offline
Creator of Pokémon Darkfire
 
Join Date: Nov 2010
Location: London, UK
Gender: Male
Nature: Calm
Posts: 168
Assign the OW a safe flag in AdvanceMap (or whatever map editor you're using)

After the battle, use the fadescreen command to turn the screen to black.

Before turning the screen to normal, use the hidesprite 0x(person event number) command followed by setflag (OW flag you assigned)

Here's a super basic script I wrote to give you an idea:

Spoiler:
Code:
#dynamic 0x800000

#org @start
lock
faceplayer
cry 0x120 0x0
msgbox @1 0x6
waitcry
wildbattle 0x120 0x6 0x0
cry 0x120 0x0
waitcry
pause 0x30
fadescreen 0x1 
hidesprite 0x1
setflag 0x400
fadescreen 0x0
release
end

#org @1
= Zigzagoon: Grr!


So for example in AdvanceMap I'd change the Person ID field of my Zigzagoon to 0400 and then use setflag 0x400 in my script upon fading the screen.

If you use the wrong flag, the NPC will return after 1 step.

Hope this helps.
__________________

Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old July 30th, 2018 (3:15 PM).
dearman4's Avatar
dearman4 dearman4 is offline
 
Join Date: Nov 2017
Location: Michigan
Age: 30
Gender: Male
Nature: Quirky
Posts: 620
Quote:
Originally Posted by Synonym View Post
Assign the OW a safe flag in AdvanceMap (or whatever map editor you're using)

After the battle, use the fadescreen command to turn the screen to black.

Before turning the screen to normal, use the hidesprite 0x(person event number) command followed by setflag (OW flag you assigned)

Here's a super basic script I wrote to give you an idea:

Spoiler:
Code:
#dynamic 0x800000

#org @start
lock
faceplayer
cry 0x120 0x0
msgbox @1 0x6
waitcry
wildbattle 0x120 0x6 0x0
cry 0x120 0x0
waitcry
pause 0x30
fadescreen 0x1 
hidesprite 0x1
setflag 0x400
fadescreen 0x0
release
end

#org @1
= Zigzagoon: Grr!


So for example in AdvanceMap I'd change the Person ID field of my Zigzagoon to 0400 and then use setflag 0x400 in my script upon fading the screen.

If you use the wrong flag, the NPC will return after 1 step.

Hope this helps.
So, I have tried that, used flag 0x23 (going off of a list of unused flags) and not seeming to work, its person event 2 so I have it set to hidesprite 0x2 and its person ID to 0023 but it doesn't want to hide the sprite still
__________________
My ROM hack, Pokemon Emerald Final:
https://www.pokecommunity.com/showthread.php?p=9898603
My beginner's devkit tutorial:
https://www.pokecommunity.com/showthread.php?t=411844
Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old July 30th, 2018 (10:16 PM).
Buffel Saft's Avatar
Buffel Saft Buffel Saft is offline
 
Join Date: Sep 2013
Gender: Male
Posts: 1,550
Quote:
Originally Posted by dearman4 View Post
So, I have tried that, used flag 0x23 (going off of a list of unused flags) and not seeming to work, its person event 2 so I have it set to hidesprite 0x2 and its person ID to 0023 but it doesn't want to hide the sprite still
It's been a while since I've done anything with Emerald, but IIRC you also need what A-map calls a "map script" to hide the sprite after the battle. You don't need to write or compile this script yourself, just point to a copy of the script for one of the existing legendary encounters (they all use the same code copied to different addresses for some reason, so you can just reuse one of the existing map scripts for all of your static encounters).

So as an example, I have a compiled Articuno encounter script which looks like this :
Spoiler:
Code:
#include stditems.rbh
#include stdpoke.rbh

//---------------
#org 0xF62350
lock
faceplayer
checksound
cry PKMN_ARTICUNO 0x2
pause 0x28
waitcry
setwildbattle PKMN_ARTICUNO 0x3C ITEM_NONE
setflag 0x8C1
special 0x13B 
playsong 0x228 0x0 //play Kanto legendary theme during battle
waitstate
clearflag 0x8C1
special2 LASTRESULT 0xB7
compare LASTRESULT 0x1
if 0x1 goto 0x8F6239C // go to success
compare LASTRESULT 0x4
if 0x1 goto 0x8F623A5 // go to fail
compare LASTRESULT 0x5
if 0x1 goto 0x8F623A5 // go to fail
setflag 0x1BA // Articuno's person ID
release
end

//---------------
#org 0xF6239C // success
setflag 0x1BA
goto 0x827376D

//---------------
#org 0xF623A5 // fail
setvar 0x8004 0x90
goto 0x8273776

//---------------
#org 0x27376D // section of script recycled from existing scripts
fadescreen3 0x1
hidesprite LASTTALKED
fadescreen3 0x0
release
end

//---------------
#org 0x273776 // section of script recycled from existing scripts
fadescreen3 0x1
hidesprite LASTTALKED
fadescreen3 0x0
bufferpokemon 0x0 0x8004
msgbox 0x8273204 MSG_KEEPOPEN //"The [buffer1] flew away!"
release
end


//---------
// Strings
//---------
#org 0x273204 // section of script recycled from existing scripts
= The [buffer1] flew away!


Which works after adding a map script which looks like this:

Spoiler:
Code:
//---------------
#org 0x238E3A
checkflag 0x8C1
if 0x1 call 0x8238E44
end

//---------------
#org 0x238E44
special2 LASTRESULT 0xB7
compare LASTRESULT 0x7
if 0x5 goto 0x827374E
hidesprite LASTTALKED
return

//---------------
#org 0x27374E
return


The map script is added under the headers tab. Just make a new one with the script type set to "05 On entering map/on menu close" and paste $238E3A into its script offset box , and it should work.
__________________
Reply With Quote
  #5   Link to this post, but load the entire thread.  
Old July 30th, 2018 (10:52 PM).
dearman4's Avatar
dearman4 dearman4 is offline
 
Join Date: Nov 2017
Location: Michigan
Age: 30
Gender: Male
Nature: Quirky
Posts: 620
Quote:
Originally Posted by Buffel Saft View Post
It's been a while since I've done anything with Emerald, but IIRC you also need what A-map calls a "map script" to hide the sprite after the battle. You don't need to write or compile this script yourself, just point to a copy of the script for one of the existing legendary encounters (they all use the same code copied to different addresses for some reason, so you can just reuse one of the existing map scripts for all of your static encounters).

So as an example, I have a compiled Articuno encounter script which looks like this :
Spoiler:
Code:
#include stditems.rbh
#include stdpoke.rbh

//---------------
#org 0xF62350
lock
faceplayer
checksound
cry PKMN_ARTICUNO 0x2
pause 0x28
waitcry
setwildbattle PKMN_ARTICUNO 0x3C ITEM_NONE
setflag 0x8C1
special 0x13B 
playsong 0x228 0x0 //play Kanto legendary theme during battle
waitstate
clearflag 0x8C1
special2 LASTRESULT 0xB7
compare LASTRESULT 0x1
if 0x1 goto 0x8F6239C // go to success
compare LASTRESULT 0x4
if 0x1 goto 0x8F623A5 // go to fail
compare LASTRESULT 0x5
if 0x1 goto 0x8F623A5 // go to fail
setflag 0x1BA // Articuno's person ID
release
end

//---------------
#org 0xF6239C // success
setflag 0x1BA
goto 0x827376D

//---------------
#org 0xF623A5 // fail
setvar 0x8004 0x90
goto 0x8273776

//---------------
#org 0x27376D // section of script recycled from existing scripts
fadescreen3 0x1
hidesprite LASTTALKED
fadescreen3 0x0
release
end

//---------------
#org 0x273776 // section of script recycled from existing scripts
fadescreen3 0x1
hidesprite LASTTALKED
fadescreen3 0x0
bufferpokemon 0x0 0x8004
msgbox 0x8273204 MSG_KEEPOPEN //"The [buffer1] flew away!"
release
end


//---------
// Strings
//---------
#org 0x273204 // section of script recycled from existing scripts
= The [buffer1] flew away!


Which works after adding a map script which looks like this:

Spoiler:
Code:
//---------------
#org 0x238E3A
checkflag 0x8C1
if 0x1 call 0x8238E44
end

//---------------
#org 0x238E44
special2 LASTRESULT 0xB7
compare LASTRESULT 0x7
if 0x5 goto 0x827374E
hidesprite LASTTALKED
return

//---------------
#org 0x27374E
return


The map script is added under the headers tab. Just make a new one with the script type set to "05 On entering map/on menu close" and paste $238E3A into its script offset box , and it should work.
I'll try this when I get home!
__________________
My ROM hack, Pokemon Emerald Final:
https://www.pokecommunity.com/showthread.php?p=9898603
My beginner's devkit tutorial:
https://www.pokecommunity.com/showthread.php?t=411844
Reply With Quote
Reply

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 9:20 AM.