- 6,353
- Posts
- 19
- Years
- Seen Apr 16, 2020
Yeah, people ask how to learn to script and stuff so here's a tutorial.
Basic scripting commands:
message
#org 0x800000
message 0x800100
boxset 0x6
release
end
#org 0x800100
= Hi.
Put an offset after the message, then at the end of the script put the same offset and the text with the "=" like in the example.
Release closes the textbox.
Put "lock" and "faceplayer" after the "#org" command to make the event face the player.
#org 0x800000
lock
faceplayer
message 0x800100
boxset 0x6
release
end
#org 0x800100
= Hi.
boxset 0x5 Yes/No
boxset 0x6 close after button press
compare
An example with "compare" in a yes/no script.
#org 0x800000
message 0x800100
boxset 0x5
compare LASTRESULT 0x1 Compares if it's yes or no (0x1 = yes; 0x0 = no)
if 0x1 goto 0x800200 It's "if 0x1" so if you chose yes you go to that offset, if you chose "No" the script continues.
message 0x800300
boxset 0x6
release
end
#org 0x800200 In front of the script always put "#org" and an offset. Put that offset on the event you want to have it.
message 0x800400
boxset 0x6
release
end
#org 0x800100
Hello.
#org 0x800300
= You picked "NO".
#org 0x800400
= You picked "YES".
setflag
setflag 0x(flag)
#org 0x800000
checkflag 0x10A
compare LASTRESULT 0x1
if 0x1 goto 0x800100
setflag 0x10A
end
#org 0x800100
end
Flags are set so that events won't be repeated again. The script must first check a flag, if you don't have it the script goes on and the flag is set. When you talk to the event again then the script will go to the offset after the compare (in this script "800100") and do the commands there.
To clear a flag use "clearflag 0x(flag)"
applymovement
applymovement 0x(people's number) 0x(offset)
#org 0x800000
applymovement 0x3 0x800100 The steps the event will take will be the ones in the offset next to the event's index number.
pause 0x30 The "pause" commands is for how long to wait before the script goes on, 0x10 for one step
end
#org 0x800100 The steps the event will make are here. In this script, two steps down, one left.
#raw 0x8
#raw 0x8
#raw 0xA
#raw 0xFE After the steps always put "FE" at the end. If you don't, the event won't move.
You can find movement raws to use here.
To move the player use "applymovement 0xFF" or "APPLYMOVE_PLAYER"
Other scripting commands:
giveitem
giveitem 0x(item) 0x(quantity) Item in hex numbers and quantity in hexadecimal
#org 0x800000
giveitem 0x45 0x1
release Put release after "giveitem" or the textbox won't be removed after you get the item.
end
checkitem
checkitem 0x(item)
Use it like "checkflag".
#org 0x800000
checkitem 0x16
compare LASTRESULT 0x1
if 0x1 goto 0x800100
end
#org 0x800100
= You carry a SUPER POTION.
givepokemon
givepokemon 0x(pkmn) 0x(level) 0x(item)
#org 0x800000
givepokemon 0x78 0x5 0x3 In givepokemon scripts set flags should be used.
end
wildbattle
wildbattle 0x(pkmn) 0x(level) 0x(Battle style)
Legendary battle example:
#org 0x800000
cry PKMN_MEW This plays the pokemon's cry, it can be used in any script but it's mostly used in wildbattles ones.
wildbattle 0x97 0x46 0x3 There are 4 battle styles, put 0, 1, 2, 3
end
setweather
setweather 0x(weather)
0 = Normal
3 = Rain
4 = Snowflakes
5 = Thunderstorm
6 = Fog
7 = Ash
8 = Sandstorm
9 = Fog 2
A = Fog
B = Dark
C = Hot sun
D = Thunderstorm 2
E = Underwater
#org 0x800000
setweather 0xB
doweather Put "doweather" after the "setweather" command to make the weather change that moment.
end
checkgender
Like "checkflag", 0 if the player is male and 1 if it the player is female
#org 0x800000
checkgender
compare LASTRESULT 0x1
if 0x1 goto 0x800100 If the player's male (1) the script goes to offset "800100".
message 0x800200
boxset 0x6
release
end
#org 0x800100
message 0x800300
boxset 0x6
release
end
#org 0x800200
= Hello madam.
#org 0x800300
= Hello sir.
movesprite
movesprite 0x(event's index number) 0x(horizontal location) 0x(vertical location)
#org 0x800000
movesprite 0x4 0xA 0x16
end
special
special 0x(number)
#org 0x800000
special 0x0 "special 0x0" heals the pokemon in the player's party
end
trainerbattle
trainerbattle 0x(Kind) 0x(Trainer) 0x(ptrIntro) 0x(ptrDefeat)
0x(Kind) is 0x00 for normal battles, 0x04 for 2-on-2 and 0x05 for rematches.
#org 0x800000
trainerbattle 0x00 0x1A 0x800100 0x800200 If you put another offset here then after you beat the trainer the script will continue from the offset you put.
end
#org 0x800100
= Bring it on!
#org 0x800200
= I lost...
warp
warp 0x(Bank) 0x(Map) 0x(Warp's number)
#org 0x800000
warp 0x0 0xA 0x3
end
Basic scripting commands:
message
#org 0x800000
message 0x800100
boxset 0x6
release
end
#org 0x800100
= Hi.
Put an offset after the message, then at the end of the script put the same offset and the text with the "=" like in the example.
Release closes the textbox.
Put "lock" and "faceplayer" after the "#org" command to make the event face the player.
#org 0x800000
lock
faceplayer
message 0x800100
boxset 0x6
release
end
#org 0x800100
= Hi.
boxset 0x5 Yes/No
boxset 0x6 close after button press
compare
An example with "compare" in a yes/no script.
#org 0x800000
message 0x800100
boxset 0x5
compare LASTRESULT 0x1 Compares if it's yes or no (0x1 = yes; 0x0 = no)
if 0x1 goto 0x800200 It's "if 0x1" so if you chose yes you go to that offset, if you chose "No" the script continues.
message 0x800300
boxset 0x6
release
end
#org 0x800200 In front of the script always put "#org" and an offset. Put that offset on the event you want to have it.
message 0x800400
boxset 0x6
release
end
#org 0x800100
Hello.
#org 0x800300
= You picked "NO".
#org 0x800400
= You picked "YES".
setflag
setflag 0x(flag)
#org 0x800000
checkflag 0x10A
compare LASTRESULT 0x1
if 0x1 goto 0x800100
setflag 0x10A
end
#org 0x800100
end
Flags are set so that events won't be repeated again. The script must first check a flag, if you don't have it the script goes on and the flag is set. When you talk to the event again then the script will go to the offset after the compare (in this script "800100") and do the commands there.
To clear a flag use "clearflag 0x(flag)"
applymovement
applymovement 0x(people's number) 0x(offset)
#org 0x800000
applymovement 0x3 0x800100 The steps the event will take will be the ones in the offset next to the event's index number.
pause 0x30 The "pause" commands is for how long to wait before the script goes on, 0x10 for one step
end
#org 0x800100 The steps the event will make are here. In this script, two steps down, one left.
#raw 0x8
#raw 0x8
#raw 0xA
#raw 0xFE After the steps always put "FE" at the end. If you don't, the event won't move.
You can find movement raws to use here.
To move the player use "applymovement 0xFF" or "APPLYMOVE_PLAYER"
Other scripting commands:
giveitem
giveitem 0x(item) 0x(quantity) Item in hex numbers and quantity in hexadecimal
#org 0x800000
giveitem 0x45 0x1
release Put release after "giveitem" or the textbox won't be removed after you get the item.
end
checkitem
checkitem 0x(item)
Use it like "checkflag".
#org 0x800000
checkitem 0x16
compare LASTRESULT 0x1
if 0x1 goto 0x800100
end
#org 0x800100
= You carry a SUPER POTION.
givepokemon
givepokemon 0x(pkmn) 0x(level) 0x(item)
#org 0x800000
givepokemon 0x78 0x5 0x3 In givepokemon scripts set flags should be used.
end
wildbattle
wildbattle 0x(pkmn) 0x(level) 0x(Battle style)
Legendary battle example:
#org 0x800000
cry PKMN_MEW This plays the pokemon's cry, it can be used in any script but it's mostly used in wildbattles ones.
wildbattle 0x97 0x46 0x3 There are 4 battle styles, put 0, 1, 2, 3
end
setweather
setweather 0x(weather)
0 = Normal
3 = Rain
4 = Snowflakes
5 = Thunderstorm
6 = Fog
7 = Ash
8 = Sandstorm
9 = Fog 2
A = Fog
B = Dark
C = Hot sun
D = Thunderstorm 2
E = Underwater
#org 0x800000
setweather 0xB
doweather Put "doweather" after the "setweather" command to make the weather change that moment.
end
checkgender
Like "checkflag", 0 if the player is male and 1 if it the player is female
#org 0x800000
checkgender
compare LASTRESULT 0x1
if 0x1 goto 0x800100 If the player's male (1) the script goes to offset "800100".
message 0x800200
boxset 0x6
release
end
#org 0x800100
message 0x800300
boxset 0x6
release
end
#org 0x800200
= Hello madam.
#org 0x800300
= Hello sir.
movesprite
movesprite 0x(event's index number) 0x(horizontal location) 0x(vertical location)
#org 0x800000
movesprite 0x4 0xA 0x16
end
special
special 0x(number)
#org 0x800000
special 0x0 "special 0x0" heals the pokemon in the player's party
end
trainerbattle
trainerbattle 0x(Kind) 0x(Trainer) 0x(ptrIntro) 0x(ptrDefeat)
0x(Kind) is 0x00 for normal battles, 0x04 for 2-on-2 and 0x05 for rematches.
#org 0x800000
trainerbattle 0x00 0x1A 0x800100 0x800200 If you put another offset here then after you beat the trainer the script will continue from the offset you put.
end
#org 0x800100
= Bring it on!
#org 0x800200
= I lost...
warp
warp 0x(Bank) 0x(Map) 0x(Warp's number)
#org 0x800000
warp 0x0 0xA 0x3
end
Last edited: