Can someone tell me what variables can do? and give me an example what kind of event or thing that can variable
can do. thank you
Well, you can use variables for a lot of things, but right now I can think of some. You can variable to count how items you need to make something happen with a conditional breach. They used to create quests like how much items or enemies needed to complete quests. They can also create a random counting which can create a gambling system. You can make a bank system which the player can deposit and withdraw gold. Variables trigger like open a door to advance to the next level.
I add a picture too.
🙏
Variables are how you tell the game to "remember something". Simple as that. Switches are the same thing, but can only remember "on" or "off", so you use them for things that can only go two ways.
Some examples:
You want something random to happen. Set a variable to a random number, then run several "conditional branches" that ask "if the number is 1, do this. If the number is 2, do that" and so on.
You want dialogue choices to have consequences. Make a variable called "dialogue choice", and set it to a different number depending on which option the player picked. Later in the game, you can use conditional branches to ask what number that variable is set to, and presto - now you know which option the player picked.
You want an attack to do more damage the more times you've used it. Make an "attack usage" variable, and add 1 to it every time you use the attack. Now you know how many times it's been used.
These are just a few examples. Variables or switches (along with conditional branches) are one of the major building blocks of game design. After a while, you'll start to realize it's nearly impossible to make a game without them. 😤
(Advanced: )
In RPG Maker in particular, not every event knows how to "check" everything, like what the character's HP is, or what map you're in. You'll often need to make variables for all kinds of stuff, just so that you can run the event using those variables instead. For example, let's say you want to make a monster attack the player whenever their health is higher than the player's. Well, you can't do that in the event interface, but you CAN compare two variables. So, you set one variable to the monster's HP, a different one to the player's HP, and then compare the variables. LOTS of stuff in RPG Maker requires this kind of thing.
Any time you need need to remember something that isn't just your location, party members, stats, and items on hand. And sometimes, even those things.
What chapter of the story are you on? How many times have you talked to this person with multiple lines of dialog? How many of Guardians of the Seal have you defeated? What's your highest score in a minigame? Which party member did you leave behind to hold off the guards (so you know who's going to rejoin later)?
Let's say I have a game that has 100 steps for the main quest, and different things happen depending on which step has been completed.
I can have 100 switches - one for each step, and turn them on when their respective milestones are reached. Then I can have event pages conditioned by those switches so they do different things depending on whether or not the player has reached that milestone.
Or I can have one variable that starts at 0 (no tasks completed) and is gradually incremented as the player makes progress, and all the events check that one variable to see if the player has reached the required milestone.
I do this with my main quest and all my multi-step quests now. So much easier controlling a single variable than multiple switches when they're all a part of the same sequence.
Basically, variables are used for any form of counting. without them, you'll never be able to make a game with anything more complex than a "go there" quest.
I suggest you follow the link to the starting point in my signature, and then to the tutorial named "variables guide". That is a tutorial game, just play it.
A lot of responses, some easier to grasp than others (given you had to ask what they do). As someone who only knows the basics of their operations, I might be able to frame this in a way you can digest easier.
Variables have many different functions and applications.
The most common use of a variable to is to set up a random action. Let's say you want your games treasure chests to give semi-random items every time the player opens them, rather than the same old gear every time they start a new file.
Set your variable to random between 1 ~ 3. Then create your chests, and use conditional branches to identify the variable you set up, and tell the game what item you want the chest to produce depending on what number the variable rolls between 1 ~3 (it's like a dice roll). So you could say:
If Variable = 1: Potion given
If variable = 2: Bronze Shield given
If variable = 3: Iron Sword given
Another neat function is an actual counter system. Let's say at the end of a dungeon, you want an NPC that tells the player how mnay chests out of the total they have found and opened.
Take another variable and name it |something like Chest Count1 (1 identifies the dungeon it applies to, in this example).
At the end of each conditional branch in your chest events, Add 1 to the Chest Count1 variable. This will literally keep track of that number for the entire game, changing it as the player opens chests, from 0, to 1, to 2, and so on.
Now go to your NPC, and have him call upon that variable number to say "You opened X out of 5 chests in this forest!" X being the number kicked out by the variable data.
You can use variables to capture and store any given numeric value, then call upon it later on.
These are 2 of the most basic examples that can be given. You can use this to create any number of systems and features. The possibilities end with your imagination and creativity.
I'm far from a variable expert, so I do apologize if this is over simplified to a fault.
Thank you guys for your time explaining, now atleast i understand a bit more what can this variables can do. i don`t have any event
in my game yet that using variables so maybe soon i will use this for some events. thank you guys
Variables and Switches are storing Values. Those Values get used in Conditional Branches (If cases).
Those If cases are doing all the magic in your Game.
Switches are only 0 or 1 , that means Off or On or in other Words false or true.
Variables can be more than 0 or 1. In a NPC Event you could assign the amount of Apples, which you have in this moment in your Inventory, to a variable.
Than check in a if case if its 5 or more, and depending on the outcome you let something happen.