Post by PrimalDialga on Feb 17, 2015 17:17:43 GMT 1
Slowpoke's PKSV Scripting Tutorial
Hey all, my name is Slowpoke13 (you probably know me as the administrator of this forum) and I made a scripting tutorial for the beginning scripters. I'm gonna learn you the basics of PKSV, so remember scripting tutorials that are labeled XSE are useless to your newly-found skills.
Requirements
What do you need for this tutorial(s):
PKSV-UI
a Generation III Pokémon ROM
Advance Map
a GBA emulator
Content
Post #1: Person talking
Person talking
So we're jumping right to the point with our first script: person talking. This is a basic script found in a Pokémon game:
I will explain this script row per row.
If you understood, let's continue on.
Text
As you have read, the part 'msgbox @text' points at the '#org @text' part. You can call this anything you like (and I recommend that, too. It's always fun to write scripts that point to @donut or @chocolatecookies XD) but you should give the #org part the same name. Ex. if you type 'msgbox @milkshake' you should call your org '#org @milkshake'.
The \n and \p you read in the original code are actually used for line breaks and such. The text in the script would actually display in-game as: (a white row means a new box)
So that generally means a \n is a line break and a \p starts a new box. \l also exists. This means that the previous line is slided to the upper line in a two-row box and the new line appears underneath. Note that for the use of \l you need to have used \n in the same box.
Compiling
Now you know how to write a talking script, you probably want to know how to insert it into the game. In PKSV, click the gear button located towards the upper-right and scroll down (in the pop-up screen) until you find @main -or whatever you called it in your script- and copy the offset there (without the 0x). (Yes the name thing applies for all #org's. And please always double check your game is opened in PKSV. I have seen some really strange results.) You can also click the backmost screen of the two pop-ups and copy the upmost offset. (But since I don't use the last way I don't know if this copies the 0x with it. To be clear, never copy the 0x) Now open Advance Map and your game, go to LITTLEROOT TOWN or PALLET TOWN or whatever the starting town is called, and create a new event. (If you don't know how to do that, read Advance Map tutorials) The new event has a Script Offset box somewhere towards the bottom of its section. Now paste the earlier copied offset over the last six zero's. Strange things will happen if you touch the first two. Now open your ROM in the emulator of your choice and go talk to the new event. It should say what you wrote in the '#org @text' part. If it doesn't say it, read the tutorial all over again and try it again. Don't worry, you'll get used to failing as a scripter. (I fail at least two scripts every day. Yes, it's true) And it only took you minutes to write this little script. You should feel disappointed when a script that took half an hour fails. And you even have to get used to that.
Still failing?
Have you read the tutorial at least three times and you're still failing? Perhaps your game is bugged. Try downloading a new ROM from another source and try again. If it still doesn't work, send me an IPS patch of your ROM plus the script file you used in a PM.
Happy hacking!
Thread style written by ddb
Hey all, my name is Slowpoke13 (you probably know me as the administrator of this forum) and I made a scripting tutorial for the beginning scripters. I'm gonna learn you the basics of PKSV, so remember scripting tutorials that are labeled XSE are useless to your newly-found skills.
Requirements
What do you need for this tutorial(s):
PKSV-UI
a Generation III Pokémon ROM
Advance Map
a GBA emulator
Content
Post #1: Person talking
Person talking
So we're jumping right to the point with our first script: person talking. This is a basic script found in a Pokémon game:
#dyn 0x740000
#org @main
lock
faceplayer
msgbox @text
callstd MSG_NORMAL
release
end
#org @text
= Technology is incredible! \pYou can now store and recall items \nand POKéMON as data via PC.
I will explain this script row per row.
#dyn 0x740000 ' Is needed to begin a script. The 0x740000 is actually an offset the compiler uses to find free space. Always start a script with this.
#org @main ' Will be converted into an offset by the compiler. Just always put this in.
lock ' Locks the player on its place, so you can't be rude and go away while someone's talking.
faceplayer ' Makes the NPC the player talks to face the player.
msgbox @text ' Loads a message box with the text contained in the string 'text'. Can be named anything you like, as long as the string with the text is named the same.
callstd MSG_NORMAL ' Sets the 'callstd' of the previous row. This is a normal message, so the callstd is simply MSG_NORMAL.
release ' Releases the player from the 'lock' used earlier.
end ' Ends the script.
#org @text ' Same as 'org @main'.
= Technology is incredible... ' The text that shows up when the script reaches 'msgbox @text'. Note that the = is needed for it to work. The \n and \p will be explained later.
If you understood, let's continue on.
Text
As you have read, the part 'msgbox @text' points at the '#org @text' part. You can call this anything you like (and I recommend that, too. It's always fun to write scripts that point to @donut or @chocolatecookies XD) but you should give the #org part the same name. Ex. if you type 'msgbox @milkshake' you should call your org '#org @milkshake'.
The \n and \p you read in the original code are actually used for line breaks and such. The text in the script would actually display in-game as: (a white row means a new box)
Technology is incredible!
You can now store and recall items
and POKéMON as data via PC.
You can now store and recall items
and POKéMON as data via PC.
So that generally means a \n is a line break and a \p starts a new box. \l also exists. This means that the previous line is slided to the upper line in a two-row box and the new line appears underneath. Note that for the use of \l you need to have used \n in the same box.
Compiling
Now you know how to write a talking script, you probably want to know how to insert it into the game. In PKSV, click the gear button located towards the upper-right and scroll down (in the pop-up screen) until you find @main -or whatever you called it in your script- and copy the offset there (without the 0x). (Yes the name thing applies for all #org's. And please always double check your game is opened in PKSV. I have seen some really strange results.) You can also click the backmost screen of the two pop-ups and copy the upmost offset. (But since I don't use the last way I don't know if this copies the 0x with it. To be clear, never copy the 0x) Now open Advance Map and your game, go to LITTLEROOT TOWN or PALLET TOWN or whatever the starting town is called, and create a new event. (If you don't know how to do that, read Advance Map tutorials) The new event has a Script Offset box somewhere towards the bottom of its section. Now paste the earlier copied offset over the last six zero's. Strange things will happen if you touch the first two. Now open your ROM in the emulator of your choice and go talk to the new event. It should say what you wrote in the '#org @text' part. If it doesn't say it, read the tutorial all over again and try it again. Don't worry, you'll get used to failing as a scripter. (I fail at least two scripts every day. Yes, it's true) And it only took you minutes to write this little script. You should feel disappointed when a script that took half an hour fails. And you even have to get used to that.
Still failing?
Have you read the tutorial at least three times and you're still failing? Perhaps your game is bugged. Try downloading a new ROM from another source and try again. If it still doesn't work, send me an IPS patch of your ROM plus the script file you used in a PM.
Happy hacking!
Thread style written by ddb