• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • Announcement - March 5th 12:17 PM GMT

    Hi there Guest!
    Thanks for checking out Silph Co.! Right now things are very much still in development with things like themes, guidelines, rules and most importantly content, still being a WIP. The staff and our members are actively working to make the community more homey for you. In the mean time, we are welcoming feedback and suggestions if you have them in the Feedback section.
    Please read the forum rules before posting.

Script Help thread

#1
This thread is for getting help with your scripting probelms Firstly, I'm going to lay down a few rules:
  1. Please Keep it civil.
  2. Please provide a description of what the script is meant to do, and what it actually does
  3. Please provide the script editor you are using i.e. XSE, PKSV, PokéScript
  4. Please provide the ROM Name and header i.e. BPRE for Fire Red USA
  5. Please provide the script

I'l also supply a general structure for how posts should be posted below
Code:
[b]Name of ROM:
Script editor:
What is the script meant to do:
What is the script currently doing:[/b]
[spoiler=Script]script goes in here[/spoiler]
 
Last edited by a moderator:
#2
Hey, I think I'll be the one to start this off.

Pokemon Fire Red (BPRE) v1.0
XSE

Okay, so the script is meant to check to see if you beat all four elite four members (which would set flags 4B8 to 4BB), and then make the room shake like an earthquake (or white screen, but right now I got the earthquake animation going) and reveal the room leading to the champion.

The script is doing is all that, but the earthquake looks a little weird...and I'm not entirely sure how to stop the quake

Here's a picture of the map for reference
a.png

And now...the script
#dynamic 0x800000
#org @start
lock
faceplayer
msgbox @1 0x6
checkflag 0x4B8
if 0x01 goto @pass1
release
end
#org @pass1
checkflag 0x4B9
if 0x01 goto @pass2
release
end
#org @pass2
checkflag 0x4BA
if 0x01 goto @pass3
release
end
#org @pass3
checkflag 0x4BB
if 0x01 goto @pass4
release
end
#org @pass4
msgbox @2 0x6
special 0x136
applymovement 0xFF @move1
waitmovement 0x0
fadescreen 1
setmaptile 0x1a 0x02 0x332 0x1
setmaptile 0x1a 0x03 0x33A 0x1
setmaptile 0x1b 0x02 0x333 0x1
setmaptile 0x1b 0x03 0x33B 0x0
setmaptile 0x1c 0x02 0x334 0x1
setmaptile 0x1c 0x03 0x33C 0x1
setflag 0x216
fadescreen 0
pause 0x10
release
end
#org @1
= "Once you beat all four trainers,\nthe path to the Champion will be\lunlocked."
#org @2
= "The path to the Champion will be\nunlocked[.]"
#org @move1
#raw 0x62
#raw 0xFE

I'd really appreciate it if someone could help me figure this out. Thanks in advance!
 

Deokishisu

Active member
#3
Hey, I think I'll be the one to start this off.

Pokemon Fire Red (BPRE) v1.0
XSE

Okay, so the script is meant to check to see if you beat all four elite four members (which would set flags 4B8 to 4BB), and then make the room shake like an earthquake (or white screen, but right now I got the earthquake animation going) and reveal the room leading to the champion.

The script is doing is all that, but the earthquake looks a little weird...and I'm not entirely sure how to stop the quake

Here's a picture of the map for reference

And now...the script
#dynamic 0x800000
#org @start
lock
faceplayer
msgbox @1 0x6
checkflag 0x4B8
if 0x01 goto @pass1
release
end
#org @pass1
checkflag 0x4B9
if 0x01 goto @pass2
release
end
#org @pass2
checkflag 0x4BA
if 0x01 goto @pass3
release
end
#org @pass3
checkflag 0x4BB
if 0x01 goto @pass4
release
end
#org @pass4
msgbox @2 0x6
special 0x136
applymovement 0xFF @move1
waitmovement 0x0
fadescreen 1
setmaptile 0x1a 0x02 0x332 0x1
setmaptile 0x1a 0x03 0x33A 0x1
setmaptile 0x1b 0x02 0x333 0x1
setmaptile 0x1b 0x03 0x33B 0x0
setmaptile 0x1c 0x02 0x334 0x1
setmaptile 0x1c 0x03 0x33C 0x1
setflag 0x216
fadescreen 0
pause 0x10
release
end
#org @1
= "Once you beat all four trainers,\nthe path to the Champion will be\lunlocked."
#org @2
= "The path to the Champion will be\nunlocked[.]"
#org @move1
#raw 0x62
#raw 0xFE

