• 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 Help Thread (DO NOT REQUEST SCRIPTS)

Status
Not open for further replies.
So this happens to me all the freaking time when i'm adding new text in my pokémon firered rom hack. Any solution to this?

It doesn't happen when I edit texts, only when I add new ones.

https://youtu.be/jj1Jdjv9_BM

For text adding, I'd strongly suggest using a script editor like XSE. All you'd need to do is:
Code:
#org 0x[address to insert]
= Write your raw text here.
Or if you want it to just go to the first available free space:
Code:
#dynamic 0x[address to start looking for free space]
#org @anylabelhere
= Write your raw text here.
Line breaks are done with \n, so it would look like:

Code:
#org 0x[address to insert]
= This is test line 1.\nThis is test line 2.
Would come out:
This is test line 1.
This is test line 2.

And it even has a built in text adjuster (ctrl-t) that will do line breaks and special characters for you.

After it's inserted you just point to the text in your script like you would normally.
 
For text adding, I'd strongly suggest using a script editor like XSE. All you'd need to do is:
Code:
#org 0x[address to insert]
= Write your raw text here.
Or if you want it to just go to the first available free space:
Code:
#dynamic 0x[address to start looking for free space]
#org @anylabelhere
= Write your raw text here.
Line breaks are done with \n, so it would look like:

Code:
#org 0x[address to insert]
= This is test line 1.\nThis is test line 2.
Would come out:
This is test line 1.
This is test line 2.

And it even has a built in text adjuster (ctrl-t) that will do line breaks and special characters for you.

After it's inserted you just point to the text in your script like you would normally.

I'll try that, but I'll have to find a tutorial first because I'm not used to scripting and what you're saying (like adress to insert, etc.) is like Chinese to me :D
 
yeah that's what i was trying for ages but setting flags there always ended up in some kind of glitch, but turns out i was setting it at the wrong place... now my flag works :)... but none of my scripts do -.-... him walking to you doesn't work (tried every type of script type in header view, even tried to incorporate it in the current scripts), him simply appearing at a spot for you to talk to doesn't work either (header view again), and my level scripts, the ones preventing you from actually leaving pallet town don't work either -.-

amap puts header scripts in wrong... you can open the header script in pksv (or whatever u use) and change an FFFF byte to 0 and itll work... if you search this forum
For how to make level scripts you can find a thread with a tutorial on doing this. It should fix ur level script
 
Code:
...
givepokemon [COLOR=Red]0x304[/COLOR] 0x5 0x0 0x0 0x0 0x0
...
Converting the hex number 0x304 to decimal, and you get 772.
There is no PKMN (in the 3rd gen games) that has that number.
If you are confused with hex numbers, then I suggest you simply type...

Code:
givepokemon [COLOR=red]304[/COLOR] 0x5 0x0 0x0 0x0 0x0
...and XSE will automatically convert decimal numbers into hex.

Code:
...
fanfare 0x13E
msgbox @2 [COLOR=Blue]0x4[/COLOR]
waitfanfare
closeonkeypress
...
If you are going to use the [closeonkeypress] command, the message should be 0x4 instead of 0x6.



Check that map if it has level scripts that moves the NPC elsewhere in the map.

Using that script works properly, I did remove the @done flag because I wanted the situation to be different. The script has nothing wrong with it; however, the NPC is still not placed in the right position. There are no other scripts on this map. Here is a pic:

www.gyazo.com/14c65c45da021c688a3496245b4b9ce0

Red denotes where the person should be, blue is where it is when tested in an emulator.

