• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

PKSV scripting Tutorial/Script Thread

Full Metal

C(++) Developer.
810
Posts
16
Years
This is very odd indeed, although I'm not sure I understood what you're saying completely.
Perhaps you have too many events in your map? say...more than 0xFFFFFF ( more than 6,000 ) ? If not, I'm at a loss as to what the problem could be without actually seeing your script.
 

slowbro42

The World's Worst Hacker
6
Posts
13
Years
Oh I figured it out soon after, the personevent# was the same as another sprite...Duh. But one last thing:

I am creating a three-person givepokemon yes/no script (i.e. each person offers a pokemon). When the player selects the one pokemon he/she wants then all the 3 sprites should disappear but when I leave the town and back the sprites reappear. If i perform the event again they disappear for good therefore letting the player select an unwanted second starter. Here's my script that is very similar to the other 2:

#dyn 0x800000
#org @main
lock
faceplayer
message @intro
callstd MSG_NORMAL
checkflag 0x1000
if == jump @haveit
showpokepic CYNDAQUIL 0xA 0x3
message @talk
callstd MSG_YESNO
compare LASTRESULT YES
if == jump @pushedyes
jump @pushedno

#org @haveit
release
end

#org @pushedyes
hidepokepic
addpokemon CYNDAQUIL 5 ORANBERRY 0 0 0
setflag 0x828
fanfare 0x13E
waitfanfare
message @take
callstd MSG_NORMAL
fadescreen FADEOUT_BLACK
disappear 0x4
disappear 0x5
disappear 0x6
fadescreen FADEIN_BLACK
setflag 0x1000
release
end

#org @pushedno
hidepokepic
message @notake
callstd MSG_NORMAL
release
end

#org @intro
= Hi there \v\h01!\nI bet your headed toward Route 1\lhuh?\pWell first you have to have a\nPok\emon for protection.\lYou can have one from one of us\nso choose wisely.

#org @talk
= I hold Cyndaquil the Fire\nPok\emon, would you like him?

#org @howsit
= I hope you do well on your journey,\nso good luck.\lDon't forget to say bye to your mom.\nWe must go now.

#org @take
= Great choice!\nCyndaquil will serve you well.

#org @notake
= Okay then, but you must choose a\nPok\emon reguardless.

I have tried adding extra flags and repositioning my 'setflag 0x1000' but nothing seems to work. help if you can
 
15
Posts
13
Years
all you need to do is, make the person ids of the sprites that you want to disappear the same number as the flag you set, so in your case the sprites would have an id of 1000
 
6
Posts
12
Years
  • Seen Jan 20, 2014
Hey, I'm really new to this whole hacking thing, but I'm really interested in it and really want to try my hand at it, so I came here to look for help. I really didn't think I'd understand all this scripting stuff, but I'm really happy that I understood what you wrote here. Thank you so much, this tutorial is so helpful, but I still don't think I fully understand everything here.
I don't really understand the situation in which I would use these scripts. Like, I don't know really when I'd have to use the variables, or level scripts, and other things like that. I also have no idea how to make a trainer battle, or to make people move, and other stuff that I know I would need to create a hack.
This tutorial really gave me hope, and I know that with a little more help I could understand it fully. I've seen that you've wanted to add new lessons to this, but that was years ago, and I'm sad because of that. Your tutorial is so easy to understand, I really hope you do get the motivation to add more lessons so people like me can understand how to script things like battles and movement, etc.
I also think another thing to add to help would be situations in which the scripts would apply. Like, when you would use the level scripts and what you use them for. Same with the variable scripts. Because I know that even though I understand how to write them, I have no clue as to what to use them to do.
Sorry if this was a lot, this is my first post on this site and your tutorial just gave me so much hope and excitement for this. I don't want to give up because I have no idea how to do something that isn't taught in this tutorial, so I really do hope you decide to continue your wonderful teaching of PKSV! :)
 

The Void

