• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • 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.

[Other] 2 questions

TheRabbit

Banned
  • 69
    Posts
    10
    Years
    • Seen Jan 1, 2015
    1) How to I go about making border blocks more than 4 tiles?



    2) How does the locked door script on Cinnabar work? Like, what makes it disappear once the player has the key?
     
    1) How to I go about making border blocks more than 4 tiles?

    2) How does the locked door script on Cinnabar work? Like, what makes it disappear once the player has the key?

    Open the header tab in Advance Map and then change it to 'Professional Header View' (Ctrl + H). At the bottom of the map data section there should be two windows where you can define the height and width of your border blocks.

    The green script tile which is blocking Cinnabar Island Gym needs to go through several steps before it is deactivated for good. Firstly, when you pick up the key in Cinnabar Mansion you will automatically set the flag 0x1A8 as that the event's Person ID in the overworld. Secondly, when you enter the main Cinnabar Island map, a level script will branch off if flag 0x1A8 is set. I've copy pasted the important parts below.

    Code:
    #org 0x166EE1
    setworldmapflag 0x898
    call 0x8166F5E
    ...
    
    #org 0x166F5E
    checkflag 0x1A8
    if 0x1 goto 0x8166F68
    return
    
    #org 0x166F68
    setvar 0x4001 0x1
    return

    As you can see, if the player has set the flag 0x1A8 the script will branch off to the command 'setvar 0x4001 0x1' before returning to the main body of the level script. Ultimately it is this setvar command which deactivates the green script tile in front of the Gym. This is because the script tile's variable number is 0x4000 and its value is set to 0x0, which means that the script will only activate if variable 0x4000 has the value of 0x0. Since the level script will always change 0x4000's value to 0x1 once you take the key, the green script tile won't activate anymore and the player will be able to enter the gym freely.
     
    Open the header tab in Advance Map and then change it to 'Professional Header View' (Ctrl + H). At the bottom of the map data section there should be two windows where you can define the height and width of your border blocks.

    The green script tile which is blocking Cinnabar Island Gym needs to go through several steps before it is deactivated for good. Firstly, when you pick up the key in Cinnabar Mansion you will automatically set the flag 0x1A8 as that the event's Person ID in the overworld. Secondly, when you enter the main Cinnabar Island map, a level script will branch off if flag 0x1A8 is set. I've copy pasted the important parts below.

    Code:
    #org 0x166EE1
    setworldmapflag 0x898
    call 0x8166F5E
    ...
    
    #org 0x166F5E
    checkflag 0x1A8
    if 0x1 goto 0x8166F68
    return
    
    #org 0x166F68
    setvar 0x4001 0x1
    return

    As you can see, if the player has set the flag 0x1A8 the script will branch off to the command 'setvar 0x4001 0x1' before returning to the main body of the level script. Ultimately it is this setvar command which deactivates the green script tile in front of the Gym. This is because the script tile's variable number is 0x4000 and its value is set to 0x0, which means that the script will only activate if variable 0x4000 has the value of 0x0. Since the level script will always change 0x4000's value to 0x1 once you take the key, the green script tile won't activate anymore and the player will be able to enter the gym freely.

    Thanks for the clarification. When I make a brand new script like this, can the worldmapflag and variable number be anything that isn't already used (like a typical flag), or does it correspond to specific maps?
     
    Thanks for the clarification. When I make a brand new script like this, can the worldmapflag and variable number be anything that isn't already used (like a typical flag), or does it correspond to specific maps?

    Well, the worldmapflag command isn't necessary at all, it was just kinda at the beginning of the script so I left it in. Its function is to allow the player to fly to Cinnabar Island at any time from that point on as activating the script means that they have discovered Cinnabar Island.

    The variables can be any you want, so long as they are safe ones (check out this thread) and they won't negatively interfere with other scripts that use your chosen variable in the ROM. No variables or flags are locked to a particular map/ map bank as far as I know/ recall.
     
    Back
    Top