• 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!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • Red, Hilda, Paxton, or Kellyn - 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.

Script Help Thread (DO NOT REQUEST SCRIPTS)

Status
Not open for further replies.
You may be pointing everything to the same offset, causing corruptions. Try repointing everything again

ok well i try that and ill try xse. ill report back my findings.

OK well i couldnt get it working so im going to try a patched rom to delete every script.
 
Last edited by a moderator:
Code:
#dynamic 0x720000
#org @start
special 0x188
lock
faceplayer
checksound
cry pkmn_pikachu 0x2
preparemsg @msg1 '"PIKACHU: PIKA!"
waitmsg
waitcry
pause 0x14
waitkeypress
setwildbattle pkmn_pikachu 0x5 0x1
setflag 0x807
special 0x138
waitstate
clearflag 0x807
special2 LASTRESULT 0xB4
compare LASTRESULT 0x1
if 0x1 goto @1
compare LASTRESULT 0x4
if 0x1 goto @2
compare LASTRESULT 0x5
if 0x1 goto @2
setflag 0x3B8
release
end

'---------------
#org @1
setflag 0x3B8
fadescreen 0x1
hidesprite LASTTALKED
fadescreen 0x0
release
end

'---------------
#org @2
fadescreen 0x1
hidesprite LASTTALKED
fadescreen 0x0
msgbox @msg2 MSG_KEEPOPEN '"The PIKACHU ran away!"
release
end


'---------
' Strings
'---------
#org @msg1
= Mew!

#org @msg2
= The PIKACHU ran away!

Okay, I tested the script, and here's what happens - when I defeat the Pikachu, it vanishes after the battle as it should, but it doesn't say 'The PIKACHU ran away!'

And when I catch it, it doesn't vanish at all until I leave the map and come back.

Also, the Ruby/Sapphire tainer battle music played during the battle for some reason.

EDIT:
Hmm... interesting - if I run away from the battle, the 'The PIKACHU ran away!' message does come up
 
Last edited:
Code:
#dynamic 0x720000
#org @start
special 0x188
lock
faceplayer
checksound
cry pkmn_pikachu 0x2
preparemsg @msg1 '"PIKACHU: PIKA!"
waitmsg
waitcry
pause 0x14
waitkeypress
setwildbattle pkmn_pikachu 0x5 0x1
setflag 0x807
[COLOR="Red"]special 0x138[/COLOR]
waitstate
clearflag 0x807
special2 LASTRESULT 0xB4
[COLOR="red"]compare LASTRESULT 0x1[/COLOR]
if 0x1 goto @1
[COLOR="red"]compare LASTRESULT 0x4[/COLOR]
if 0x1 goto @2
[COLOR="red"]compare LASTRESULT 0x5[/COLOR]
if 0x1 goto @2
setflag 0x3B8
release
end

'---------------
#org @1
setflag 0x3B8
fadescreen 0x1
hidesprite LASTTALKED
fadescreen 0x0
release
end

'---------------
#org @2
fadescreen 0x1
hidesprite LASTTALKED
fadescreen 0x0
msgbox @msg2 MSG_KEEPOPEN '"The PIKACHU ran away!"
release
end


'---------
' Strings
'---------
#org @msg1
= Mew!

#org @msg2
= The PIKACHU ran away!

Okay, I tested the script, and here's what happens - when I defeat the Pikachu, it vanishes after the battle as it should, but it doesn't say 'The PIKACHU ran away!'

And when I catch it, it doesn't vanish at all until I leave the map and come back.

Also, the Ruby/Sapphire tainer battle music played during the battle for some reason.

EDIT:
Hmm... interesting - if I run away from the battle, the 'The PIKACHU ran away!' message does come up

Ok, look at the red. Remove the special 0x138. The music should be normal now. at the red compares, 1 seems to mean defeat. not @1, but the 1 next to lastresult. So make it load @2. 4 and 5.. either one of those could be that you ran. try messing with it and see which it is.
 