hiiiii
1,416
Posts
13
Years
Hey, I'm really new to this whole hacking thing, but I'm really interested in it and really want to try my hand at it, so I came here to look for help. I really didn't think I'd understand all this scripting stuff, but I'm really happy that I understood what you wrote here. Thank you so much, this tutorial is so helpful, but I still don't think I fully understand everything here.
I don't really understand the situation in which I would use these scripts. Like, I don't know really when I'd have to use the variables, or level scripts, and other things like that. I also have no idea how to make a trainer battle, or to make people move, and other stuff that I know I would need to create a hack.
This tutorial really gave me hope, and I know that with a little more help I could understand it fully. I've seen that you've wanted to add new lessons to this, but that was years ago, and I'm sad because of that. Your tutorial is so easy to understand, I really hope you do get the motivation to add more lessons so people like me can understand how to script things like battles and movement, etc.
I also think another thing to add to help would be situations in which the scripts would apply. Like, when you would use the level scripts and what you use them for. Same with the variable scripts. Because I know that even though I understand how to write them, I have no clue as to what to use them to do.
Sorry if this was a lot, this is my first post on this site and your tutorial just gave me so much hope and excitement for this. I don't want to give up because I have no idea how to do something that isn't taught in this tutorial, so I really do hope you decide to continue your wonderful teaching of PKSV! :)

You use vars and flags when you want to trigger a certain event or make an event happen only once. Level scripts are scripts used when you enter the map, like a script that triggers upon entering. They're pretty simple and I don't think they need to be added to the thread, though. If you have any questions, you are welcome to VM/PM me. You might also want to check this thread I made out because they teach a few other script variants not mentioned in this thread. I wish you the best of luck in your journey towards mastery. :)
 
8
Posts
12
Years
  • Seen Apr 17, 2014
Hello Everyone!
I need help one something!