I'd really appreciate it if someone could help me figure this out. Thanks in advance!
Right before the special in your script, try putting these in:
Code:
setvar 0x8004 0x3
setvar 0x8005 0x12
setvar 0x8006 0x12
setvar 0x8007 0x03
I haven't tested it, but I'm pretty sure that special takes parameters from those variables. If it works, you can mess around with the values there to change how the earthquake functions. Again, haven't tested, so I'll delete this post if you try and it doesn't work.
 
#4
Right before the special in your script, try putting these in:
Code:
setvar 0x8004 0x3
setvar 0x8005 0x12
setvar 0x8006 0x12
setvar 0x8007 0x03
I haven't tested it, but I'm pretty sure that special takes parameters from those variables. If it works, you can mess around with the values there to change how the earthquake functions. Again, haven't tested, so I'll delete this post if you try and it doesn't work.
Okay, so that kinda helped, but for some reason the setmaptile isn't working...if I use a setmaptile level script, will that change forever or only if the flags are set?
 

Deokishisu

Active member
#5
Okay, so that kinda helped, but for some reason the setmaptile isn't working...if I use a setmaptile level script, will that change forever or only if the flags are set?
I'm not super sure if you need a levelscript here. You can setmaptile in a script, but the changes won't appear until you refresh the map. I don't think fadescreen triggers a map refresh. There is a special to do it, but I don't know the corresponding special in Firered. Try special 0x8E after you setmaptile, it's the one used in Victory Road in its setmaptile scripts. That may be the one you're looking for.
 
#6
I'm not super sure if you need a levelscript here. You can setmaptile in a script, but the changes won't appear until you refresh the map. I don't think fadescreen triggers a map refresh. There is a special to do it, but I don't know the corresponding special in Firered. Try special 0x8E after you setmaptile, it's the one used in Victory Road in its setmaptile scripts. That may be the one you're looking for.
It works!! Thanks so much for all your help!

The script is below (also added in a hidesprite 0x800F)
https://hastebin.com/opelomeyoy.rb
 

petuuuhhh

Active member
#7
I'm reading Avara's XSE Scripting Tutorial. I'm using XSE, Fire Red, and BPRE.

Apply Movements

The applymovement command is what you'll need if you want to make an overworld sprite move in your script:
Quote:
Originally Posted by Avara
applymovement 0x[Map Object ID] @PointerToMovements
waitmovement 0x0
If you want to move the player and not a NPC, you'll have to use 0xFF as the Map Object ID. waitmovement, as you probably guessed, means the script will wait for the movements to be finished before continuing. Let's look at a more fleshed-out example:

Originally Posted by Avara
#org @start
lock
faceplayer
msgbox @msg 0x6
applymovement 0x1 @movements
applymovement 0xFF @movements
waitmovement 0x0
release
end

#org @msg
= Let's walk three steps left!

#org @movements
#raw 0x0A
#raw 0x0A
#raw 0x0A
#raw 0xfe
Assuming our OW's "Person Event Number" in AdvanceMap is "1", we've used 0x1 as the first ID and 0xFF to make the player move along with them. Our pointer @movements contans the movement data. Where does #raw 0x0A come from? Basically, these are just identifiers for movement types. raw 0x0A is used to make the object step left in Emerald - these IDs differ between EM and FR, so make sure you don't get them mixed up! Another thing you shouldn't forget to do is add raw 0xFE at the end of your list of movements.

