What's a trigger script, you might be wondering? By a "trigger script", I mean those little green "S" tiles visible in AdvanceMap's Events tab. When your player steps on these, the script it contains will run. I'll show you how to set these up step by step!
First of all, you'll have to choose a variable to use. For example purposes, we'll be using var 0x4050. I'll draw your attention to the "Var value" box, outlined in red below:
Currently, the value is set to 0. This means that the script will only run while var 4050 has a value of 0. Let's say we want the script to run only once:
msgbox @msg 0x6
setvar 0x4050 0x1
= This is a trigger.
In this script, we've set var 0x4050's value to 1. Since the variable's value is no longer 0, the script will not run again.
If you want your trigger script to repeat itself until the variable is set somewhere else in another script, you can do this too. Maybe you want it to act as a roadblock until your player has completed a certain event.
msgbox @msg 0x6
applymovement 0xff @stepdown
setvar 0x4050 0x0
= This is a trigger.
Since this time we're keeping the variable as 0, that means this script will run every time the player steps on the "S" tile until the variable has a new value other than 0.
Just when it seems as if I'm getting closer to being finished with this tutorial, I think of something else I should have added!
It's easy to give the overworld a "fading out" effect - useful for cutscenes and such - by using the fadescreen command which looks like this:
fadescreen 0x[Fade Type Number]
What do I mean by "fade type number"? Here are the numbers for fading out to black and then reverting to normal:
Originally Posted by Avara
fadescreen 0x1 – Screen fades to black.
fadescreen 0x0 - Screen fades from black back to normal.
Time for an example script and gif so you can see how it looks in-game!
is there any way to check the weather and do things based on it? for example i would like a trainer to use a different team depending on if the weather is sunny or rainy.
so with a hypothetical command "checkweather" it would be
I Am trying to make a command to work after i am talking to an other sprite (person), for exaple:
I want 0x1200 to say a msg @talk1 0x6
Then when i talk to an other person 0x1201,
Then 0x1200 @talk1 0x6 stops and @talk2 0x5 starts, then stops and @talk3 0x6 starts, then @talk3 stop and @talk1 0x6 starts.
When i talk to an other sprite (person) 0x1202,
Then 0x1200 @talk1 0x6 stops and @talk2 0x5 starts, then stops and
@talk4 0x6 starts, then @talk4 0x6 stop and @talk1 0x6 starts.
Then 0x1200 When i talk to an other sprite (person) 0x1203,
@talk1 0x6 stop and @talk2 0x5 starts, then stops and
@talk5 0x6 starts, then @talk4 0x6 stop and @talk1 0x6
Hello, this is a great tutorial but I am having an issues I was hoping you could help with. The problem is that I have having an NPC ignore my "lock" command in a longer script. The script is for him to give me a Pokemon, then a notification appears and a fanfare plays, then I can nickname the Pokemon, and finally he tells me to take good care of his Pokemon. But when the notification appears, the NPC is released from the "lock" and starts walking around. So, when he tells me to take good care of his Pokemon, he isn't standing by me anymore, which is weird. How can I get him to stay locked until the script is totally complete? Here is my code:
if 0x0 goto @give
msgbox @2 0x2
msgbox @1 0x6
givepokemon 0x7B 0x5 0x44 0x0 0x0 0x0
fanfare 0x13E //Plays the player received pokemon fanfare
msgbox @notify 0x4
msgbox @qname 0x5 //Asks the player if they want to nickname their pokemon
compare LASTRESULT 0x1 //Checks to see if the player selected 'Yes'
if 0x1 gosub @nickname //If yes then the @nickname script will run and then return
msgbox @3 0x6
countpokemon // Stores 0x1 in LASTRESULT since we only have one pokemon now
subvar LASTRESULT 0x1 // Subtracts 0x1 from the value stored in LASTRESULT, so LASTRESULT is now 0x0
copyvar 0x8004 LASTRESULT // Copies LASTRESULT into 0x8004. Both are now 0x0
special 0x9E // 0x8004 is needed for special 0x9E
= Please take care of my Scyther\nfor me.
= How is my Scyther doing [player]?
= [Player] received SCYTHER!
= Would you like to give SCYTHER a\nnickname?
= Take good care of my Scyther!
I guess if u kno when the npc isnt locked anymore, then add the lock command after you receive the item/pokemon...i had a similar issue, but i think when u closemsg/closeonkeypress u also release anything else thats locked...u should just add another lock, no harm in doing so
Hi again, So I've been working on a ROM for some time now but recently as I've been play testing when ever I activate a GiveItem script after the
[player] revived item text the game displays a second text box that just says