Basically, I'm trying to import FRLG maps into Emerald,
To create a "super region" in that sense,
And I'm currently encountering issues with
Connections (I linked them properly on Advance Map, but it doesn't load or becomes one way even though I make it two way)
and also my more pressing issue,

:Remember HGSS, where wild encounter music is different for different region.
I'm trying to incorporate that,
So I'm wondering if there is any script that can change wild battle and trainer battle music in that region, and it will reset to normal battle theme when I leave Kanto and head back to Hoenn!
thanks!
 

droomph

weeb
4,285
Posts
12
Years
Hello Everyone!
I need help one something!

Basically, I'm trying to import FRLG maps into Emerald,
To create a "super region" in that sense,
And I'm currently encountering issues with
Connections (I linked them properly on Advance Map, but it doesn't load or becomes one way even though I make it two way)
and also my more pressing issue,

:Remember HGSS, where wild encounter music is different for different region.
I'm trying to incorporate that,
So I'm wondering if there is any script that can change wild battle and trainer battle music in that region, and it will reset to normal battle theme when I leave Kanto and head back to Hoenn!
thanks!
You will need to make a whole separate behavior byte identical to the normal grass, but refers to a special that plays the second theme instead when you encounter a Pokémon.
 
8
Posts
12
Years
  • Seen Apr 17, 2014
An asm code that loads all other data expect for the music byte from the assembly of normal grass (you've got to be familiar with hex editing before trying to do this though).

Thing is, I don't know what is the offset for ASM nor what to change on it.

I found an interesting site, however it is for FRLG.

(I cannot link the site cause I have yet to reach 15 post count, instead i'll add it to a notepad file.)
 
3
Posts
12
Years
  • Seen Jul 14, 2012
Decompiling

Hello. Your tutorial helped, but what do I do when im ready to decompile it, and how do I put it in the game via Advanced Map?
 
28
Posts
12
Years
  • Seen May 1, 2022
Need lots of help!!!

Hi, i am trying to use pokescript to script events in a fire red rom.

I am having a lot of problems i was hoping someone could help me out with.

Basically, every time i script something (i use the templates they give us) i than hit save (save to its own folder, is this right? - as a .pks or whatever) and than i dont know what to do, with the offsets.

What offset to i set to the event? for trainers is it the one it says in PET? and after i am done with all the scripting stuff, do i compile or decompile? and from there what do i do???

Please help me!!!
 
5
Posts
13
Years
  • Seen May 9, 2012
activating script on tile.

Hi, i am trying to use pokescript to script events in a fire red rom.

I am having a lot of problems i was hoping someone could help me out with.

Basically, every time i script something (i use the templates they give us) i than hit save (save to its own folder, is this right? - as a .pks or whatever) and than i dont know what to do, with the offsets.

What offset to i set to the event? for trainers is it the one it says in PET? and after i am done with all the scripting stuff, do i compile or decompile? and from there what do i do???

Please help me!!!

If you were using PKSV which it says you're not, you type the offset for @start or @main and put it into advanced map, after hitting compile ofcourse.

Now for my own question, i've scripted a dozen or so events that involve interacting with things and i've gotten the hang of it, but i am trying to make a script that triggers when you step on the tile. You know like when you havent progressed enough and someone comes and rejects you from walking into a new area, or a rival battle when you walk on the tile. I've tried everything, can anyone give me some guidance? does it need a lock/faceplayer or lockall? or pauseevent 0x0? any help would be appreciated.
 
28
Posts
12
Years
  • Seen May 1, 2022
i'm still confused, you said i am not using pksv... is that not what pokescript is? and the rest of that was all nonsense to me. I have no idea what i am doing and there is no @start or @main in my script, and i am using the template pksv gives me :/

i think my only problem is not saving it correctly. once i type in what i want, what are the exact steps i need to do to save it properly (even with compiling - do i just click compile and then be done with it? or do i do something with the information?)

please, can someone give me some step by step instruction on what to do, i have been searching for days now :/
 
5
Posts
13
Years
  • Seen May 9, 2012
I thought pokescript and pksv were different, could be wrong. Anyways, the script generator in pksv should have an @start, it will be the second line. Once you've made your script you press compile and it will spit out a few offsets depending how many dynamic ones you've made. two windows will pop up, go to the one saying dynamic offsets and it will say something like

@start <-> 0x746286 (0x18 bytes) <-----this is the only offset you will put
@talk <-> 0x74629E (0x6F bytes) into advanced map
@move <-> 0x74630D (0x2 bytes)

just take 0x746286 (@start) and remove the 0x and put it into advanced map in the script offset box.
$00746286 <--- it needs a $ and the two 0s at the front

those are example offsets, yours will be different. hope i helped.
 
28
Posts
12
Years
  • Seen May 1, 2022
ok, so i have been doing it correctly :/

any suggestions on why it has not been working for me?

I have the trainer ID set to the person i changed in PET and the offsets match, i use the template and type in 0x002 (the trainer im using) and it loads the template. i than change the green text to what i want it to say. i save it. compile it. and make sure the offsets match. i then exit and save my game in A-Map.
 
5
Posts
13
Years
  • Seen May 9, 2012
After the explanations i gave you, i'm not sure i understand what you're trying to do my friend...
 
28
Posts
12
Years
  • Seen May 1, 2022
I am trying to set up a trainer script.

I have the trainer ID set to which trainer i want in PET.

I use the script generator and it asks me to type in the trainer i want (i type in 0x002) it loads the script.

I then change the text it says to what i want. I save, compile, copy the offset, exit, and save my file in advance map. I load up the ROM but the trainer does nothing.

I also tried copying my one working trainer script (dont know how i did it) into my new one. The trainer loads now but it has the ??? pokemon. I also cannot change what he says, it always loads back up to the other trainer, even after i change the text, save, and compile again.

I am bad at this...
 
9
Posts
11
Years
  • Seen Dec 30, 2022
I have a problem , after i doing a script and copy the @start to the offist , I'm open the script again and its change to : callstd MSG_LOCK ' Built-in lock command ,
how i'm fix that?
 
Back
Top