Movement IDs for FireRed
#raw 0x0 = Face Down
#raw 0x1 = Face Up
#raw 0x2 = Face Left
#raw 0x3 = Face Right
#raw 0x4 = Face Down (Faster)
#raw 0x5 = Face Up (Faster)
#raw 0x6 = Face Left (Faster)
#raw 0x7 = Face Right (Faster)
#raw 0x8 = Step Down (Very Slow)
#raw 0x9 = Step Up (Very Slow)
#raw 0xA = Step Left (Very Slow)
#raw 0xB = Step Right (Very Slow)
#raw 0xC = Step Down (Slow)
#raw 0xD = Step Up (Slow)
#raw 0xE = Step Left (Slow)
#raw 0xF = Step Right (Slow)
#raw 0x10 = Step Down (Normal)
#raw 0x11 = Step Up (Normal)
#raw 0x12 = Step Left (Normal)
#raw 0x13 = Step Right (Normal)
#raw 0x14 = Jump2 Down
#raw 0x15 = Jump2 Up
#raw 0x16 = Jump2 Left
#raw 0x17 = Jump2 Right
#raw 0x18 = Delay1
#raw 0x19 = Delay2
#raw 0x1A = Delay3
#raw 0x1B = Delay4
#raw 0x1C = Delay5
#raw 0x1D = Step Down (Fast)
#raw 0x1E = Step Up (Fast)
#raw 0x1F = Step Left (Fast)
#raw 0x20 = Step Right (Fast)
#raw 0x21 = Step on the Spot Down (Normal)
#raw 0x22 = Step on the Spot Up (Normal)
#raw 0x23 = Step on the Spot Left (Normal)
#raw 0x24 = Step on the Spot Right (Normal)
#raw 0x25 = Step on the Spot Down (Faster)
#raw 0x26 = Step on the Spot Up (Faster)
#raw 0x27 = Step on the Spot Left (Faster)
#raw 0x28 = Step on the Spot Right (Faster)
#raw 0x29 = Step on the Spot Down (Fastest)
#raw 0x2A = Step on the Spot Up (Fastest)
#raw 0x2B = Step on the Spot Left (Fastest)
#raw 0x2C = Step on the Spot Right (Fastest)
#raw 0x2D = Face Down (Delayed)
#raw 0x2E = Face Up (Delayed)
#raw 0x2F = Face Left (Delayed)
#raw 0x30 = Face Right (Delayed)
#raw 0x31 = Slide Down (Slow)
#raw 0x32 = Slide Up (Slow)
#raw 0x33 = Slide Left (Slow)
#raw 0x34 = Slide Right (Slow)
#raw 0x35 = Slide Down (Normal)
#raw 0x36 = Slide Up (Normal)
#raw 0x37 = Slide Left (Normal)
#raw 0x38 = Slide Right (Normal)
#raw 0x39 = Slide Down (Fast)
#raw 0x3A = Slide Up (Fast)
#raw 0x3B = Slide Left (Fast)
#raw 0x3C = Slide Right (Fast)
#raw 0x3D = Slide Running on Right Foot (Down)
#raw 0x3E = Slide Running on Right Foot (Up)
#raw 0x3F = Slide Running on Right Foot (Left)
#raw 0x40 = Slide Running on Right Foot (Right)
#raw 0x41 = Slide Running on Left Foot (Down)
#raw 0x42 = Slide Running on Left Foot (Up)
#raw 0x43 = Slide Running on Left Foot (Left)
#raw 0x44 = Slide Running on Left Foot (Right)
#raw 0x46 = Jump Facing Left (Down)
#raw 0x47 = Jump Facing Down (Up)
#raw 0x48 = Jump Facing Up (Left)
#raw 0x49 = Jump Facing Left (Right)
#raw 0x4A = Face Player
#raw 0x4B = Face Against Player
#raw 0x4C = Lock Sprite Facing
#raw 0x4D = Release Sprite Facing
#raw 0x4E = Jump Down
#raw 0x4F = Jump Up
#raw 0x50 = Jump Left
#raw 0x51 = Jump Right
#raw 0x52 = Jump in Place (Facing Down)
#raw 0x53 = Jump in Place (Facing Up)
#raw 0x54 = Jump in Place (Facing Left)
#raw 0x55 = Jump in Place (Facing Right)
#raw 0x56 = Jump in Place (Facing Down/Up)
#raw 0x57 = Jump in Place (Facing Up/Down)
#raw 0x58 = Jump in Place (Facing Left/Right)
#raw 0x59 = Jump in Place (Facing Right/Left)
#raw 0x60 = Hide Sprite
#raw 0x61 = Show Sprite
#raw 0x62 = Exclamation Mark (!)
#raw 0x63 = Question Mark (?)
#raw 0x64 = Cross (X)
#raw 0x65 = Double Exclamation Mark (!!)
#raw 0x66 = Happy (^_^)
#raw 0xFE = End of Movements

