Thread: [Scripting] A PKSV Extra Scripting Tutorial
View Single Post
  #1  
Unread November 22nd, 2011, 11:13 AM
dragon456's Avatar
dragon456
Legendary Dragon Master
 
Join Date: May 2010
Location: Earth
Gender: Male
Nature: Calm

PKSV EXTRA SCRIPTING TUTORIAL


I know there's already the PKSV Scripting Tutorial Thread by Full Metal, but that thread didn't explain all there was about scripting, anyway. So in this thread, I will explain to you how to do a few 'extra' scripting stuff using PKSV-UI.


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:
Right, so Camera Movement is a script that moves the camera to another position. Well, it's hard to explain. So let this video set an example for you.



See that? That's what we're about to learn. So first 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. See?


Extra Lesson 3: Setmaptile
Spoiler:
So 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 warp somewhere. So 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.

So again, we'll need AdvanceMap for this. So let's open it up. And let's say there's a guy who wants to warp you to some random place in Victory Road. So let's get the map and map bank for Victory Road.



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

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



So 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 tf it's 39, make 0x39 and so on.)

So 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 in my case...

#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!


That's all for now. Till next time! If you have any questions, feel free to ask.



Last edited by dragon456; November 25th, 2011 at 03:16 AM.
Reply With Quote