Introduction to Variables
Thanks for reading the 3rd installment in my Switches/Variables Guide for RPG Maker VX!
This part is here to show you how to get started on using and understanding Variables.
Variables in RPG Maker are basically a value holder. If you ever want your game to remember a specific value for any reason at all, Variables are what you should be using. There's alot of things you can do for your game using variables. They can even be used as Switches if you find yourself using way too many actual Switches.
Let's get started with your scenario for this part of the Tutorial!
An NPC tells your Hero he will give him a key if you defeat 3 slimes.
First. We set up the slimes. Even though you may already have an Enemy named Slime...Make a new one!
Set the Enemy up however you would like to.
Next. Make a new Troop for the Slime. Just put one slime in the Enemy Troop.
Now. In the Battle Events...
Set the Conditions to happen If the Slime's HP = 0 or lower.
Now, make a new event to Control Variables.
Select and name a Variable, as you would a Switch. Name this Variable "Slime's Defeated".
Set up the Event to Add a Constant of 1 to the Variable you just made.
What you just did is made a Battle where once the enemy is Defeated, the Variable, Slime's Defeated, increases by one.
If you want to have more than one Enemy, but still want the number of enemy's defeated to be counted, just add another Enemy into the Troop and change the Constant of 1 to a Constant of X; where X = how many Enemies are in the Troop.
Set up a place for the Hero to fight this group of Enemies.
Onto the NPC. This event will handle both Switches and Variables...
So, let's hope you were paying attention in the last two Parts.
Make a new Event for the NPC. Name it whatever you like.
Set the Graphic as whatever you like.
Make 3 new Pages. You should now have 4 Pages altogether.
Quote
FIRST PAGE
Make this event the Same Level as Character and Start at a Button Push.
Have the NPC ask the Hero to defeat x amount of Slimes or whatever Enemy you have chosen.
Once the Hero agrees, set a new Switch named "NPC Talk" to on.
Make this event the Same Level as Character and Start at a Button Push.
Have the NPC ask the Hero to defeat x amount of Slimes or whatever Enemy you have chosen.
Once the Hero agrees, set a new Switch named "NPC Talk" to on.
What the 1st Page does is set up the Enemy Hunt.
Quote
SECOND PAGE
Make the Event Starting Conditions If Switch NPC Talk is On and if Button is Pushed(obviously).
Have the NPC say something like "You still haven't defeated x Slime's yet!".
Make the Event Starting Conditions If Switch NPC Talk is On and if Button is Pushed(obviously).
Have the NPC say something like "You still haven't defeated x Slime's yet!".
This Event Page only occurs if the Hero talks to the NPC before he has defeated x Enemies.
Quote
THIRD PAGE
Make the Event Starting Conditions If Switch NPC Talk is On and If Variable Slime's Defeated is 3 or Greater and if a Button is Pushed.
Now have the NPC thanking the Hero for defeating the Slimes.
Have the NPC add the Key, or whatever Item/etc. you want the Hero to gain for helping the NPC...
And, set a final switch called "Slime Hunt Over" to on.
Make the Event Starting Conditions If Switch NPC Talk is On and If Variable Slime's Defeated is 3 or Greater and if a Button is Pushed.
Now have the NPC thanking the Hero for defeating the Slimes.
Have the NPC add the Key, or whatever Item/etc. you want the Hero to gain for helping the NPC...
And, set a final switch called "Slime Hunt Over" to on.
This Event Page is to reward the Hero once x Enemies have been defeated.
Then, it ends the process and the following Event Page happens from now on...
Quote
FOURTH PAGE
Make the Event Starting Conditions If Switch Slime Hunt Over is On and if the Hero Pushes a Button.
Have the NPC say something like "Thanks again for the help! I hope that Key was useful!"
Make the Event Starting Conditions If Switch Slime Hunt Over is On and if the Hero Pushes a Button.
Have the NPC say something like "Thanks again for the help! I hope that Key was useful!"
That's it! Pretty simple once you dive in there, right?
I hope you found this useful!