Another thing you might like to know about while we're on the subject of movements is how to move the camera. This is an example for Emerald:
Quote:
Originally Posted by Avara
#org @start
lock
faceplayer
special 0x116
applymovement 0x7F @move1up
waitmovement 0x0
msgbox @msg 0x6
applymovement 0x7F @move1down
waitmovement 0x0
special 0x117
release
end

#org @msg
= I'll move the camera!

#org @move1up
#raw 0x09
#raw 0xfe

#org @move1down
#raw 0x08
#raw 0xfe
Using 0x7F defines that we want the camera to move.
[EM] special 0x116 "unlocks" the camera (for lack of a better word) allowing it to move and special 0x117 "locks" it back in place.
[FR] In FireRed, the equivalent of these are special 0x113 and special 0x114 respectively.

That's about it for applymovement!

My question is: Why is it

applymovement 0x1 @movements
applymovement 0xFF @movements

instead of applymovement 0x1 0xFF @movements?
 
Last edited by a moderator:

Deokishisu

Active member
#8
My question is: Why is it

applymovement 0x1 @movements
applymovement 0xFF @movements

instead of applymovement 0x1 0xFF @movements?
The applymovement command is set up like so:
Code:
applymovement 0xpersonnumber 0xoffset of movement
It needs to be in that format to work. 0x1 and 0xFF are two different person events (0xFF being the player), so they need to be separate.
 

petuuuhhh

Active member
#9
The applymovement command is set up like so:
Code:
applymovement 0xpersonnumber 0xoffset of movement
It needs to be in that format to work. 0x1 and 0xFF are two different person events (0xFF being the player), so they need to be separate.
So 0x1 is for the NPC and 0xFF is for the player. Gotcha
 

petuuuhhh

Active member
#10
Name of ROM: Pokemon Fire Red
Script editor: XSE
What is the script meant to do: Display Multichoice Options and continue talking afterwards
What is the script currently doing: Displaying a few Multichoice Options and talking afterwards sometimes but not all the time
Hi! I'm trying to get this guy to give me dialogue options and it isn't working out so well. Here's a video of what I have so far: https://streamable.com/d5tqy
Script:
#dynamic 0x800000
#org @start
lock
faceplayer
msgbox @talk 0x6
waitmsg
multichoice 0xE 0x0 0x10 0x1
compare 0x8000 0x0
if 0x1 goto @yes
compare 0x8000 0x1
if 0x1 goto @no
msgbox @talk2 0x6
waitmsg
multichoice 0xE 0x0 0x0 0x1
compare 0x8000 0x0
if 0x1 goto @yes2
compare 0x8000 0x1
if 0x1 goto @no2
release
end

#org @talk
= Oh hey, you're finally up! Sorry,\nlemme introduce myself, my name\lis Mark. Professor Aspen told me\lto check up on you this morning.\lHow do you feel?
waitmsg
multichoice 0xE 0x0 0x10 0x1
copyvar 0x8000 LASTRESULT
compare 0x8000 0x0

#org @yes
msgbox @talk2 0x6
waitmsg
multichoice 0xE 0x0 0x0 0x1
compare 0x8000 0x0
if 0x1 goto @yes2
compare 0x8000 0x1
if 0x1 goto @no2
msgbox @yes2 0x6
release
end

#org @no
msgbox @talk2 0x6
waitmsg
multichoice 0xE 0x0 0x0 0x1
compare 0x8000 0x0
if 0x1 goto @yes2
compare 0x8000 0x1
if 0x1 goto @no2
msgbox @yes2 0x6
release
end

#org @talk2
= So you feel fine.... But you\ndon't remember anything? That's\lstrange. Can you at least tell me\lyour name?\pAlright then. [Player/Lucretia],\nI'll show you around in the\lmeantime and Professor will\lprobably know what to do. This\larea you are in right\lnow is the Residential Area of\lthe M.I.R.R.O.R. Building. Some\lof the researchers will rest here\land have a place to make a short\lhome. I'm sure it must be lonely\lthough.\pThis is the simulation room,\nwhere we test ourselves for The\lFlood and will practice battling\lPokémon! Do you remember being a\ltrainer at all?
waitmsg
multichoice 0xE 0x0 0x0 0x1
copyvar 0x8000 LASTRESULT
compare 0x8000 0x0
= So you know what Pokémon are, but\ndon't remember being a Trainer or\lhow to battle? I can show you\lhow, or maybe even the Professor\lonce we reach the bottom floor!\pProfessor, Professor, Professor!\n[She/He]'s alright! A little\lshort on memory, but I think we\lcould help with some of that.

