• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • It's time to vote for your favorite Pokémon Battle Revolution protagonist in our new weekly protagonist poll! Click here to cast your vote and let us know which PBR protagonist you like most.
  • 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.

[Script] Using setvar in a map script (type 02) with a msgbox results in broken dialogue loop

  • 3
    Posts
    3
    Years
    • Seen Oct 12, 2021
    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:

    [PokeCommunity.com] Using setvar in a map script (type 02) with a msgbox results in broken dialogue loop


    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

    [PokeCommunity.com] Using setvar in a map script (type 02) with a msgbox results in broken dialogue loop


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

    [PokeCommunity.com] Using setvar in a map script (type 02) with a msgbox results in broken dialogue loop


    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

    [PokeCommunity.com] Using setvar in a map script (type 02) with a msgbox results in broken dialogue loop


    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.
     
    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
     
    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.
     
    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
    [PokeCommunity.com] Using setvar in a map script (type 02) with a msgbox results in broken dialogue loop
     
    @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.
     
    Last edited:
    Back
    Top