• 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!
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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] Script events create soft lock

  • 16
    Posts
    9
    Years
    • Seen Sep 24, 2016
    I've been trying to create a rom hack for Pokemon Fire red. For some reason when I step on a tile that has a script event my game soft locks. Any help appreciated.
     
    I've been trying to create a rom hack for Pokemon Fire red. For some reason when I step on a tile that has a script event my game soft locks. Any help appreciated.

    Did you remember to assign a variable to your script tile? And increment your assigned var in the script itself (if you only wanted the script to run once)?
    If you don't know what I mean, look at the Applymovement section of this tutorial.
     
    assign a variable? as in, set a flag? yes ive done that.
     
    assign a variable? as in, set a flag? yes ive done that.

    No, like this...

    Okay. Compile the script, assign it to a script tile (green with an S) and not a person.
    Now test it in the ROM. Then look at this spoiler.
    Spoiler:
     
    Should every script event have those exact values?

    Those numbers are used to let the script run only in certain circumstances.
    You can use variables from 4011 to 40FF. The script will run only when the variable's value is the one you wrote in "Var value".
    Assuming that the current value of 4011 is 0, if you put "setvar 0x4011 0x1" in your script it will run just once since at its end 4011's value won't be 0 anymore.
     
    Those numbers are used to let the script run only in certain circumstances.
    You can use variables from 4011 to 40FF. The script will run only when the variable's value is the one you wrote in "Var value".
    Assuming that the current value of 4011 is 0, if you put "setvar 0x4011 0x1" in your script it will run just once since at its end 4011's value won't be 0 anymore.

    should i always use the "setvar 0x???? 0x1" command? considering most scripts only run once.
     
    should i always use the "setvar 0x???? 0x1" command? considering most scripts only run once.

    Well it is recommended. What matters is that the script runs only if the variable you put has the value you put (on Advance Map I mean).
     
    Well it is recommended. What matters is that the script runs only if the variable you put has the value you put (on Advance Map I mean).

    The values i set in advanced map, will they ever change? if they will never change then what do i need the setvar command for? and if i have flags set in the in the script wont that stop the script from running twice?

    heres on of the scripts i wrote.

    #dynamic 0x72395E

    #org @start
    lock
    checkflag 0x1004
    if 0x1 goto @done
    countpokemon
    compare 0x800D 0x1
    if 0x1 goto @continue
    applymovement 0x290B @move
    msgbox @1 0x6
    applymovement 0xFF @movehero
    waitmovement 0x290B
    applymovement 0x290b @move1
    release
    end

    #org @continue
    lock
    applymovement 0x290b @move
    bufferfirstpokemon 0x00
    msgbox @2 0x06
    applymovement 0x290b @move1
    setflag 0x1004
    release
    end

    #org @done
    release
    end

    #org @2
    = OOH! That's a pretty scary looking\n\v\h02\

    #org @move1
    #raw 0x3
    #raw 0xFE

    #org @move
    #raw 0x1
    #raw 0xFE

    #org @1
    = I'm sorry but, it's to dangerous\nto go alone. Go talk to Professor\lOak to choose your pokemon.

    #org @movehero
    #raw 0x51
    #raw 0xFE
     
    heres on of the scripts i wrote.

    The 40XX value doesn't change but the other number changes because you set it in a script. Yes flags do work like that but if you have script events (green ones) then they need a var number and value to work. You also need them for level scripts. Flags are more used for person events as they are only on or off.

    Don't use flag 0x1004(doesn't even exist), there's a list of flags on ths forum should come up on google.

    A person number of 290b is super high, you'd usually use something less than 10(hex). The max is FF anyway.
     
    Last edited:
    The 40XX value doesn't change but the other number changes because you set it in a script. Yes flags do work like that but if you have script events (green ones) then they need a var number and value to work. You also need them for level scripts. Flags are more used for person events as they are only on or off.

    Don't use flag 0x1004(doesn't even exist), there's a list of flags on ths forum should come up on google.

    A person number of 290b is super high, you'd usually use something less than 10(hex). The max is FF anyway.

    I though the flag number and person number didnt matter. I was reading some article and it said that is was best to start with 0x1000 as your first flag and continue from there. So if the hex value for 1 is "1", I would use 0x0001 as my person number? As the hex value for 10 is "A I would use 0x000A? Thanks a lot.
     
    Last edited:
    Ok then:

    #dynamic 0x72395E
    #org @start
    lockall

    It is better using "lockall" and "releaseall" when using an S script.

    checkflag 0x1004
    if 0x1 goto @done

    Safe flags range from 200 to 2FF. Anyway here this part is not necessary: the script runs only when the variable on Advance Map has the value you set.

    countpokemon
    compare 0x800D 0x1
    if 0x1 goto @continue
    applymovement 0xY @move

    The number after applymovement is the number of the person in Advance Map. Remember to convert it in hexadecimal.

    msgbox @1 0x6
    applymovement 0xFF @movehero
    waitmovement 0x0
    applymovement 0xY @move1
    waitmovement 0x0
    release
    end

    Same here, use waitmovement 0x0 after a single/a set of simultaneous applymovement.

    #org @continue
    lockall
    applymovement 0xY @move
    waitmovement 0x0
    bufferfirstpokemon 0x00
    msgbox @2 0x06
    applymovement 0xY @move1
    waitmovement 0x0
    setvar 0x40XX 0xZ
    releaseall
    end

    Use variables from 4011 to 40FF. If you set variable 4011 to 0x1, for example, and put on Advance Map's script "Variable number: 4011, Variable value: 0", at the end of the script var 4011's value will be 1 and not 0.

    #org @done
    releaseall
    end

    #org @2
    = OOH! That's a pretty scary looking\n\v\h02\

    #org @move1
    #raw 0x3
    #raw 0xFE

    #org @move
    #raw 0x1
    #raw 0xFE

    #org @1
    = I'm sorry but, it's to dangerous\nto go alone. Go talk to Professor\lOak to choose your pokemon.

    #org @movehero
    #raw 0x51
    #raw 0xFE

    This should be ok now, if it doesn't work just tell me!
     
    I do apologize but im still not quite understanding the "0x1" part of the setvar command i understand "setvar 0x????" just not the second part. I do understand everything else thank you.
     
    I do apologize but im still not quite understanding the "0x1" part of the setvar command i understand "setvar 0x????" just not the second part. I do understand everything else thank you.

    The 0x1 part of setvar is the number you set the variable to.
    So, setvar 0x4007 0x1 means make variable 0x4007 equal 0x1
    The 0x part means the number is in hexadecimal, or base-16.
     
    No, like this...
    The pictures in that spoiler aren't coming up, and I am also looking for the solution to this problem. If you see this (I know its been a few years) could you please tell me what happened in those images?
     
    The pictures in that spoiler aren't coming up, and I am also looking for the solution to this problem. If you see this (I know its been a few years) could you please tell me what happened in those images?

    Here you go:

    Spoiler:


    Unfortunately diegoisawesome doesn't really go into why those number have to be like that or what they mean, but fortunately karatekid552's tutorial has an excellent part on script tiles that explains what's going on.
     
    Here you go:

    Spoiler:


    Unfortunately diegoisawesome doesn't really go into why those number have to be like that or what they mean, but fortunately karatekid552's tutorial has an excellent part on script tiles that explains what's going on.

    Thanks, but I did figure it out, I didn't realize that vars had to be there, I thought it was like flags and person events, where it doesn't run if it's true, not that it did run if it's true. Also, the tutorials I found said changing the first unknown to 3 used to be done for consistency with game freak, but then was discovered 3 and 0 are the same (don't know about 300 though)
     
    Back
    Top