#org @yes2
= So you know what Pokémon are, but\ndon't remember being a Trainer or\lhow to battle? I can show you\lhow, or maybe even the Professor\lonce we reach the bottom floor!\pProfessor, Professor, Professor!\n[She/He]'s alright! A little\lshort on memory, but I think we\lcould help with some of that.
msgbox @talk2 0x6
waitmsg
multichoice 0xE 0x0 0x0 0x1
compare 0x8000 0x0
if 0x1 goto @yes
compare 0x8000 0x1
if 0x1 goto @no
release
end

#org @no2
= So you know what Pokémon are, but\ndon't remember being a Trainer or\lhow to battle? I can show you\lhow, or maybe even the Professor\lonce we reach the bottom floor!\pProfessor, Professor, Professor!\n[She/He]'s alright! A little\lshort on memory, but I think we\lcould help with some of that.
msgbox @talk2 0x6
waitmsg
multichoice 0xE 0x0 0x0 0x1
compare 0x8000 0x0
if 0x1 goto @yes
compare 0x8000 0x1
if 0x1 goto @no
release
end
Update: I answered the question.
 
Last edited:

petuuuhhh

Active member
#11
Name of ROM: Pokemon Fire Red
Script Editor: XSE
What is the script meant to do: Generate random weather
What is the script currently doing: Nothing
Script:
#dynamic 0x71A250

'---------------
#org 0x8C457D
checkflag 0x1518
if 0x1 goto 0x893774F
goto 0x8984A41

'---------------
#org 0x93774F
checkflag 0x151B
if 0x1 goto 0x8984A41
setweather 0xD
doweather
release
end

'---------------
#org 0x984A41
random 0x16
copyvar 0x8008 LASTRESULT
compare 0x8008 0x0
if 0x1 goto 0x8984B99
compare 0x8008 0x1
if 0x1 goto 0x8984BBE
compare 0x8008 0x2
if 0x1 goto 0x8984BE3
compare 0x8008 0x3
if 0x1 goto 0x8984C08
compare 0x8008 0x4
if 0x1 goto 0x8984C2D
compare 0x8008 0x5
if 0x1 goto 0x8984C52
compare 0x8008 0x6
if 0x1 goto 0x8984C77
compare 0x8008 0x7
if 0x1 goto 0x8984B57
compare 0x8008 0x8
if 0x1 goto 0x8984B57
compare 0x8008 0x9
if 0x1 goto 0x8984B57
compare 0x8008 0xA
if 0x1 goto 0x8984B57
compare 0x8008 0xB
if 0x1 goto 0x8984B57
compare 0x8008 0xC
if 0x1 goto 0x8984B57
compare 0x8008 0xD
if 0x1 goto 0x8984B57
compare 0x8008 0xE
if 0x1 goto 0x8984B57
compare 0x8008 0xF
if 0x1 goto 0x8984B57
compare 0x8008 0x10
if 0x1 goto 0x8984B57
compare 0x8008 0x11
if 0x1 goto 0x8984B57
compare 0x8008 0x12
if 0x1 goto 0x8984B57
compare 0x8008 0x13
if 0x1 goto 0x8984A41
compare 0x8008 0x14
if 0x1 goto 0x8984B57
compare 0x8008 0x15
if 0x1 goto 0x8984B57
compare 0x8008 0x16
if 0x1 goto 0x8984A41
release
end

'---------------
#org 0x984B99
setweather 0x2
doweather
clearflag 0x1203
setflag 0x1204
setflag 0x1205
setflag 0x1206
setflag 0x1207
setflag 0x1208
setflag 0x1209
setflag 0x120A
setflag 0x120B
setflag 0x120C
release
end

