• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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.

Help Thread: Script Help Thread

Status
Not open for further replies.
1
Posts
10
Years
    • Seen Aug 15, 2018
    So I'm starting a fire red rom hack and I'm trying to figure out how to give the national pokedex at the beginning of the game. I tried using the script in the spoiler AFTER I already had a pokemon in my party and it still didn't work. Can somebody tell me what I'm possibly doing wrong?

    Spoiler:
     
    5,256
    Posts
    16
    Years
  • So I'm starting a fire red rom hack and I'm trying to figure out how to give the national pokedex at the beginning of the game. I tried using the script in the spoiler AFTER I already had a pokemon in my party and it still didn't work. Can somebody tell me what I'm possibly doing wrong?

    Spoiler:

    If the player doesn't already have the Pokédex menu activated, that special won't have any noticeable difference, so you'll also need to include setflag 0x829 somewhere, too.
     
    77
    Posts
    9
    Years
    • Seen Dec 5, 2015
    This is a level script. It's supposed to be an intro cutscene, played on the bottom floor of the player's house. The player talks to their Dad, Mom comes in, few lines of dialogue, Mom sends player upstairs. The player checks a flag in a separate script, comes back down and receives Pokemon from rival. Intro battle, front door unlocked, player is free.

    That is, if everything worked. Which it doesn't.

    Here's the script:

    Spoiler:

    My biggest issue is the hidesprite, movesprite and showsprite commands. Sprite 0x2 is not being hidden or moved. Sprite 0x1 is being hidden only after the player reaches the bottom of the stairs, and the sprite doesn't reappear. I believe everything's correct on A-map's end. It's running as a type 02 level script. My flag work is buggy but I think I can fix that on my own. I can provide more info if needed.
     
    87
    Posts
    8
    Years
    • Seen Feb 5, 2021
    Is there a way to insert two level scripts in the same map?
    The first should run if 0x4011 is 0x0, the second one if 0x4011 is 0x5 for example.
     

    Uncommon

    Oozma Kappa
    192
    Posts
    8
    Years
  • Is there a way to insert two level scripts in the same map?
    The first should run if 0x4011 is 0x0, the second one if 0x4011 is 0x5 for example.

    Yes! In A-Map, on the Header tab where you normally apply your level script, just hit Add again and choose a new type (01, 02, 03, etc.). If you want two level scripts of the same type (or for more info on level scripts in general), check out diego's level script tutorial, specifically the "BONUS" section:
    BONUS: Make multiple level scripts of the same type (type 0x2 or 0x4)!
    Even though Advance-Map doesn't let you do it correctly, you can still manually insert your own.

    In Step 14, there's a random number underneath the pointer to your script. If you have free space after this, you can instead replace the random number with another variable number, then another variable value, and another script, and so on. Like so:

    Code:
    '---------------
    #org 0x166F6E
    #raw word 0x408A
    #raw word 0x1
    #raw pointer 0x8166F88
    #raw word 0x4071
    #raw word 0x1
    #raw pointer 0x8166FA0
    #raw word 0x0

    Credit to diegoisawesome, of course
     
    77
    Posts
    9
    Years
    • Seen Dec 5, 2015
    Bumping my last question, but I feel guilty demanding answers, so have some screenshots with extra details on the problem. My original post:
    Spoiler:

    Script Help Thread

    Here's the scene as the player walks down the stairs. As a placeholders I used the Mom sprite 3 times. Mom 1 is Dad, Mom 2 is Mom, Mom 3 is the player's rival, named Cassie in the script. Sorry about the confusion.

    There's some immediate problems. Firstly, all sprites are visible, meaning hidesprite failed to activate. Second, the sprites haven't been "moved" by the movesprite command.

    Script Help Thread

    Now it gets interesting. Even though both sprites have the exact same hidesprite command, only one sprite vanishes. This has me thinking it's more than an issue with the warp transition.

    Script Help Thread

    To make it even more confusing, the sprite that should reappear doesn't. This line of dialogue is supposed to be spoken by the player's mother (as in not the impostor moms).

    Here's a repost of my script:
    Spoiler:

    I'm at my wit's end. What's going on?
     
    Last edited:
    26
    Posts
    8
    Years
    • Seen Nov 25, 2017
    How would I go about making a gym locked until you do something? I was looking at Viridian City's script box in front of the gym, but its script doesn't check flags or vars to see if it can let you in, so how does the game remove that script box? Another idea is to just use a script box that stays in effect until you set a flag or whatever, but how do you get a script box to keep recurring by default? Since it needs a setvar command at the end for the script box to work in the first place and that command also prevents the script box from running multiple times, I don't know where to start.
     

    destinedjagold

    You can contact me in PC's discord server...
    8,593
    Posts
    16
    Years
    • Seen Dec 23, 2023
    Bumping my last question, but I feel guilty demanding answers, so have some screenshots with extra details on the problem. My original post:
    Spoiler:


    View attachment 77234

    Here's the scene as the player walks down the stairs. As a placeholders I used the Mom sprite 3 times. Mom 1 is Dad, Mom 2 is Mom, Mom 3 is the player's rival, named Cassie in the script. Sorry about the confusion.

    There's some immediate problems. Firstly, all sprites are visible, meaning hidesprite failed to activate. Second, the sprites haven't been "moved" by the movesprite command.

    View attachment 77236

    Now it gets interesting. Even though both sprites have the exact same hidesprite command, only one sprite vanishes. This has me thinking it's more than an issue with the warp transition.

    View attachment 77235

    To make it even more confusing, the sprite that should reappear doesn't. This line of dialogue is supposed to be spoken by the player's mother (as in not the impostor moms).

    Here's a repost of my script:
    Spoiler:

    I'm at my wit's end. What's going on?

    Methinks it would be nicer to see the uncompiled version of your script.

    Anyway...

    Code:
    ...
    movesprite 0x0 ...
    ...
    hidesprite 0x0
    ...
    I don't think there's a Person event number 0 in there. The very first NPC always has 1 as its Person event number.
    Script Help Thread
     
    87
    Posts
    8
    Years
    • Seen Feb 5, 2021
    How would I go about making a gym locked until you do something? I was looking at Viridian City's script box in front of the gym, but its script doesn't check flags or vars to see if it can let you in, so how does the game remove that script box? Another idea is to just use a script box that stays in effect until you set a flag or whatever, but how do you get a script box to keep recurring by default? Since it needs a setvar command at the end for the script box to work in the first place and that command also prevents the script box from running multiple times, I don't know where to start.

    You could put down something like this:
    #freespace 0xFF
    #dynamic 0x800000
    #org @start
    lock
    compare 0x40XX 0xY
    if 0x0 goto @don't
    [MESSAGE OR EVERYTHING ELSE]
    release
    end

    #org @don't
    [IF YOU WANT IT TO DO SOMETHING JUST PUT IT HERE)
    release
    end
    This way it shows a message only when variable 40XX' value is Y.
    Then add a setvar 0x40XX 0xZ in some other script so that when the latter runs it changes what the first script does.
    About the door, that's what you could try to do: make two blocks with the same door but put the behaviour that makes doors work as doors just in one of them.
    In your map use the "fake door" and create a level script "setmaptile" which changes the fake door to the real door only when variable 40XX value is different from Y.

    #freespace 0xFF
    #dynamic 0x800000
    #org @start
    compare 0x40XX 0xY
    if 0x1 goto @don't
    setmaptile 0x(X coordinate) 0x(Y coordinate) 0x(number of block) 0x1
    end

    #org @don't
    end

    Remember to put a warp on the door. It works only if the door has the right behaviour.
     
    7
    Posts
    9
    Years
    • Seen Mar 25, 2023
    Question about inserting scripts....

    I'll start with the simple question. I understand changing the bolded part, but do I need to change the oxFF to anything, or anything else? Instead of being told yes or no, what does 0xFF do, is it a termination byte? Would rather understand it than have to ask every time I see it change.

    #dynamic 0x800000
    #freespacebyte 0xFF

    Spoiler:


    Above is Mr. Dollsteaks fang script. It essentially adds PRZ/FRZ/BRN to the flinch effect (which is 31 in the default effect table), right? So bite would still work normally, and this script just recognizes when fire, ice, or thunder fang have been used, and adds the necessary effect on top of flinch, using the setbyte command, am I still right?

    In his script....
    Spoiler:

    means that moves numbers 0x1AF, 1B0 & 1B1 (432,433,434) in the movetable inherit the effect that setbyte 0x2023E85 controls. So if I didn't want to expand my movetable, I Just change 1AF, 1B0 and 1B1, right?
    If I wanted to replace Pound, Karate Chop, and Doubleslap (the first three moves in the table).....

    Spoiler:

    That would work, right?
     
    Last edited:
    325
    Posts
    10
    Years
  • Question about inserting scripts....

    I'll start with the simple question. I understand changing the bolded part, but do I need to change the oxFF to anything, or anything else? Instead of being told yes or no, what does 0xFF do, is it a termination byte? Would rather understand it than have to ask every time I see it change.
    FF is the 'free space byte'. It can be a termination byte in certain instances(tables(sometimes) and strings of words use it as their termination byte), but it's mostly just the filler for the ROM. It's usually not being used, which is why we like to overwrite the bytes that are clear, and this dynamic insertion process can be useful.



    Spoiler:


    Above is Mr. Dollsteaks fang script. It essentially adds PRZ/FRZ/BRN to the flinch effect (which is 31 in the default effect table), right? So bite would still work normally, and this script just recognizes when fire, ice, or thunder fang have been used, and adds the necessary effect on top of flinch, using the setbyte command, am I still right?
    Yes, because 0x2023E85 is the byte that controls the status effect to possibly inflict later on, which is read by seteffectwithchancetarget

    In his script....
    Spoiler:

    means that moves numbers 0x1AF, 1B0 & 1B1 (432,433,434) in the movetable inherit the effect that setbyte 0x2023E85 controls. So if I didn't want to expand my movetable, I Just change 1AF, 1B0 and 1B1, right?
    I'm not sure what you're going on about here. 0x1AF/1B0/1B1 is the index number of Fire Fang, Ice Fang, and Thunder Fang, in that order. I explained earlier that 0x2023E85 is the byte that gets read for the status. 0x2023D4A is the offset where the last used move is stored, so we read that and decide where to jump based on the index number of the move that was just used.

    If I wanted to replace Pound, Karate Chop, and Doubleslap (the first three moves in the table).....

    Spoiler:

    That would work, right?
    Yes.
     

    destinedjagold

    You can contact me in PC's discord server...
    8,593
    Posts
    16
    Years
    • Seen Dec 23, 2023
    Script help~

    Can anyone tell me how to include a var's number in the message box? Like, say, setvar 0x4016 0x5. I wanna display "5" in an NPC's text.


    Code:
    #dynamic 0x800000
    
    #org @start
    lock
    faceplayer
    setvar 0x4015 0x5
    msgbox @1 0x6
    release
    end
    
    #org @1
    = How do you do?\nThe lucky number is [variable].

    Thanks~
     
    1,682
    Posts
    8
    Years
    • Seen May 16, 2024
    Script help~

    Can anyone tell me how to include a var's number in the message box? Like, say, setvar 0x4016 0x5. I wanna display "5" in an NPC's text.


    Code:
    #dynamic 0x800000
    
    #org @start
    lock
    faceplayer
    setvar 0x4015 0x5
    msgbox @1 0x6
    release
    end
    
    #org @1
    = How do you do?\nThe lucky number is [variable].

    Thanks~

    I'd suggest the buffernumber command.
    Format: buffernumber 0x(buffer number) 0x(Variable number)
    so for you it would be like this:
    Code:
    #dynamic 0x800000
    
    #org @start
    lock
    faceplayer
    setvar 0x4015 0x5
    buffernumber 0x0 0x4015
    msgbox @1 0x6
    release
    end
    
    #org @1
    = How do you do?\nThe lucky number is [buffer1].
     
    8
    Posts
    10
    Years
    • Seen Feb 13, 2016
    Hey guys, I've just recently started seriously trying to script and I've hit an early problem. I've seen two other instances of it online, one with an apparent solution, but it didn't work for me. I apologize if this has come up before, but I did quite a bit of searching already.

    Essentially when the event runs, the msgbox script is being ignored. Faceplayer will run, but no text will appear. Note: I am attempting to edit Pokemon Shiny Gold, but I have also attempted this on FireRed to no avail. I've tried multiple times, even attempting to copy tutorial scripts line for line, but it still consistently ignores the text.

    Is this a common issue, and if so, is there a known solution? A post I saw on reddit said that they discovered the fix was adding callstd before 0x6, but that didn't work for me either. If you have any ideas or solutions I'd really appreciate it! Thanks
     

    destinedjagold

    You can contact me in PC's discord server...
    8,593
    Posts
    16
    Years
    • Seen Dec 23, 2023
    Hey guys, I've just recently started seriously trying to script and I've hit an early problem. I've seen two other instances of it online, one with an apparent solution, but it didn't work for me. I apologize if this has come up before, but I did quite a bit of searching already.

    Essentially when the event runs, the msgbox script is being ignored. Faceplayer will run, but no text will appear. Note: I am attempting to edit Pokemon Shiny Gold, but I have also attempted this on FireRed to no avail. I've tried multiple times, even attempting to copy tutorial scripts line for line, but it still consistently ignores the text.

    Is this a common issue, and if so, is there a known solution? A post I saw on reddit said that they discovered the fix was adding callstd before 0x6, but that didn't work for me either. If you have any ideas or solutions I'd really appreciate it! Thanks

    Post your script here, wrap it around the
    Code:
     tags like so...[/COLOR][/B]
    [HTML][CODE]...insert script here...
    [/HTML]
    Also, tell us what version of XSE you are using.
     
    8
    Posts
    10
    Years
    • Seen Feb 13, 2016
    Blah, I'm a doink. Before I posted that I thought I had attempted it on v1.1.1 of XSE. Apparently I had not, or at least not correctly. It appears to be all good now, but thanks for the help anyway. Sorry for the brief waste of time. If it makes you feel any better I spent about 5 hours trying to figure that out xP
     

    Desert Stream~

    Holy Kipper!
    3,269
    Posts
    8
    Years
    • She/Her
    • Seen Aug 20, 2023
    #dynamic 0x800000

    #org @start
    msgbox @1 0x2
    end

    #org @1
    = Munch Munch\n(Leave me alone,/n I'm eating!)

    For some reason i can't compile...
     

    Desert Stream~

    Holy Kipper!
    3,269
    Posts
    8
    Years
    • She/Her
    • Seen Aug 20, 2023
    There's no error, the button is greyed out and i can't do Anything.
    It says [Sister 1.rbc]
     
    Status
    Not open for further replies.
    Back
    Top