hi guys, so my script finally works... kinda... my problem now is that it only works when the flag has been set (0x20B), when the flag isnt set, only the player gets stuck as though its on lock but the game resumes (people moving and music still playing)... how can i fix this?? this is my script... this is a level script btw [Validates values, loads handler to 0x03000EB0 (playback) [02]...also forgot to mention it's in pallet town and i need the other built in scripts in pallet town to stay as they are...

Spoiler:
 
Last edited:
Spoiler:

Okay, so. I just tried making the first pokemon give script I've ever done. When I test ingame though, all that happens is I get a load of weird characters with a yes/no message. A pokemon is given, however it's a Lv5 Surskit and not Porygon. And the text is completely indistinguishable. Anyone know my problem?
 
Spoiler:

Okay, so. I just tried making the first pokemon give script I've ever done. When I test ingame though, all that happens is I get a load of weird characters with a yes/no message. A pokemon is given, however it's a Lv5 Surskit and not Porygon. And the text is completely indistinguishable. Anyone know my problem?

Well for starters you're gonna want a "lock" in the beginning, otherwise your "release" won't have anything to release. :P

Also I'd highly recommend NOT to use 29F6C8 because that is data that's most likely in use and altering can cause some crazy shenanigans (probably those wonky characters you're getting. Use offsets 800000 and above, as those are all free space.

And lastly, when using the givepokemon command, you have to use the Hex number of the pokemon, 137 is Porygon's Decimal number. I believe XSE has a very simply calculator on the right side that can convert dec to hex.

tl;dr Include a lock in the beginning, use dynamic 0x800000 instead of your other one, and replace the 137 to a 89
 
Ok, look at the red. Remove the special 0x138. The music should be normal now. at the red compares, 1 seems to mean defeat. not @1, but the 1 next to lastresult. So make it load @2. 4 and 5.. either one of those could be that you ran. try messing with it and see which it is.

Code:
#dynamic 0x800000
#org @start
special 0x187
compare LASTRESULT 0x2
if 0x1 goto @3
special 0x188
lock
faceplayer
setwildbattle 25 5 1
checksound
cry 25 0x2
preparemsg @roar '"PIKACHU: PIKA!"
waitmsg
waitcry
pause 0xA
playsong 0x156 0x0
waitkeypress
setflag 0x807
special 0x138
waitstate
clearflag 0x807
special2 LASTRESULT 0xB4
compare LASTRESULT 0x1
if 0x1 goto @1
compare LASTRESULT 0x4
if 0x1 goto @2
compare LASTRESULT 0x5
if 0x1 goto @2
hidesprite 0x800F
setflag 0x3E1
release
end

'---------------
#org @3
release
end

'---------------
#org @1
setflag 0x3E1
goto @4

'---------------
#org @2
setvar 0x8004 0x19
goto @5

'---------------
#org @4
fadescreen 0x1
hidesprite 0x800F
fadescreen 0x0
release
end

'---------------
#org @5
fadescreen 0x1
hidesprite 0x800F
fadescreen 0x0
bufferpokemon 0x0 0x8004
msgbox @nocatch MSG_KEEPOPEN '"The [buffer1] ran away!"
release
end 


'---------
' Strings
'---------
#org @roar
= PIKACHU: PIKA!

#org @nocatch
= The PIKACHU ran away!
This works almost the way I want it too; I click on the event sprite, a text box with its cry pops up & the encounter music starts playing, I click & the battle initiates.

If I defeat it in battle, its sprite disappears after the battle (while the screen performs the fading effect). If I flee the battle, the same happens but plus a textbox saying the Pokémon ran away.

So far so good.

That leaves two things unrealized:

If I catch the Pokémon, the sprite also disappears after the battle, but if I catch it I want its sprite to already be gone when the battle screen disappears and the normal screen comes back up. You said you didn't know a way to do that, yet it happens with all Legendaries in the game, so there must be a way to make it work like that. However, I have examined Articuno's code, and there seems to be nothing in it that actually does that, which is why it also doesn't happen with my script (correct me if I'm wrong), so I'm wondering why it behaves like that for Articuno and the others, then.

Also, the music is again Ruby/Sapphire's trainer battle music. You said to remove the 'special 0x138' to make the music normal again, but I need the 'special 0x138' for the pixellate effect when the battle starts. Still it's weird because the Legendaries in the game also use the 'special 0x138' effect yet their music isn't Ruby/Sapphire's trainer music, but a special version of the default Fire Red wild battle music, which for the life of me I can't seem to figure out how to recreate in my script. Surely there must be a way to assign a certain music track to the battle?

Maybe for the battle music, and the fact that upon catching the event Pokémon the sprite is already gone when the battle fades and the world comes back into view, maybe the devs created a separate script
for those two things and applied it to all Legendaries in the game somehow.
 
Last edited:
Hi. So, I'm kind of new to scripting, and I'm having a huge issue over a simple line that I added to a script. I'm making a hack of Pokemon Emerald, and I wanted to make it that your mum gives you the Acro Bike as well as the Running Shoes. So, I found the script, and then under the Running Shoes part I added this:

msgbox @bike 0x2
giveitem 0x0110 0x0 msg_obtain

And then I put this as the message:

#org @bike
= Here. Your dad and I both chipped\nin to buy you this too. Its an\lAcro Bike, and it should help\lspeed up your journey.

I've been using the tutorials over on Reddit Pokemon Hacks, and so far, everything has been working fine for me.

So, when I put this in, I was following the tutorial exactly as it says, but then, when I clicked debug, it pops up with this error: Error 13 "Type mismatch" on Line 44. Missing #define.

Here is a copy of the full script:

Spoiler:


If someone could please help me, I would greatly appreciate it.
 
Hi. So, I'm kind of new to scripting, and I'm having a huge issue over a simple line that I added to a script. I'm making a hack of Pokemon Emerald, and I wanted to make it that your mum gives you the Acro Bike as well as the Running Shoes. So, I found the script, and then under the Running Shoes part I added this:

msgbox @bike 0x2
giveitem 0x0110 0x0 msg_obtain

And then I put this as the message:

#org @bike
= Here. Your dad and I both chipped\nin to buy you this too. Its an\lAcro Bike, and it should help\lspeed up your journey.

I've been using the tutorials over on Reddit Pokemon Hacks, and so far, everything has been working fine for me.

So, when I put this in, I was following the tutorial exactly as it says, but then, when I clicked debug, it pops up with this error: Error 13 "Type mismatch" on Line 44. Missing #define.

Here is a copy of the full script:

Spoiler:


If someone could please help me, I would greatly appreciate it.

The error message you are receiving is saying that there something which XSE doesn't recognise as a command/ parameter in your 'giveitem 0x0110 0x0 msg_obtain' line. The particular part of this line which is causing the error is the 'msg_obtain' part. Unlike the other parameters in this line, msg_obtain is an alias that makes it easier for human read what is happening but it isn't automatically recognised by XSE. To fix this you have two options. Firstly, you can simply change msg_obtain to 0x0 or you can add '#include "std.rbh" ' at the start of your script with your #dynamic command. Note that the second solution will only work if you have the std.rbh file in your XSE's folder.

Also, you shouldn't be using the 0x800000 offset as a starting point for your dynamic pointer when you're working with Pokemon Emerald. You should use 0x9C0B20 instead as that's where Emerald's free space begins. You can read this thread for some more info. You will also have to change your '0x1E8693' static pointers to dynamic ones as you have added two extra lines to its length, meaning that it has/ will probably overwrite data which was already in the ROM.
 
Hey guys, having some bother with a pretty basic script.

Spoiler:


So basically, all I want this script to do is make a Sprite do the exclamation mark movement (!), then display some text then make the player sprite take a step a step back.
Strange thing is, the exclamation mark displays then the player sprite steps back. But no message. I can't figure it out, any suggestions/help?
 
Whenever I battle the Onix, I take a step and the OverWorld reappears again allowing me to battle it
Spoiler:
 
Hi all! Just realised I posted this question before but in the wrong thread.


I am having a weird issue with this script - it was designed to have the player move to a scene, move the camera over to the scene, then move back (basically). Instead, it plays everything out just fine, BUT the camera-move. Also, I'm finding that some OWs aren't showing up on the map?
I am aware of the specials needed for moving-camera, and they are already in my script, which is why I'm confused that it isn't working. Does anyone have any idea why this might be happening?


Spoiler:



I really need this script to work as it's a big part of the storyline =/ can't replace it with something else.
 
Whenever I battle the Onix, I take a step and the OverWorld reappears again allowing me to battle it
Spoiler:


I suggest making the changes in bold =) also make sure the onix OW's Person ID box is 0200!
 
Whenever I battle the Onix, I take a step and the OverWorld reappears again allowing me to battle it
Did you make sure in Advance Map that the Person ID of Onix is 200?
If you did and Onix still reappears, try putting the hidesprite command after the setflag command.
Also, for better estethic, hidesprite 0x0 should come after hidesprite and setflag.

@avaramoon, can you describe which part of moving camera doesn't work? I think, but I am not sure at all, that it is because you are trying to move the camera OR you are trying to use special 0x113 (OR both) between fadescreen 0x1 and fadescreen 0x0.
As for OWs not showing up, there is a limit of 16 (iirc) that you can see on a map at a time.
 
Last edited:
Make sure the Unknown above Movement Type in Advance Map is set to 03 not 00. The person I.D should be the same as the flag you set, 0200. Try using a different flag such as 1000 as 200 might be used already in the game.
 
Status
Not open for further replies.
Back
Top