I am using a ROM base just for testing (the final game won't have a ROM base), so is that possibly the case?
 
Last edited by a moderator:
Using that script works properly, I did remove the @done flag because I wanted the situation to be different. The script has nothing wrong with it; however, the NPC is still not placed in the right position. There are no other scripts on this map. Here is a pic:

www.gyazo.com/14c65c45da021c688a3496245b4b9ce0

Red denotes where the person should be, blue is where it is when tested in an emulator.

I am using a ROM base just for testing (the final game won't have a ROM base), so is that possibly the case?

I cannot seem to view the image. Upload it to tinypic.com or any other image-hosting sites.
Also, I hope you don't mind me asking, but do you know what I meant when I ask you to check if the map had level scripts?
Your map probably has a level script that is moving the NPC elsewhere in the map.
 
I cannot seem to view the image. Upload it to tinypic.com or any other image-hosting sites.
Also, I hope you don't mind me asking, but do you know what I meant when I ask you to check if the map had level scripts?
Your map probably has a level script that is moving the NPC elsewhere in the map.

I'll edit this post later with an image as I am not home at this moment.

Although I feel embarrassed by saying this, I don't know how to check for level scripts ._.

I know that there are no script tiles on the 'Events' tab shown on my map, but I doubt that has to do with level scripts if it is still doing that.

How do I check for these and remove them?
 
I'll edit this post later with an image as I am not home at this moment.

Although I feel embarrassed by saying this, I don't know how to check for level scripts ._.

I know that there are no script tiles on the 'Events' tab shown on my map, but I doubt that has to do with level scripts if it is still doing that.

How do I check for these and remove them?

Level scripts are found in the tab marked "Header" in Advance-Map, under the section named "Map script." It should be self-explanatory from there.
 
Hi everyone

I'm experimenting with creating wild battle scripts in Fire Red.

I'm using a lv5 Pikachu for the experiment. The code I have so far is this:
Code:
#dynamic 0x800000

#org @start
lock
faceplayer
cry 25 0
msgbox @roar 0x6
waitcry
wildbattle 25 5 1
hidesprite 0x800F
setflag 0x3B8
release
end

#org @roar
= PIKACHU: PIKA!

This, does work, but not in the exact way I'd like it to. What happens is - I click on its OW sprite and it says its 'PIKA!' message, then the battle initiates. After I defeat or catch it, the battle screen disappears and I'm back in the overworld, and then its sprite disappears.

However, this is only partially what I want. This outcome does work in the event that I defeat the Pikachu, but if I catch it instead, I want its OW sprite to be already gone by the time I return to the overworld from the battle screen, which is also how it works with the game's default Legendaries.

Does anyone know how to do this?

EDIT: Almost forgot - I would like for different music to start playing once you click on the event's OW sprite, like it also does with the Legendary encounters in the game, and use different music for the battle itself instead of the game's default wild battle music.

Any help would be greatly appreciated. Thanks in advance! :)
 
Last edited:
Hi everyone

I'm experimenting with creating wild battle scripts in Fire Red.

I'm using a lv5 Pikachu for the experiment. The code I have so far is this:
Code:
#dynamic 0x800000

#org @start
lock
faceplayer
cry 25 0
msgbox @roar 0x6
waitcry
wildbattle 25 5 1
hidesprite 0x800F
setflag 0x3B8
release
end

#org @roar
= PIKACHU: PIKA!

This, does work, but not in the exact way I'd like it to. What happens is - I click on its OW sprite and it says its 'PIKA!' message, then the battle initiates. After I defeat or catch it, the battle screen disappears and I'm back in the overworld, and then its sprite disappears.

However, this is only partially what I want. This outcome does work in the event that I defeat the Pikachu, but if I catch it instead, I want its OW sprite to be already gone by the time I return to the overworld from the battle screen, which is also how it works with the game's default Legendaries.

Does anyone know how to do this?

What you're gonna want to do is set the flag BEFORE the wildbattle, so that when the map reloads afterward it knows to hide the sprite.
 
What you're gonna want to do is set the flag BEFORE the wildbattle, so that when the map reloads afterward it knows to hide the sprite.

So basically what I'm after is; in the event of defeating the Pokémon, I want its sprite to disappear after the OW has reloaded when the battle is done, but in the event of catching the Pokémon, I want its sprite to already be gone by the time the OW reloads, much like how it goes with the game's default Legendary encounters.

Does setting the flag before the wildbattle make it like that? :)
 


So basically what I'm after is; in the event of defeating the Pokémon, I want its sprite to disappear after the OW has reloaded when the battle is done, but in the event of catching the Pokémon, I want its sprite to already be gone by the time the OW reloads, much like how it goes with the game's default Legendary encounters.

Does setting the flag before the wildbattle make it like that? :)

Setting the flag before makes it go away before. Setting after makes it go away after. The legends check if you did what and stuff, so paste one of their scripts here and I'll find a way.
 
Setting the flag before makes it go away before. Setting after makes it go away after. The legends check if you did what and stuff, so paste one of their scripts here and I'll find a way.

