Thread: [Tutorial] PKSV Extra Scripting Tutorials
View Single Post
  #1    
Old November 22nd, 2011, 03:13 AM
The Void's Avatar
The Void
Comforter, philosopher, and lifelong mate
 
Join Date: May 2010
Location: Aboard the ship of Theseus
Gender: Male
Nature: Calm

PKSV EXTRA SCRIPTING TUTORIALS


I know there's already the PKSV Scripting Tutorial Thread by Full Metal, but that thread didn't explain all there was about scripting. That is why I've made a compilation of even more awesome scripts you an make with PKSV.


Extra Lesson 1: Weather
Spoiler:
I know this was already explained by Full Metal but I'm gonna expound on it and make it clearer for you anyway. Just follow this script I'm about to give you:

#dyn 0x740000
#org @main
lock
faceplayer
message @talk
callstd MSG_NOMRAL
setweather 0x3
doweather
release
end

#org @talk
= Behold, rain!


That was a script for rain. After the 'setweather' code, set the variable to 0x3 for rain, 0x0 for sunny, and 0x7 for snow. Just follow those guidelines and you have your very own weather code!


Extra Lesson 2: Camera Movement
Spoiler:
Camera Movement is a script that moves the camera to another position in the same map. Take a look at this video for exampe.



See that? That's what we're about to learn. Follow this code below:

#dyn 0x740000
#org @main
lock
faceplayer
msgbox @text
callstd MSG_NORMAL
special CAMERA_START
applymovement CAMERA @show
pauseevent 0x0
message @done
callstd MSG_NOCLOSE
pause 0xA
closemsg
applymovement CAMERA @return
pauseevent 0x0
special CAMERA_END
release
end

#org @text
= I will show you your house.

#org @show
= walk_left walk_left walk_left walk_left end

#org @return
= This is your house.\nNow you see.


See the script in the middle of callstd and release? Follow that pattern. It's very important you include the 'special' scripts unless you want your scripts to be all screwed up. Simple as that.


Extra Lesson 3: Setmaptile
Spoiler:
Setmaptile is a special script that allows you to change things on the map (without having to use mapping tools). As for this tutorial you would need AdvanceMap and PKSV.

So first you need to look at 4 things. The X and Y Position of the map object you want to edit and the 'Block' of the object you'll replace it with. And the movement permission of the object you'll replace it with.

You'll know how to get those by opening AdvanceMap and following what I did below:

This is how to get the X and Y Position (look at the below left of A-Map):



And then the 'Block' number (again, look at the below left of A-Map):



And then choose a movement permission:



Now gather all of that beside each other. (If the Movement Permission you chose is 1, make it 0x1, if it's C, make it 0xC, and so on. Same thing applies with the 'Block' number.)

So if I put the X and Y Position, the Block number, and the Movement Permission together, that would then be...

0xB 0x8 0x5 0x1

Now put that in your script. Just follow this pattern:

#dyn 0x740000
#org @main
lock
faceplayer
message @text
callstd MSG_NORMAL
fadescreen FADEOUT_BLACK
setmaptile 0xB 0x8 0x5 0x1 (you put your pattern here)
special 0x8E
fadescreen FADEIN_BLACK
release
end

#org @text
= Behold, the power of setmaptile!


You can add more 'setmaptile' codes if you want to put more objects. Just follow the same pattern. Note that the fadescreen codes aren't all that necessary but they just add that 'fade' effect before and after your setmaptile happens to make it look cool.


Extra Lesson 4: Warping
Spoiler:
Warping is a special script which 'forces' the player to move to another map. All we need is a 'warp' command followed by the map and map bank of the place you wanna warp in, a 0xFF command, and the new X and Y position you want your player to warp to in your map.

Open up AdvanceMap. Let's say there's a guy who wants to warp you to some random place in Victory Road. So now we have to get the map and map bank for Victory Road.



Now we have the map and map bank of Victory Road which is 1 and 39.

Next, we find the X and Y Position where the player is gonna warp to in the map. Let's make it random.



Now that we have that, let's put the map, map bank, and X and Y Position together, along with the 0xFF command. Do it in this order:

Map, Map bank, 0xFF command, X and Y Position. (Also note that if your Map or Map bank is, say, 1, then make it 0x1, and if it's 39, make it 0x39 and so on.)

In my case it's:
0x1 0x39 0xFF 0xB 0xA

Now, put all that after a 'warp' command, which you would put after your 'callstd' command in your script. And if you want, you can add the fadescreen effect like what I did in the previous lesson. So now I have...

#dyn 0x740000
#org @main
lock
faceplayer
msgbox @text
callstd MSG_NORMAL
fadescreen FADEOUT_BLACK
warp 0x1 0x39 0xFF 0xB 0xA
fadescreen FADEIN_BLACK
release
end

#org @text
= Mwahaha!\nI shall warp you to some\lrandom place!


Extra Lesson 5: Music
Spoiler:

Remember that guy in the Game Freak building in Black & White who could change your background music? Now you can do that too!

Once again, we go to AdvanceMap. Click on any map, and go to the 'Header' tab. Click on the dropdown list below Music, and pick the sound of your choice.



For this tutorial we'll use the Gamefreak theme. Get its Music no., which for us is 0141.



Now let's start with scripting. Note that I've used our music no. as an offset for the playsound command in the script.

#dyn 0x740000
#org @main
lock
faceplayer
playsound 0x141 0x0
message @talk
callstd MSG_NOCLOSE
closemsg
release
end

#org @talk
= I just made your life more awesome.


Okay, so what if we want to play the music temporarily only? Then we add the pause and fadedefault commands. This way, the music will play only for a short while before reverting to the original.

#dyn 0x740000
#org @main
lock
faceplayer
playsound 0x141 0x0
pause 0xA
fadedefault
message @talk
callstd MSG_NOCLOSE
closemsg
release
end

#org @talk
= I just made your life more awesome.



Extra Lesson 6: Shinies
Spoiler:

This is what it looks like to get a shiny:



Full tutorial here.


That's all for now. I'll be updating this as much as possible. If you have any questions, feel free to ask in this thread, or VM me directly.



Last edited by The Void; April 28th, 2014 at 04:36 PM.
Reply With Quote