• 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.

[Script] hide sprite without flag?

Dinisk

DinisK
  • 89
    Posts
    8
    Years
    • Seen Apr 27, 2019
    I want to create a script. The guard who won't let you in until you talk to Oak. After talking with the professor, the guard disappears. If there is no way, to use the clear flag(with its subsequent use), and this will result in a failed guard. if you can write a script?don't want to use flags for such little things.
     
    There are really only two ways to easily remove NPCs from their original positions: flags and variables. Flags are simple to use and make them disappear while variables can be checked in a level script that moves the NPC's position. For example, if you set variable 0x4011 to 0x1 while speaking to Professor Oak, you could put a type 03 or 05 level script in the map with the guard that looks like this:

    Code:
    #dynamic 0x800000
    
    #org @start
    checkvar 0x4011 0x1 // Checks the value of variable 0x4011
    if 0x4 goto @Guard // If the value is greater than or equal to 0x1, go to @Guard
    end
    
    #org @Guard
    movesprite2 0x1 0xFF 0xFF // Moves the OW to map coordinates 0xFF, 0xFF
    end

    The beautiful part of this script is that since you're checking if the variable is greater than or equal to 0x1, you can reuse the variable so long as it is never set back to 0x0. For example, there may be another guard that only disappears when 0x4011 is equal to 0x2. When you set the variable to 0x2 to get past the second guard, this first guard will still remain invisible.
     
    There are really only two ways to easily remove NPCs from their original positions: flags and variables. Flags are simple to use and make them disappear while variables can be checked in a level script that moves the NPC's position. For example, if you set variable 0x4011 to 0x1 while speaking to Professor Oak, you could put a type 03 or 05 level script in the map with the guard that looks like this:

    Code:
    #dynamic 0x800000
    
    #org @start
    checkvar 0x4011 0x1 // Checks the value of variable 0x4011
    if 0x4 goto @Guard // If the value is greater than or equal to 0x1, go to @Guard
    end
    
    #org @Guard
    movesprite2 0x1 0xFF 0xFF // Moves the OW to map coordinates 0xFF, 0xFF
    end

    The beautiful part of this script is that since you're checking if the variable is greater than or equal to 0x1, you can reuse the variable so long as it is never set back to 0x0. For example, there may be another guard that only disappears when 0x4011 is equal to 0x2. When you set the variable to 0x2 to get past the second guard, this first guard will still remain invisible.
    Thanks for the information. I will use a safe var.
     
    Back
    Top