The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary ROM Hacking (https://www.pokecommunity.com/forumdisplay.php?f=284)
-   -   Script How should I approach editing pre-existing scripts in Fire Red? (https://www.pokecommunity.com/showthread.php?t=417581)

Ace Trainer Slash January 26th, 2019 6:38 PM

How should I approach editing pre-existing scripts in Fire Red?
 
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

Avara January 26th, 2019 6:56 PM

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!

Ace Trainer Slash January 26th, 2019 7:08 PM

Quote:

Originally Posted by Avara (Post 9972652)
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. :)

Avara January 27th, 2019 7:54 AM

Quote:

Originally Posted by Ace Trainer Slash (Post 9972658)
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:

#dynamic 0x800000

#org @main
lockall
setvar 0x4001 0x1
goto @start

#org @start
setvar 0x8004 0x0
setvar 0x8005 0x2
special 0x174
textcolor 0x0
pause 0x1E
playsong 0x12E 0x0
preparemsg @YourNewMessage1
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 @YourNewMessage2 MSG_KEEPOPEN
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



Ace Trainer Slash January 27th, 2019 1:35 PM

Quote:

Originally Posted by Avara (Post 9972840)
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:

#dynamic 0x800000

#org @main
lockall
setvar 0x4001 0x1
goto @start

#org @start
setvar 0x8004 0x0
setvar 0x8005 0x2
special 0x174
textcolor 0x0
pause 0x1E
playsong 0x12E 0x0
preparemsg @YourNewMessage1
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 @YourNewMessage2 MSG_KEEPOPEN
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

Avara January 27th, 2019 1:36 PM

No bother at all, I hope you get on ok! <3

Ace Trainer Slash January 27th, 2019 1:38 PM

Quote:

Originally Posted by Avara (Post 9972984)
No bother at all, I hope you get on ok! <3

Thanks! I will. :)


All times are GMT -8. The time now is 9:13 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.