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

[Script] My game keeps crashing when I write a script!

15
Posts
6
Years
  • Age 27
  • Seen Feb 27, 2020
I'm hacking Pokemon emerald, and this is a pretty recent issue. I have been hacking this rom for weeks trying to make every pokemon from gen 1-4 all obtainable. I have customized legendary scripts, custom NPC's that give hints, npc's that give pokemon, etc... I have been entering scripts and npc's for weeks to get this done. I now have three pokemon left to add: Manaphy, Cresselia, and Arceus. Every pokemon besides these three are obtainable (aside from phione because that will be done by breeding manaphy). But every time I insert a script to battle any of these pokemon, my rom breaks. The game wont even load. Luckily i have backups, but I don't know why it's doing it. I though it might be an offset issue at first. Like maybe i'm overriding important data on accident. So i used the "#dyn 740000 #org @start" format so it would create its own offsets, and it was still crashing. Then I thought it was the pokemon because every other npc has been fine up to this point. So for testing purposes I creating an arceus script, but encountering bulbasaur instead. That still broke the game. My last guess is maybe I've reached the limit on how much could be in the game? Like maybe there are no more unused offsets to create? But there's no way that's right. That seems crazy to me! But I don't know what else to do. And it's not just this specific script. Any script I write from scratch breaks the rom now. Unless I use PKSV's script generator. The scripts that it generates don't crash the game, but they never work, so I don't use them. But i'm writing scripts the same way I have been writing them for weeks. But all of the sudden, any time I try to add one, the rom breaks. The game doesn't load, or it loads with sprites and text all over the screen looking wonky.
 

TheBatPrince

Banned
76
Posts
4
Years
I'm hacking Pokemon emerald, and this is a pretty recent issue. I have been hacking this rom for weeks trying to make every pokemon from gen 1-4 all obtainable. I have customized legendary scripts, custom NPC's that give hints, npc's that give pokemon, etc... I have been entering scripts and npc's for weeks to get this done. I now have three pokemon left to add: Manaphy, Cresselia, and Arceus. Every pokemon besides these three are obtainable (aside from phione because that will be done by breeding manaphy). But every time I insert a script to battle any of these pokemon, my rom breaks. The game wont even load. Luckily i have backups, but I don't know why it's doing it. I though it might be an offset issue at first. Like maybe i'm overriding important data on accident. So i used the "#dyn 740000 #org @start" format so it would create its own offsets, and it was still crashing. Then I thought it was the pokemon because every other npc has been fine up to this point. So for testing purposes I creating an arceus script, but encountering bulbasaur instead. That still broke the game. My last guess is maybe I've reached the limit on how much could be in the game? Like maybe there are no more unused offsets to create? But there's no way that's right. That seems crazy to me! But I don't know what else to do. And it's not just this specific script. Any script I write from scratch breaks the rom now. Unless I use PKSV's script generator. The scripts that it generates don't crash the game, but they never work, so I don't use them. But i'm writing scripts the same way I have been writing them for weeks. But all of the sudden, any time I try to add one, the rom breaks. The game doesn't load, or it loads with sprites and text all over the screen looking wonky.

Haha, is it possible the Legendary Beasts you speak of perhaps are Cursed? Like the Paintings that Maximillion painted in Yu-Gi-Oh of the Egyptian God Cards? :D.

Jokes aside, what is it you're saying? That upon clicking Continue Game, the game doesn't Load? Or, when you try to even Boot the ROM, it won't even show the beginning "Game Freak" Splash?

I am a very good Programmer, if you can give a sample of the Code you use to generate your Custom Pokemon, I can help you! I'm guessing that "org" command is the word "Organize"? Or is it like a Directive to the Compiler (assuming it's a Compiled Language) from Assembly, that "ORG" command? I think it was a Directive...but if you can provide the name of the Language that the Game uses, I could search for you.

Try to launch the Game at each key point of Code, until you find the one that is causing the problem. So if you've got 5 lines of Code for the insertions of these new Pokemon, try to run it first without the 5 lines to confirm if the other Pokemon are okay. Then, 1 line at a time, try to Debug what is happening. But, you're saying you tried to simulate a Wild Battle with an Arceus appearing? And Bulbasaur came instead? If the Game Broke at that point, it likely is somehow your insertion of Arceus that's doing it. But, it's happening in the Background things independant of whether or not it actually fully registers on Screen. Some things to check for, are if the Bulbasaur is still named Bulbasaur, if it uses Arceus-like Attacks, or try to catch it and check if its Stats are Arceus. It could be overlapping Pokemon, otherwise if it's just a standard Bulbasaur, you know it's purely Background.

