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

Use new vars

  • 9
    Posts
    4
    Years
    • Seen Dec 15, 2021
    Hi

    I'm using pokefirered C decompilated code and I want to add some new vars usable in scripts

    In var.h file, every var from 0x4000 to 0x40FF is already defined

    How can I add a custom var? Can I change "VARS_END" (wich is set to 40FF) in order to use vars from 0x4100?

    Thanks
     
    Hi

    I'm using pokefirered C decompilated code and I want to add some new vars usable in scripts

    In var.h file, every var from 0x4000 to 0x40FF is already defined

    How can I add a custom var? Can I change "VARS_END" (wich is set to 40FF) in order to use vars from 0x4100?

    Thanks
    Yeah, I think that's pretty much all there is to it.
    You just add in new vars after 0x40FF following the lead of the previous ones, and adjust VARS_END accordingly.

    Before adding in new vars, you should make use of all the unused vars the game has by default though, imo.
    Vars that lack a proper label and are simply defined as "VAR_" followed by their internal ID are more often than not unused.
    For a quick example, every var from VAR_0x408C to VAR_0x40A9 is unused.
    A quick git grep will show that they're defined in the same file where the rest of the vars are, but without being actually used anywhere else in the code.
     
    Back
    Top