The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary ROM Hacking (https://www.pokecommunity.com/forumdisplay.php?f=284)
-   -   Script Using setvar in a map script (type 02) with a msgbox results in broken dialogue loop (https://www.pokecommunity.com/showthread.php?t=459501)

ThePieFace October 6th, 2021 9:48 PM

Using setvar in a map script (type 02) with a msgbox results in broken dialogue loop
 
I'm new to ROM hacking, and I'm trying to have some dialogue appear when the game starts, however I can never use setvar to stop the map script from repeating because using it results in the following behavior:

https://i.gyazo.com/ac3b4bae440aa408cbc54b3ea698736d.gif

This is what my script looks like
Code:

'---------------
#org 0x800000
setvar 0x5100 0x1
lock
msgbox 0x8800011 MSG_KEEPOPEN '"Test"
release
end

'---------
' Strings
'---------
#org 0x800011
= Test


And this is the Advance Map setup

https://i.gyazo.com/4988f75822a8b5d9f887e2413ae4c48e.png

I've looked at similar scripts from other ROM hacks and in the base game and I have no idea what I'm doing wrong. I originally thought it may be because I have a CFRU patch on my ROM but I get this exact same behavior in a Vanilla ROM. If anyone knows how to fix this I would be very grateful!

Anon822 October 7th, 2021 3:11 AM

Quote:

Originally Posted by ThePieFace (Post 10414738)
I'm new to ROM hacking, and I'm trying to have some dialogue appear when the game starts, however I can never use setvar to stop the map script from repeating because using it results in the following behavior:

https://i.gyazo.com/ac3b4bae440aa408cbc54b3ea698736d.gif

This is what my script looks like
Code:

'---------------
#org 0x800000
setvar 0x5100 0x1
lock
msgbox 0x8800011 MSG_KEEPOPEN '"Test"
release
end

'---------
' Strings
'---------
#org 0x800011
= Test


And this is the Advance Map setup

https://i.gyazo.com/4988f75822a8b5d9f887e2413ae4c48e.png

I've looked at similar scripts from other ROM hacks and in the base game and I have no idea what I'm doing wrong. I originally thought it may be because I have a CFRU patch on my ROM but I get this exact same behavior in a Vanilla ROM. If anyone knows how to fix this I would be very grateful!

There doesn't appear to be anything wrong with the script itself. I inserted it in a vanilla firered rom with the same settings in advance map and it worked fine.

ThePieFace October 7th, 2021 6:54 AM

Weird maybe it has something to do with the way I'm compiling? My exact replication steps are as follows:
- Load ROM into XSE v1.1.1 by clicking on the open icon (vanilla FireRed v 1.0)
- Typing in the following code:
Code:

#dynamic 0x800000

#org @start
setvar 0x5100 0x1
lock
msgbox @t1 MSG_KEEPOPEN
release
end

#org @t1
= Test


- Clicking on the Compile button in XSE and copying the offset address
- I then load the ROM in Advance Map v 1.95
- Navigate to PALLET TOWN (4.1) and in the Header tab click the Add button under Map Script
- I set the new Map script to type 02
- Set the Flag to 5100
- Set the Script offset 2 to the copied offset from XSE being sure to leave the first two 00 so that it would read $00800000
- After that I click on the Save map scripts button
- Then click on the Save icon in the top left of Advance Map

Anon822 October 7th, 2021 7:54 AM

Quote:

Originally Posted by ThePieFace (Post 10414831)
Weird maybe it has something to do with the way I'm compiling? My exact replication steps are as follows:
- Load ROM into XSE v1.1.1 by clicking on the open icon (vanilla FireRed v 1.0)
- Typing in the following code:
Code:

#dynamic 0x800000

#org @start
setvar 0x5100 0x1
lock
msgbox @t1 MSG_KEEPOPEN
release
end

#org @t1
= Test


- Clicking on the Compile button in XSE and copying the offset address
- I then load the ROM in Advance Map v 1.95
- Navigate to PALLET TOWN (4.1) and in the Header tab click the Add button under Map Script
- I set the new Map script to type 02
- Set the Flag to 5100
- Set the Script offset 2 to the copied offset from XSE being sure to leave the first two 00 so that it would read $00800000
- After that I click on the Save map scripts button
- Then click on the Save icon in the top left of Advance Map

I was able to replicate the issue. Looks like it's caused by a bug in advance map 1.95.
You should use 1.92 as it's the more stable version.

ThePieFace October 7th, 2021 8:25 AM

Thank you so much!! That was driving me crazy! It was indeed Advanced Map version but it was a little more than that.
I had to change my Bytes to look for to 00 instead of FF. I guess Advanced Map 1.95 automatically searches for repoint locations for the script offset in FF bytes while Advanced Map 1.92 gives you the option.

So for any future ROM hackers finding this post with the same issue make sure you're using Advanced Map 1.95 and that when you click Save Map Scripts you change the Bytes to look for to 00
https://i.gyazo.com/ea7ea4bf04b519f0e31b2538d450f7a6.png

kalarie October 7th, 2021 2:14 PM

@ThePieFace

You should NEVER let AdvanceMap interpret 0x00 bytes as free space instead of 0xFF bytes in Fire Red. 0x00 bytes in Fire Red are generally not free space. By doing this, you're probably overwriting data that is already in use by something else.

Anyway, this is a known bug in AdvanceMap. For some reason AdvanceMap falsely imports a few bytes as 0xFF instead of 0x00 bytes (Which is probably why your workaround seems to be working). After importing a map script, you need to edit the map script offset manually with XSE to change those 0xFF bytes to 0x00 bytes. Check this tutorial for an example on how to do that: https://youtu.be/FttPQvAyWB4.

kalarie October 7th, 2021 2:15 PM

@Anon822

This bug is not unique for AdvanceMap 1.95. AdvanceMap 1.92 has the same issue.


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


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.