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

Epitaph93

Intermediate Digidestined
120
Posts
12
Years
well from what i read here http://bulbapedia.bulbagarden.net/wiki/Personality_value

gender is part of the pokemon's personality value, wouldn't it be somewhere on the first 4 byte?

here's how i understand it at least(im not totally sure but here goes):
lets say my bulbasaur in my FR save has a personality value of C5CA4F52 which is 11000101110010100100111101010010 in binary. the lowest byte which is 01010010 (82) determines its Pgender value you then compare this value to the gender threshold of bulbasaur(look at YAPE) which is 31 if its greater or equal than the threshold value it is a male otherwise it is a female.

but before all that you need to perform a check for 100% male/females and genderless just to be safe
please someone correct me if im wrong >.<

Hmm for some reason I thought it was set to the 6th byte... Okay, so the value isn't actually set to a particular byte. Instead, it's set to the lowest byte. So in this example : FC6A446D 44 would be the gender byte?

The routine still shouldn't have made the game crash though right? It should return a value of some sort and the value will either be greater than 20 or less than 20, regardless of whether the particular value is the gender value. So I still need to figure out the problem with the routine itself.
 
24
Posts
12
Years
  • Seen Apr 29, 2012
Okay, so I want the Rival who you just battled for the first time, walk up three steps, left three steps, stop, and turn. I want the player to watch him go, but I don't know how I'd arrange the whole "Follow him with your eyes" sort of thing. Any help?
 
21
Posts
14
Years
  • Seen Mar 26, 2021
Hmm for some reason I thought it was set to the 6th byte... Okay, so the value isn't actually set to a particular byte. Instead, it's set to the lowest byte. So in this example : FC6A446D 44 would be the gender byte?

The routine still shouldn't have made the game crash though right? It should return a value of some sort and the value will either be greater than 20 or less than 20, regardless of whether the particular value is the gender value. So I still need to figure out the problem with the routine itself.

well, not exactly. if it is then it's much easier to just use copybyte on xse
as for the routine the only error i see is when you called it you didn't add +1 to it. if you put the routine in 852828, when you use callasm it should be 852829

i'll send you a pm about the whole gender thing,its kinda long and its not really script related anyway
 
24
Posts
12
Years
  • Seen Apr 29, 2012
Hello, again. I need some more help. I want a person to show up only after the second badge has been given. I've made sure the script is all handy dandy, but for some reason, he still appears at the very beginning of the game.
Spoiler:
 
10,078
Posts
15
Years
  • Age 32
  • UK
  • Seen Oct 17, 2023
Hello, again. I need some more help. I want a person to show up only after the second badge has been given. I've made sure the script is all handy dandy, but for some reason, he still appears at the very beginning of the game.

To hide a person longer than simply for the length of a script you need to set a flag, and then put that flag number as the person ID number in A-Map.

EG:setflag 0x100 will make any people with an ID of 100 not be shown.
clearflag 0x100 will do the opposite.

Therefore to make someone be shown after a gymbadge you need to edit a 'clearflag' command to the gym script, so not only is the badge-flag set, but the person-flag is cleared. You can set the flag originally in a levelscript early on in the game or something to make sure the character is hidden before you get to the map it's on.
 
3
Posts
12
Years
  • Seen Jan 23, 2024
I am using Pokemon Fire red room, A-trainer, A-map and XSE to make a trainer script.
When I beat the trainer I want the sprite to be hiden but when I defeat him, he isn't hide. If I try to talk to him again he will be hiden but as soon as I move he appears. If anyone can help it would be nice.

Here's the script:

#org 0x8000DB
trainerbattle 0x0 0x2 0x0 0x88000F4 0x8800102
fadescreen 0x0
hidesprite 0x5
setflag 0x200
release
end


'---------
' Strings
'---------
#org 0x8000F4
= bla bla bla

#org 0x800102
= non non non


 
10,078
Posts
15
Years
  • Age 32
  • UK
  • Seen Oct 17, 2023
