• 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!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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✓] How should I approach editing pre-existing scripts in Fire Red?

Ace Trainer Slash

If you give me about two hours, I can make scripts
  • 236
    Posts
    6
    Years
    Hello. :D

    So, I've been at work on creating aplenty of scripts, as well as editing old ones for my ROM Hack, and I've tried two methods specifically for editing old scripts:

    The first one is using AdvanceMap 1.92's compatibility with XSE, I've used this a few times on pre-existing NPCs, editing their original dialogue, in the process, I've overwritten other scripts in the game. (I probably need to repoint the edited script to somewhere else.)

    The second way is creating entirely new scripts using XSE, and overwriting the original script offsets with the new ones created. It seems to be working correctly from my standpoint, but I'm not sure it's the most efficient way to edit them.

    So, my problem is, I want to use as little space as possible when editing old NPC scripts, in order for me to still have space for editing trainers/Pokemon, making new warps, adding more NPCs, making more scripts for those NPCs and so forth, but I'm not sure what method of scripting is most reliable space-wise. I may be overreacting in this situation, since I don't know how much free space really is in Pokemon Fire Red, but I just want to be sure that I have room for everything I want to add in this hack. (It's supposed to be quite basic, having map edits, some Pokemon edits, sprite edits, script edits, if that can give an idea on how much space that consumes in the ROM) If this helps, I've been using the offsets, A00000 for overworld edits, and NPC/warp additions, and 800000 for scripting.

    Any help is appreciated. :D
     
    Last edited:
    Hiya! Editing existing scripts and recompiling them isn't the right way to go about it - as you've already noticed, there's a very high chance you'll overwrite something elsewhere.

    The second way you've mentioned (if you have been doing this) is the correct way to do it.

    Don't worry about running out of free space : ) you have plenty to work with. In the unlikely event that you somehow manage to use it all up, there's always the option of expanding your ROM to 32mb, but as I said, it's fairly unlikely that you'd need to do this. I hope that helps!
     
    Hiya! Editing existing scripts and recompiling them isn't the right way to go about it - as you've already noticed, there's a very high chance you'll overwrite something elsewhere.

    The second way you've mentioned (if you have been doing this) is the correct way to do it.

    Don't worry about running out of free space : ) you have plenty to work with. In the unlikely event that you somehow manage to use it all up, there's always the option of expanding your ROM to 32mb, but as I said, it's fairly unlikely that you'd need to do this. I hope that helps!

    Thankyou very much for the help, the method I actually use for compiling scripts, is very similar, except I use Batch Compiler, instead of the Compile button, and I select one script at a time to insert, it for some reason has it greyed out, I think you have to load the ROM in XSE to compile it, but I don't do that, I don't know why not. :D But, another issue is in general, let's say I wanted to edit the script where Oak will take you to his lab, how would I edit the dialogue there, is it the same process, or would I need to do something else? I'm sorry this may sound so, stupid, or so, but I really can't script that good, I mean, I know how to do basic trainerbattle, giveitem and msgbox scripts, and that's about it. :)
     
    Thankyou very much for the help, the method I actually use for compiling scripts, is very similar, except I use Batch Compiler, instead of the Compile button, and I select one script at a time to insert, it for some reason has it greyed out, I think you have to load the ROM in XSE to compile it, but I don't do that, I don't know why not. :D But, another issue is in general, let's say I wanted to edit the script where Oak will take you to his lab, how would I edit the dialogue there, is it the same process, or would I need to do something else? I'm sorry this may sound so, stupid, or so, but I really can't script that good, I mean, I know how to do basic trainerbattle, giveitem and msgbox scripts, and that's about it. :)

    No need to apologise, don't worry! I've only ever used the batch compiler a handful of times and last time was ages ago so I'm not too familiar with it nowadays haha. If it's just the text and nothing else that you want to edit, leaving the rest of the script exactly as-is otherwise, you could give this a go:

    Open your ROM in AdvanceMap, then open the script you want to edit. So Oak's one where it takes you to his lab looks like:

    Code:
    #org 0x1655F9
    lockall
    setvar 0x4001 0x1
    goto 0x8165605
    
    '---------------
    #org 0x165605
    setvar 0x8004 0x0
    setvar 0x8005 0x2
    special 0x174
    textcolor 0x0
    pause 0x1E
    playsong 0x12E 0x0
    preparemsg 0x817D72C '"OAK: Hey! Wait!\nDon't go out!"
    waitmsg
    pause 0x55
    closeonkeypress
    applymovement MOVE_PLAYER 0x81A75ED
    waitmovement 0x0
    sound 0x15
    applymovement MOVE_PLAYER 0x81A75DB
    waitmovement 0x0
    pause 0x1E
    showsprite 0x3
    compare 0x4001 0x0
    if 0x1 call 0x81656B8
    compare 0x4001 0x1
    if 0x1 call 0x81656C3
    pause 0x1E
    msgbox 0x817D74A MSG_KEEPOPEN '"OAK: It's unsafe!\nWild POKéMON li..."
    closeonkeypress
    pause 0x1E
    compare 0x4001 0x0
    if 0x1 call 0x81656CE
    compare 0x4001 0x1
    if 0x1 call 0x81656E0
    setdooropened 0x10 0xD
    doorchange
    applymovement 0x3 0x816572E
    applymovement MOVE_PLAYER 0x8165758
    waitmovement 0x0
    setdoorclosed 0x10 0xD
    doorchange
    setvar 0x4055 0x1
    clearflag 0x2B
    setvar 0x4050 0x1
    setflag 0x2C
    setflag 0x4001
    warp 0x4 0x3 0xFF 0x6 0xC
    waitstate
    releaseall
    end

    You would just replace the relevant pointers with your own and add a dynamic offset to the beginning. Changes in red:

    Code:
    [COLOR="Red"]#dynamic 0x800000
    
    #org @main[/COLOR]
    lockall
    setvar 0x4001 0x1
    [COLOR="red"]goto @start[/COLOR]
    
    [COLOR="red"]#org @start[/COLOR]
    setvar 0x8004 0x0
    setvar 0x8005 0x2
    special 0x174
    textcolor 0x0
    pause 0x1E
    playsong 0x12E 0x0
    [COLOR="red"]preparemsg @YourNewMessage1[/COLOR]
    waitmsg
    pause 0x55
    closeonkeypress
    applymovement MOVE_PLAYER 0x81A75ED
    waitmovement 0x0
    sound 0x15
    applymovement MOVE_PLAYER 0x81A75DB
    waitmovement 0x0
    pause 0x1E
    showsprite 0x3
    compare 0x4001 0x0
    if 0x1 call 0x81656B8
    compare 0x4001 0x1
    if 0x1 call 0x81656C3
    pause 0x1E
    [COLOR="red"]msgbox @YourNewMessage2 MSG_KEEPOPEN[/COLOR]
    closeonkeypress
    pause 0x1E
    compare 0x4001 0x0
    if 0x1 call 0x81656CE
    compare 0x4001 0x1
    if 0x1 call 0x81656E0
    setdooropened 0x10 0xD
    doorchange
    applymovement 0x3 0x816572E
    applymovement MOVE_PLAYER 0x8165758
    waitmovement 0x0
    setdoorclosed 0x10 0xD
    doorchange
    setvar 0x4055 0x1
    clearflag 0x2B
    setvar 0x4050 0x1
    setflag 0x2C
    setflag 0x4001
    warp 0x4 0x3 0xFF 0x6 0xC
    waitstate
    releaseall
    end
     
    No need to apologise, don't worry! I've only ever used the batch compiler a handful of times and last time was ages ago so I'm not too familiar with it nowadays haha. If it's just the text and nothing else that you want to edit, leaving the rest of the script exactly as-is otherwise, you could give this a go:

    Open your ROM in AdvanceMap, then open the script you want to edit. So Oak's one where it takes you to his lab looks like:

    Code:
    #org 0x1655F9
    lockall
    setvar 0x4001 0x1
    goto 0x8165605
    
    '---------------
    #org 0x165605
    setvar 0x8004 0x0
    setvar 0x8005 0x2
    special 0x174
    textcolor 0x0
    pause 0x1E
    playsong 0x12E 0x0
    preparemsg 0x817D72C '"OAK: Hey! Wait!\nDon't go out!"
    waitmsg
    pause 0x55
    closeonkeypress
    applymovement MOVE_PLAYER 0x81A75ED
    waitmovement 0x0
    sound 0x15
    applymovement MOVE_PLAYER 0x81A75DB
    waitmovement 0x0
    pause 0x1E
    showsprite 0x3
    compare 0x4001 0x0
    if 0x1 call 0x81656B8
    compare 0x4001 0x1
    if 0x1 call 0x81656C3
    pause 0x1E
    msgbox 0x817D74A MSG_KEEPOPEN '"OAK: It's unsafe!\nWild POKéMON li..."
    closeonkeypress
    pause 0x1E
    compare 0x4001 0x0
    if 0x1 call 0x81656CE
    compare 0x4001 0x1
    if 0x1 call 0x81656E0
    setdooropened 0x10 0xD
    doorchange
    applymovement 0x3 0x816572E
    applymovement MOVE_PLAYER 0x8165758
    waitmovement 0x0
    setdoorclosed 0x10 0xD
    doorchange
    setvar 0x4055 0x1
    clearflag 0x2B
    setvar 0x4050 0x1
    setflag 0x2C
    setflag 0x4001
    warp 0x4 0x3 0xFF 0x6 0xC
    waitstate
    releaseall
    end

    You would just replace the relevant pointers with your own and add a dynamic offset to the beginning. Changes in red:

    Code:
    [COLOR="Red"]#dynamic 0x800000
    
    #org @main[/COLOR]
    lockall
    setvar 0x4001 0x1
    [COLOR="red"]goto @start[/COLOR]
    
    [COLOR="red"]#org @start[/COLOR]
    setvar 0x8004 0x0
    setvar 0x8005 0x2
    special 0x174
    textcolor 0x0
    pause 0x1E
    playsong 0x12E 0x0
    [COLOR="red"]preparemsg @YourNewMessage1[/COLOR]
    waitmsg
    pause 0x55
    closeonkeypress
    applymovement MOVE_PLAYER 0x81A75ED
    waitmovement 0x0
    sound 0x15
    applymovement MOVE_PLAYER 0x81A75DB
    waitmovement 0x0
    pause 0x1E
    showsprite 0x3
    compare 0x4001 0x0
    if 0x1 call 0x81656B8
    compare 0x4001 0x1
    if 0x1 call 0x81656C3
    pause 0x1E
    [COLOR="red"]msgbox @YourNewMessage2 MSG_KEEPOPEN[/COLOR]
    closeonkeypress
    pause 0x1E
    compare 0x4001 0x0
    if 0x1 call 0x81656CE
    compare 0x4001 0x1
    if 0x1 call 0x81656E0
    setdooropened 0x10 0xD
    doorchange
    applymovement 0x3 0x816572E
    applymovement MOVE_PLAYER 0x8165758
    waitmovement 0x0
    setdoorclosed 0x10 0xD
    doorchange
    setvar 0x4055 0x1
    clearflag 0x2B
    setvar 0x4050 0x1
    setflag 0x2C
    setflag 0x4001
    warp 0x4 0x3 0xFF 0x6 0xC
    waitstate
    releaseall
    end

    Oh, ok, Thankyou once again, this is perfect, this is really helpful to me. I'll test it out right now! :D
     
    Back
    Top