If you're saying there's no way that's right for File Size, maybe you are right. Check anyway.

EDIT: Just saw the part about wonky images. It's something to do not with the Battle Engine, or even the Event Dialogue Engine I believe. It's something earlier in the Code that isn't registering in the Game Files for some reason.
 
15
Posts
6
Years
  • Age 27
  • Seen Feb 27, 2020
I'm guessing that "org" command is the word "Organize"? Or is it like a Directive to the Compiler (assuming it's a Compiled Language) from Assembly, that "ORG" command? I think it was a Directive...but if you can provide the name of the Language that the Game uses, I could search for you.

Try to launch the Game at each key point of Code, until you find the one that is causing the problem. So if you've got 5 lines of Code for the insertions of these new Pokemon, try to run it first without the 5 lines to confirm if the other Pokemon are okay. Then, 1 line at a time, try to Debug what is happening.

First of all, I really do appreciate the response!

The "#org" probably stands for "organize" but i really don't know. As far as i know, it's how every script is started. So each event starts with "#org" followed by the seven string offset number (0x83d7r13 for instance). This is what "titles" the event. That's how I view it anyway as the only thing I know about this game language is what i've studied by looking at other scripts in the game. Every event needs to have an offset so the game knows what script to call at certain parts of game. I don't know the name of the language used by the game unfortunately. I just know what i've studied in the game.

I have managed to work my way up to building a script. It kept breaking, and I assumed it was a million different things, so I started from the basics. I set up the most basic line of code. Nothing happening. Just a command for opening the script, and a command for closing the script. I then added a test message box. With the text "Test Message." And that worked. I then added the pokemon cry. That was fine. I slowly added more and more to the script. I am at the point now where I have the 3 battles I want. I have everything the way I need. But for some reason, I cannot get the message boxes to say what I want them to say. If you want the script I made line for line, here it is:
Code:
#org 0x82E9F11
'-----------------------------------
lock
faceplayer
checkflag 0x864
if true jump 0x82E9F31 ' Flag is set
msgbox 0x82E9F51 ' Hello. I am writing ...
callstd MSG_LOCK ' Built-in lock command
release
end

#org 0x82E9F31
'-----------------------------------
lock
faceplayer
checkflag 0x44
if false jump 0x8869838 ' Flag is unset
release
end

#org 0x8869838
'-----------------------------------
lock
faceplayer
showpokepic 0x223 0xA 0x3
msgbox 0x82E9F71 ' Test Message 2.
callstd MSG_LOCK ' Built-in lock command
checksound
cry 0x223 0x2
waitcry
pause 0x14
hidepokepic
battle 0x223 80 NONE
setflag 0x807
special BATTLE_PIXELLATE2
waitspecial
clearflag 0x807
setflag 0x44
release
end


#org 0x82E9F51
= Hello.\nI am writing a test message to the\nmessage box.

#org 0x82E9F71
= Test Message 2.
I typed this in my script editor just to test what will happen to my text in the message box. As far as I know, everything I've typed out here is exactly the right format and exactly how it needs to be. However, when I compile the script and open it again to double check my work, the message box changes what I typed out. It looks like this after I compile the script:
Code:
#org 0x82E9F51
= Hello.\nI am writing a test messaTest Message 2.

#org 0x82E9F71
= Test Message 2.
It reflects this wonky message in game as well. It just compiled weird. usually that's an issue with my commands or I had a typo or something. But I don't know what the problem is. If I type anything out that's more than 40 characters, it deletes everything after those first 40 characters and replaces it with the other message box text. It's super strange. Thanks again, if you can't help me specifically I understand. I'll figure something else out if anything.
 

TheBatPrince

Banned
76
Posts
4
Years
Sorry for Double Posting, I see 2 Notifications for a post from you I think, but I do not see the Messages here.

Maybe it's a Network Glitch.
 
Back
Top