I am using Pokemon Fire red room, A-trainer, A-map and XSE to make a trainer script.
When I beat the trainer I want the sprite to be hiden but when I defeat him, he isn't hide. If I try to talk to him again he will be hiden but as soon as I move he appears. If anyone can help it would be nice.


#org @Start
trainerbattle 0x1 0x2 0x0 0x88000F4 0x8800102 @defeated
end

#org @defeated
fadescreen 0x0
hidesprite 0x5
setflag 0x200
release
end

#org 0x8000F4
= bla bla bla

#org 0x800102
= non non non

===========================================

Make sure to set the Person ID to 200 in A-Map to make the hidesprite permanent
 

ShadowGrey

Graphix Master
49
Posts
12
Years
Hey everyone, just wondering if anyone can help me out a little with this script please.

What Is supposed to happen:

Check if the script has been activated before (flag 1207)
Rival speech
Player movement (exclamation, down left)
Rival speech
Pokemon cry (Umbreon)
Pokemon 1 movement (Umbreon, left right - jump)
Pokemon 2 movement (wild, exclamation)
Rival speech
Black screen
Hide sprite (wild)
Normal screen
Rival speech
Rival movement (face right, question mark)
Rival speech
Rival movement (question mark)
Rival speech
Rival movement (up right up)
Pokemon movement (right up right up - following rival)
Two sprites hidden offscreen (Rival and Umbreon)
Setflag so event occurs once
End

What happens:

Crash on contact with event script tile.

In advance map
Rival event no.11
Umbreon event no.12
Wild Pokemon event no.13

I think that's all the basic info.

The script follows:

#dynamic 0x26DF05

#org @start
checkflag 0x1207
if 0x1 goto @done
msgbox @rival1 0x6
applymovement 0xFF @player1
waitmovement 0x0
msgbox @rival2 0x6
cry 0xC5 0x0
applymovement 0xC @umbreon1
waitmovement 0x0
applymovement 0xD @wild1
waitmovement 0x0
msgbox @rival3 0x6
fadescreen 0x1
hidesprite 0xD
fadescreen 0x0
msgbox @rival4 0x6
applymovement 0xB @rival5
waitmovement 0x0
msgbox @rival6 0x6
applymovement 0xB @rival7
waitmovement 0x0
msgbox @rival8 0x6
applymovement 0xB @rival9
applymovement 0xC @umbreon2
waitmovement 0x0
hidesprite 0xB
hidesprite 0xC
setflag 0x1207
end

#org @done
end

#org @rival1
= \v\h06: Come on Umbreon!\nWe can do this!

#org @player1
#raw 0x62
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x12
#raw 0x12
#raw 0x12
#raw 0x12
#raw 0xFE

#org @rival2
= \v\h06: Umbreon!\nUse Tackle!

#org @umbreon1
#raw 0x54
#raw 0x49
#raw 0xFE

#org @wild1
#raw 0x62
#raw 0xFE

#org @rival3
= \v\h06: Go! Pokeball!

#org @rival4
= \v\h06: Gotcha!

#org @rival5
#raw 0x03
#raw 0x63
#raw 0xFE

#org @rival6
= Oh hey \v\h01!\pI've just decided, I need to brush\nup on my skills as a Pokemon\p\nTrainer.\pDon't look so alarmed! I'm not\ngoing to battle you!\pI don't think your ready for that\njust yet.

#org @rival7
#raw 0x62
#raw 0xFE

#org @rival8
= What's that?\pMom is worried about me? I guess I\nhave been away for a while now.\pDon't fret \v\h01, I'll head back\nnow and put her heart at ease.\pAfter that it's off to Professor\nIssac's house! I'm going to see if\pI'm finally ready to begin my\nPokemon adventure!\pCatch you later!

#org @rival9
#raw 0x11
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0xFE

#org @umbreon2
#raw 0x13
#raw 0x11
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0xFE

Please could someone examine this for flaws that could result in the script behaving in this way, I have spent so much time going over it my head is starting to spin! Many thanks,
Shadow.

Revised 1-
SwiftSign suggested apply waitmovement 0x0 after applymovement instructions to allow for movement to end before any given textbox begins, this was applied but with no luck. Also that the #dynamic may be interfering with other scripts in the hack, the dynamic was found via FSF so we did not believe this would be the case but took it into account anyway and tried the script with #dynamic 0x800000 as a standard test point, this also did not seem to work.
Please keep your suggestions coming! :)
 
Last edited:
5,256
Posts
16
Years
You should change the dynamic to 0x800000, as XSE will find offsets for you without the need of FSF and it's safe. Also, do the script tiles have the first Unknown set to 03? And have you set the var number? (4050)
 

teejermiester

Minnesotan, you betcha!
320
Posts
13
Years
I think your best bet here is what S.I. said, shadow. But, I did notice this:

#org @rival6
= Oh hey \v\h01!\pI've just decided, I need to brush\nup on my skills as a Pokemon\p\nTrainer.\pDon't look so alarmed! I'm not\ngoing to battle you!\pI don't think [S-HIGHLIGHT]your[/S-HIGHLIGHT] ready for that\njust yet.


Correct grammar is a good thing, sir.
 
30
Posts
18
Years
  • Seen May 26, 2022
Just encountered a problem in my new script (using JPAN's Hacked Fire Red ROM with pksv as script editor):

Code:
#dyn 0x740000
#org @start
lock
sound 0x26
fadescreen FADEIN_WHITE
pause 12
setvar 0x8004 0x0
special 0x65
copyvar 0x8008 LASTRESULT 
compare 0x8008 0x0
if != call @damage
setvar 0x8004 0x1
special 0x65
copyvar 0x8008 LASTRESULT 
compare 0x8008 0x0
if != call @damage
setvar 0x8004 0x2
special 0x65
copyvar 0x8008 LASTRESULT 
compare 0x8008 0x0
if != call @damage
setvar 0x8004 0x3
special 0x65
copyvar 0x8008 LASTRESULT 
compare 0x8008 0x0
if != call @damage
setvar 0x8004 0x4
special 0x65
copyvar 0x8008 LASTRESULT 
compare 0x8008 0x0
if != call @damage
setvar 0x8004 0x5
special 0x65
copyvar 0x8008 LASTRESULT 
compare 0x8008 0x0
if != call @damage
msgbox @trap
callstd MSG_NORMAL
release
end

#org @damage
setvar 0x8005 0x3D
setvar 0x8006 0x0
special 0x66
setvar 0x8005 0x1
setvar 0x8006 0x1
special 0x66
return

#org @trap 
= Triggered a ninja trap!\p\v\h01's POK\eMON were hurt by the\ntrap!

Basically what it does is it checks to see if a Pokemon has fainted. If it hasn't, it inflicts 61 damage to that Pokemon. However, running the script does not affect the HP at all.
 

DrFuji

[I]Heiki Hecchara‌‌[/I]
1,691
Posts
14
Years
Just encountered a problem in my new script (using JPAN's Hacked Fire Red ROM with pksv as script editor):

Code:
#dyn 0x740000
#org @start
lock
sound 0x26
fadescreen FADEIN_WHITE
pause 12
setvar 0x8004 0x0
special 0x65
copyvar 0x8008 LASTRESULT 
compare 0x8008 0x0
if != call @damage
setvar 0x8004 0x1
special 0x65
copyvar 0x8008 LASTRESULT 
compare 0x8008 0x0
if != call @damage
setvar 0x8004 0x2
special 0x65
copyvar 0x8008 LASTRESULT 
compare 0x8008 0x0
if != call @damage
setvar 0x8004 0x3
special 0x65
copyvar 0x8008 LASTRESULT 
compare 0x8008 0x0
if != call @damage
setvar 0x8004 0x4
special 0x65
copyvar 0x8008 LASTRESULT 
compare 0x8008 0x0
if != call @damage
setvar 0x8004 0x5
special 0x65
copyvar 0x8008 LASTRESULT 
compare 0x8008 0x0
if != call @damage
msgbox @trap
callstd MSG_NORMAL
release
end

#org @damage
setvar 0x8005 0x3D
setvar 0x8006 0x0
special 0x66
setvar 0x8005 0x1
setvar 0x8006 0x1
special 0x66
return

#org @trap 
= Triggered a ninja trap!\p\v\h01's POKéMON were hurt by the\ntrap!

Basically what it does is it checks to see if a Pokemon has fainted. If it hasn't, it inflicts 61 damage to that Pokemon. However, running the script does not affect the HP at all.

Here's a working version of your script (written with XSE) that has been condensed considerably through the use of the 'addvar' command.

Code:
#dynamic 0x800000

#org @start
lock
sound 0x26
fadescreen 0x3
pause 0xC
fadescreen 0x2
setvar 0x8004 0x0
goto @Damage

#org @Damage
setvar 0x8005 0x3D
setvar 0x8006 0x0
special 0x66
compare 0x8004 0x5
if 0x1 goto @Finish
addvar 0x8004 0x1
goto @Damage

#org @Finish
msgbox @Trap 0x2
release
end

#org @Trap 
= Triggered a ninja trap!\p\v\h01's POK\eMON were hurt by the\ntrap!

The main problem you were having was that where you wrote 'special 0x65' it should have been 'special2 0x65 0x[variable]'. This way the special would have written your Pokemon's current HP to the variable of your choosing which you could then check with a compare command. I took it out anyway as special 0x66 won't send your fainted Pokemon into negative HP or do anything bad like that so it was useless :P
 
30
Posts
18
Years
  • Seen May 26, 2022
Here's a working version of your script (written with XSE) that has been condensed considerably through the use of the 'addvar' command.

Code:
#dynamic 0x800000

#org @start
lock
sound 0x26
fadescreen 0x3
pause 0xC
fadescreen 0x2
setvar 0x8004 0x0
goto @Damage

#org @Damage
setvar 0x8005 0x3D
setvar 0x8006 0x0
special 0x66
compare 0x8004 0x5
if 0x1 goto @Finish
addvar 0x8004 0x1
goto @Damage

#org @Finish
msgbox @Trap 0x2
release
end

#org @Trap 
= Triggered a ninja trap!\p\v\h01's POK\eMON were hurt by the\ntrap!

The main problem you were having was that where you wrote 'special 0x65' it should have been 'special2 0x65 0x[variable]'. This way the special would have written your Pokemon's current HP to the variable of your choosing which you could then check with a compare command. I took it out anyway as special 0x66 won't send your fainted Pokemon into negative HP or do anything bad like that so it was useless :P


The main reason I was using special 0x65 wasn't to check for negative HP, but to check to see if the Pokemon hasnt fainted. In other words, I wanted special 0x66 to do damage, but to leave the Pokemon with at least 1 HP so as to avoid wonky things that shouldn't happen (like going into a battle with 6 fainted Pokemon. I know the game would cancel the fight but I would like to prevent this from happening).
 

ShadowGrey

Graphix Master
49
Posts
12
Years
Okay thanks for the help everyone, all things taken into account the problem was solved, thanks! Anyway, I have what probably might be quite a generic question but it seems important enough to ask, and I haven't really found anything explaining this.

I know that using FSF gives you offsets through out the game that are free and available for use, but I also know that only so much can be done with this offset before it starts affecting other parts of the game, script overlap and so forth. My question is this: what is the best way to find and get an offset that you can be certain will cope with the amount of data you wish to input, also is it possible to know how many bytes a particular script will use before you insert it, and finally is there an offset cap? It would be really useful as this kind of thing is not really covered in most XSE tutorials or help.

Much appreciated,
Shadow.

Pokemon Shadow Gray - Still looking for a Scriptor!
 

DrFuji

[I]Heiki Hecchara‌‌[/I]
1,691
Posts
14
Years
The main reason I was using special 0x65 wasn't to check for negative HP, but to check to see if the Pokemon hasnt fainted. In other words, I wanted special 0x66 to do damage, but to leave the Pokemon with at least 1 HP so as to avoid wonky things that shouldn't happen (like going into a battle with 6 fainted Pokemon. I know the game would cancel the fight but I would like to prevent this from happening).

Oh sorry, I must have been misunderstanding how you were setting up the script. Anyway, here is an updated version of the script that I posted earlier which will always leave the affected Pokemon with 1 HP and won't affect Pokemon that have already fainted.

Code:
#dynamic 0x800000

#org @start
lock
sound 0x26
fadescreen 0x1
pause 0xC
fadescreen 0x0
setvar 0x8004 0x0
goto @Damage

#org @Damage
special2 0x8005 0x65
compare 0x8005 0x3C
if 0x3 goto @LessThan61
setvar 0x8005 0x3D
setvar 0x8006 0x0
special 0x66
compare 0x8004 0x5
if 0x1 goto @Finish
addvar 0x8004 0x1
goto @Damage

#org @LessThan61
subvar 0x8005 0x1
setvar 0x8006 0x0
special 0x66
compare 0x8004 0x5
if 0x1 goto @Finish
addvar 0x8004 0x1
goto @Damage

#org @Finish
msgbox @Trap 0x2
release
end

#org @Trap 
= Triggered a ninja trap!\p\v\h01's POKéMON were hurt by the\ntrap!
 
6
Posts
12
Years
  • Seen Jul 21, 2015
Im having problems with my givepokemon script.
Every time i talk to the sprite i hear a click and they just look at me.
When I warp back into the area, it does the same thing over again.
Spoiler:

Also, I am using XSE 1.0.0 (because i cant get the newest one)
 
30
Posts
18
Years
  • Seen May 26, 2022
Oh sorry, I must have been misunderstanding how you were setting up the script. Anyway, here is an updated version of the script that I posted earlier which will always leave the affected Pokemon with 1 HP and won't affect Pokemon that have already fainted.

Code:
#dynamic 0x800000

#org @start
lock
sound 0x26
fadescreen 0x1
pause 0xC
fadescreen 0x0
setvar 0x8004 0x0
goto @Damage

#org @Damage
special2 0x8005 0x65
compare 0x8005 0x3C
if 0x3 goto @LessThan61
setvar 0x8005 0x3D
setvar 0x8006 0x0
special 0x66
compare 0x8004 0x5
if 0x1 goto @Finish
addvar 0x8004 0x1
goto @Damage

#org @LessThan61
subvar 0x8005 0x1
setvar 0x8006 0x0
special 0x66
compare 0x8004 0x5
if 0x1 goto @Finish
addvar 0x8004 0x1
goto @Damage

#org @Finish
msgbox @Trap 0x2
release
end

#org @Trap 
= Triggered a ninja trap!\p\v\h01's POKéMON were hurt by the\ntrap!

Just tried this and its still KOing the Pokemon. For some reason I think it might be the compare routine, because I added a check at the end of the script that would set a flag if it wasnt already set, and unset it if it is and it's not executing at all. Never had this issue before

Disregard what I said. I was using the wrong syntax for variable subtraction in pksv. It works beautifully now. Though I am having an issue with a little addition I made at the end:

Code:
#org 0x8747737
'-----------------------------------
compare 0x6007 0x0
if == call 0x8747757 ' Equal To
compare 0x6007 0x1
if == call 0x874775D ' Equal To
msgbox 0x8747763 ' Triggered a ninja tr...
callstd MSG_LOCK ' Built-in lock command
release
end

#org 0x8747757
'-----------------------------------
setvar 0x6007 0x1
return

#org 0x874775D
'-----------------------------------
setvar 0x6007 0x0
return

0x6007 is the var used for the script tile, I have two versions of the same script: one with value 0 and one with value 1. The value 0 one does not deactivate and the value 1 does not activate.
 
Last edited:
10,078
Posts
15
Years
  • Age 32
  • UK
  • Seen Oct 17, 2023
Okay thanks for the help everyone, all things taken into account the problem was solved, thanks! Anyway, I have what probably might be quite a generic question but it seems important enough to ask, and I haven't really found anything explaining this.

I know that using FSF gives you offsets through out the game that are free and available for use, but I also know that only so much can be done with this offset before it starts affecting other parts of the game, script overlap and so forth. My question is this: what is the best way to find and get an offset that you can be certain will cope with the amount of data you wish to input, also is it possible to know how many bytes a particular script will use before you insert it, and finally is there an offset cap? It would be really useful as this kind of thing is not really covered in most XSE tutorials or help.

Much appreciated,
Shadow.

Pokemon Shadow Gray - Still looking for a Scriptor!

With XSE you don't want to use FSF at all to be honest. Always put #dynamic 0x800000 and XSE will automatically set the pointers to free space. However you have to remember but if you then decompile something using XSE if you change the number of bytes, then you run the risk of overwriting something that is later in the ROM.

Im having problems with my givepokemon script.
Every time i talk to the sprite i hear a click and they just look at me.
When I warp back into the area, it does the same thing over again.
Spoiler:

Also, I am using XSE 1.0.0 (because i cant get the newest one)

Your problem is that you have tried making the give pokemon command a message command, so the script won't work. You have also made the actual message not work by pointing directly to it, rather than to a new string, try this:

#dynamic 0x800000 <- Empty Space. Always use 0x800000

#org @pokemon
lock
faceplayer
checkflag 0x828
if 0x1 goto @talked
setflag 0x828
givepokemon 0x11B 0x5 0x0 0x0 0x0 0x0
release
end

#org @Talked
msgbox @Talk1 0x6
release
end

#org @Talk1
= Today's the big day!\nThe Academy of Steven Stone is a\lhard place to get into...\lAnd you managed to graduate with\lAmy and Perry!\p...........\n...........\lWait!\lBefore you leave,\lYour dad sent you a special gift.\p...\nIt's his Tarnaquax from many moons\lago...\p\v\h01 recieved a Tarnaquax!\pStay safe and have fun!

Disregard what I said. I was using the wrong syntax for variable subtraction in pksv. It works beautifully now. Though I am having an issue with a little addition I made at the end:

Code:
#org 0x8747737
'-----------------------------------
compare 0x6007 0x0
if == call 0x8747757 ' Equal To
compare 0x6007 0x1
if == call 0x874775D ' Equal To
msgbox 0x8747763 ' Triggered a ninja tr...
callstd MSG_LOCK ' Built-in lock command
release
end

#org 0x8747757
'-----------------------------------
setvar 0x6007 0x1
return

#org 0x874775D
'-----------------------------------
setvar 0x6007 0x0
return

0x6007 is the var used for the script tile, I have two versions of the same script: one with value 0 and one with value 1. The value 0 one does not deactivate and the value 1 does not activate.

*butts in slightly*

The reason is the order of your script means that.

6007 = 0x0 -> 6007 = 0x1 -> 6007 = 0x0

Because the return function brings back to the second compare, just after the first compare, if that makes sense. Basically what your script is doing is just repeatedly resetting the variable to 0x0. Since that var never reaches 0x1 outside the script that's why the second script is not activating ever.

Try something like:

#org @start
compare 0x6007 0x0
if == call @Zero ' Equal To
setvar 0x6007 0x0
goto @Continue

#org @Zero
setvar 0x6007 0x1
goto @Continue

#org @Continue
msgbox 0x8747763 ' Triggered a ninja tr...
callstd MSG_LOCK ' Built-in lock command
release
end


This means if 6007 is 0x0, it is set to 0x1 and then locked into the continue script rather than returning directly. And the opposite for 0x1 -> 0x0.
 
Last edited:
5,854
Posts
17
Years
  • Age 34
  • Seen Dec 8, 2023
Spoiler:


It's barely working. No text boxes show up at all.

Admittedly this is the first time in a long time that I'm scripting (and I never was too good at it to begin with), so I have no idea what's wrong here. Is it the order? I am using JPAN's hacked engine for FR, if that may cause trouble, but I doubt it. Any help would be immensely appreciated.

edit: okay, so I just tried to make another script, a simple sign, and no textbox showed up there either. I'm starting to think that it is this hack, but I didn't have any trouble with it before.
 
Last edited:
Status
Not open for further replies.
Back
Top