This is Articuno's script that I took from XSE by opening it in Advance Map:
Code:
#org 0x81631AC
'-----------------------------------
special INIT_STEPCOUNT
compare LASTRESULT 0x2
if == jump 0x81A7AE0 ' Equal To
special GET_STEPCOUNT
lock
faceplayer
battle ARTICUNO 50 NONE
checksound
cry ARTICUNO 0x2
message 0x81A6448 ' Gyaoo!
showmsg
waitcry
pause 0xA
playsound 0x156 0x0
waitbutton
setflag 0x807
special BATTLE_PIXELLATE
waitspecial
clearflag 0x807
special2 LASTRESULT 0xB4
compare LASTRESULT 0x1
if == jump 0x816320F ' Equal To
compare LASTRESULT 0x4
if == jump 0x8163218 ' Equal To
compare LASTRESULT 0x5
if == jump 0x8163218 ' Equal To
setflag 0x2BE
release
end

#org 0x81A7AE0
'-----------------------------------
release
end

#org 0x816320F
'-----------------------------------
setflag 0x2BE
jump 0x81A922D

#org 0x81A922D
'-----------------------------------
fadescreen FADEOUT_BLACK
disappear LASTTALKED
fadescreen FADEIN_BLACK
release
end

#org 0x8163218
'-----------------------------------
setvar 0x8004 0x90
jump 0x81A9236

#org 0x81A9236
'-----------------------------------
fadescreen FADEOUT_BLACK
disappear LASTTALKED
fadescreen FADEIN_BLACK
storepokemon 0x0 0x8004
msgbox 0x81A63C4 ' The \v\h02 flew away...
callstd MSG_NOCLOSE ' Non-closing message
release
     ' Release commands close any open messages
end


#org 0x81A6448
= Gyaoo!

#org 0x81A63C4
= The \v\h02 flew away!

I don't know if this is what you're looking for? I don't know how to get the script in its uncompiled form.
 


This is Articuno's script that I took from XSE by opening it in Advance Map:
Code:
#org 0x81631AC
'-----------------------------------
special INIT_STEPCOUNT
compare LASTRESULT 0x2
if == jump 0x81A7AE0 ' Equal To
special GET_STEPCOUNT
lock
faceplayer
battle ARTICUNO 50 NONE
checksound
cry ARTICUNO 0x2
message 0x81A6448 ' Gyaoo!
showmsg
waitcry
pause 0xA
playsound 0x156 0x0
waitbutton
setflag 0x807
special BATTLE_PIXELLATE
waitspecial
clearflag 0x807
special2 LASTRESULT 0xB4
compare LASTRESULT 0x1
if == jump 0x816320F ' Equal To
compare LASTRESULT 0x4
if == jump 0x8163218 ' Equal To
compare LASTRESULT 0x5
if == jump 0x8163218 ' Equal To
setflag 0x2BE
release
end

#org 0x81A7AE0
'-----------------------------------
release
end

#org 0x816320F
'-----------------------------------
setflag 0x2BE
jump 0x81A922D

#org 0x81A922D
'-----------------------------------
fadescreen FADEOUT_BLACK
disappear LASTTALKED
fadescreen FADEIN_BLACK
release
end

#org 0x8163218
'-----------------------------------
setvar 0x8004 0x90
jump 0x81A9236

#org 0x81A9236
'-----------------------------------
fadescreen FADEOUT_BLACK
disappear LASTTALKED
fadescreen FADEIN_BLACK
storepokemon 0x0 0x8004
msgbox 0x81A63C4 ' The \v\h02 flew away...
callstd MSG_NOCLOSE ' Non-closing message
release
     ' Release commands close any open messages
end


#org 0x81A6448
= Gyaoo!

#org 0x81A63C4
= The \v\h02 flew away!

I don't know if this is what you're looking for? I don't know how to get the script in its uncompiled form.

Try something like Mewtwo, he'll be easier to understand I bet. Articuno goes through a series of checks due to the story (I've never played FR/LG, so this may not be the case) :D
 
Try something like Mewtwo, he'll be easier to understand I bet. Articuno goes through a series of checks due to the story (I've never played FR/LG, so this may not be the case) :D

This is what I get if I take the offset of Mewtwo's script in AM, put it into XSE, and decompile:
Code:
'---------------
#org 0x1624F5
special 0x187
compare LASTRESULT 0x2
if 0x1 goto 0x81A7AE0
special 0x188
lock
faceplayer
checksound
cry 0x96 0x2
preparemsg 0x8177F9F '"Mew!"
waitmsg
waitcry
pause 0x14
playsong 0x156 0x0
waitkeypress
setwildbattle 0x96 0x46 0x0
setflag 0x807
special 0x138
waitstate
clearflag 0x807
special2 LASTRESULT 0xB4
compare LASTRESULT 0x1
if 0x1 goto 0x8162558
compare LASTRESULT 0x4
if 0x1 goto 0x8162561
compare LASTRESULT 0x5
if 0x1 goto 0x8162561
setflag 0x2BC
release
end

'---------------
#org 0x1A7AE0
release
end

'---------------
#org 0x162558
setflag 0x2BC
goto 0x81A922D

'---------------
#org 0x162561
setvar 0x8004 0x96
goto 0x81A9236

'---------------
#org 0x1A922D
fadescreen 0x1
hidesprite LASTTALKED
fadescreen 0x0
release
end

'---------------
#org 0x1A9236
fadescreen 0x1
hidesprite LASTTALKED
fadescreen 0x0
bufferpokemon 0x0 0x8004
msgbox 0x81A63C4 MSG_KEEPOPEN '"The [buffer1] flew away!"
release
end


'---------
' Strings
'---------
#org 0x177F9F
= Mew!

#org 0x1A63C4
= The [buffer1] flew away!

But what I'mtrying is just a basic wild Pokémon event that's not tied to any requirements or anything, with the following desired outcome:

in the event of defeating the Pokémon, I want its sprite to disappear after the OW has reloaded when the battle is done, but in the event of catching the Pokémon, I want its sprite to already be gone by the time the OW reloads.

Furthermore,
I would like for different music to start playing once you click on the event's OW sprite, like it also does with the Legendary encounters in the game, and use different music for the battle itself instead of the game's default wild battle music.

I'm just starting to get into this scripting thing :D
 
Last edited:
Try this out:
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!

The thing is, he won't hide as soon as the battle ends. If you catch it, it shows him, then hides him after fadescreens. If you run/defeat it, it does the same but says "The PIKACHU ran away!"
So the thing you want won't be 100%, but you get the idea. ;D
 
Try this out:
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!
The thing is, he won't hide as soon as the battle ends. If you catch it, it shows him, then hides him after fadescreens. If you run/defeat it, it does the same but says "The PIKACHU ran away!"
So the thing you want won't be 100%, but you get the idea. ;D

Thanks much. It's late though, so I'll try this out tomorrow first thing, and let you know the result.

But surely it must be possible, because in the case of the Legendaries in the game, if you catch them, their sprites are already gone by the time the overworld comes back into view (of course, because they are inside their Pokéball that you caught them with). I wonder how they achieve that in the code then.
 
Last edited:
Game: Firered
Editor: pksv_ui
Script:
Spoiler:

Hello everyone. Im having trouble trying to use this script and a few like it. Everytime i compile it it adds hundreds of #raw ff lines of script. Whats causing that and how do i fix it? I have this script setup on a script event with var #4092 and var value as 1. The person event number is 11 and is the 9th person script on the map. Sometimes ive managed to get it working but it wont apply movements.
 
Game: Firered
Editor: pksv_ui
Script:
Spoiler:

Hello everyone. Im having trouble trying to use this script and a few like it. Everytime i compile it it adds hundreds of #raw ff lines of script. Whats causing that and how do i fix it? I have this script setup on a script event with var #4092 and var value as 1. The person event number is 11 and is the 9th person script on the map. Sometimes ive managed to get it working but it wont apply movements.

I think you'd be better off with XSE since it doesn't do that lol
Latest link in gamer2020's toolbox
 
I think you'd be better off with XSE since it doesn't do that lol
Latest link in gamer2020's toolbox
I have xse downloaded already. And i just found out thtat the raw thing is caused by the setvar 0x492 0x2 script. Why is that?
 
I have xse downloaded already. And i just found out thtat the raw thing is caused by the setvar 0x492 0x2 script. Why is that?

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