'---------------
#org 0x984BBE
setweather 0x2
doweather
clearflag 0x120C
setflag 0x1204
setflag 0x1205
setflag 0x1206
setflag 0x1207
setflag 0x1208
setflag 0x1209
setflag 0x120A
setflag 0x120B
setflag 0x1203
release
end

'---------------
#org 0x984BE3
setweather 0x3
doweather
clearflag 0x120A
setflag 0x1204
setflag 0x1205
setflag 0x1206
setflag 0x1207
setflag 0x1208
setflag 0x1209
setflag 0x1203
setflag 0x120B
setflag 0x120C
release
end

'---------------
#org 0x984C08
setweather 0x5
doweather
clearflag 0x1204
setflag 0x1203
setflag 0x1205
setflag 0x1206
setflag 0x1207
setflag 0x1208
setflag 0x1209
setflag 0x120A
setflag 0x120B
setflag 0x120C
release
end

'---------------
#org 0x984C2D
setweather 0x3
doweather
clearflag 0x1205
setflag 0x1204
setflag 0x1203
setflag 0x1206
setflag 0x1207
setflag 0x1208
setflag 0x1209
setflag 0x120A
setflag 0x120B
setflag 0x120C
release
end

'---------------
#org 0x984C52
setweather 0xB
doweather
clearflag 0x1208
setflag 0x1204
setflag 0x1205
setflag 0x1206
setflag 0x1207
setflag 0x1203
setflag 0x1209
setflag 0x120A
setflag 0x120B
setflag 0x120C
release
end

'---------------
#org 0x984C77
setweather 0xD
doweather
clearflag 0x1207
setflag 0x1204
setflag 0x1205
setflag 0x1206
setflag 0x1203
setflag 0x1208
setflag 0x1209
setflag 0x120A
setflag 0x120B
setflag 0x120C
release
end

'---------------
#org 0x984B57
checkflag 0x1203
if 0x0 goto 0x8984B99
checkflag 0x120C
if 0x0 goto 0x8984BBE
checkflag 0x120A
if 0x0 goto 0x8984BE3
checkflag 0x1204
if 0x0 goto 0x8984C08
checkflag 0x1205
if 0x0 goto 0x8984C2D
checkflag 0x1208
if 0x0 goto 0x8984C52
checkflag 0x1207
if 0x0 goto 0x8984C77
release
end
Update: I answered the question.
 

petuuuhhh

Active member
#12
Name of ROM: Pokemon Fire Red
Script Editor: XSE
What is the script meant to do: Open the EV-IV-Checker on L+R
What is the script currently doing: Freezing the player in the spot that the player enters the town from
Script:
#dynamic 0x71A250

'---------------
#org @start
special2 0x8006 0x2e
callasm 0x8F90001
end
 

petuuuhhh

Active member
#13
Name of ROM: Pokemon Fire Red
Script Editor: XSE
What is the script meant to do: Make Dad appear, move him to the player, then make him dissapear
What is the script currently doing: Nothing
Script:
#dynamic 0x71A250

'---------------
#org @start
spriteface 0xFF 0x2
setvar 0x4056 0x1
lockall
goto @snippet1

'---------------
#org @snippet1
hidesprite 0x1
pause 0x20
sound 0x9
pause 0x5
showsprite 0x1
applymovement 0x1 @move1
waitmovement 0x0
msgbox @string1 MSG_NORMAL '"Happy 10th birthday! It's finally\..."
hidesprite 0x1
releaseall
end


'---------
' Strings
'---------
#org @string1
= Happy 10th birthday! It's finally\ntime you set out in the world. I\lhave three rare Digimon that I've\lcollected throughout this dark\lregion that I would like to give\lyou the choice to choose from.\lWhich will you choose?\lAgumon\lVeemon\lGuilmon\l[buffer1]? Is that your choice?\lGood! Good luck to you! Make sure\lyou talk to your Mom before you\lleave!


'-----------
' Movements
'-----------
#org @move1
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x12 'Step Left (Normal)
#raw 0x12 'Step Left (Normal)
#raw 0x12 'Step Left (Normal)
#raw 0x12 'Step Left (Normal)
#raw 0x12 'Step Left (Normal)
#raw 0x11 'Step Up (Normal)
#raw 0xFE 'End of Movements

Edit: Problem solved.
 
Last edited: