HELP USING VARIABLES IN A DATING GAME
Posts
Pages:
1
The program is RPG MAKER VX ACE
Say you have a game where you can build a relationship with characters depending on your actions. These actions will cause you to gain "points" with that character while losing points with others. At the end of a chapter, whomever has the most points will trigger a different ending. Seems easy, or at least I thought. I have everything in place except HOW TO COMPARE THE VALUE OF A VARIABLE AGAINST SEVERAL OTHERS. Either there is something I am missing or it is, dare I say, impossible. Any suggestions are very welcome.
Say you have a game where you can build a relationship with characters depending on your actions. These actions will cause you to gain "points" with that character while losing points with others. At the end of a chapter, whomever has the most points will trigger a different ending. Seems easy, or at least I thought. I have everything in place except HOW TO COMPARE THE VALUE OF A VARIABLE AGAINST SEVERAL OTHERS. Either there is something I am missing or it is, dare I say, impossible. Any suggestions are very welcome.
The most basic way is to use conditional branches.

The first variable is the one you are checking. Normally you use the "Constant" option and put a number. So you ask "Is variable 1 greater than 5 - yes or no". But instead of a number, you use a variable. So then you are asking "Is variable 1 greater than variable 2". You are comparing 2 variables.
It can check if 1 variable is greater than, equal to, or less than another variable. One at a time, one per branch. You would then use other switches or variables to determine the follow up events.
So for example here's an empty branch.
Branch --
\
Else
\
End
First you set the variables to check.
Branch -- if var1 is greater than var2
\
Else
\
End
Let's say variable 1 is your feelings towards Dawn and variable 2 is your feelings toward Julie. As you play the game and do something nice for Dawn, var1 is increased. So when you want to check who has more feelings you make that branch.
Variable 1 = 15
Variable 2 = 20
Let's see what would happen if I plug in these values to the previous branch
Branch -- if 15 is greater than 20
\ The code for Yes
Else
\ The code for No
End
In this case, the answer is no. Which tells you that you like Julie more. So then you need to add a piece of code that remembers which one is higher. There are a few ways to do that.
You could use a switch:
Branch -- if var1 is greater than var2
\ Turn ON switch 1 "I like Dawn more"
Else
\ Turn ON switch 2 "I like Julie more"
End
or another variable:
Branch -- if var1 is greater than var2
\ Set variable 3 "Which person do I like more" to 1
Else
\ Set variable 3 "Which person do I like more" to 2
End
Does that make sense?
It can be time consuming to check many variables against each other, but that is the most basic example and it's the first thing you need to understand in order to do the more complicated ones. I can explain further if you understand.

The first variable is the one you are checking. Normally you use the "Constant" option and put a number. So you ask "Is variable 1 greater than 5 - yes or no". But instead of a number, you use a variable. So then you are asking "Is variable 1 greater than variable 2". You are comparing 2 variables.
It can check if 1 variable is greater than, equal to, or less than another variable. One at a time, one per branch. You would then use other switches or variables to determine the follow up events.
So for example here's an empty branch.
Branch --
\
Else
\
End
First you set the variables to check.
Branch -- if var1 is greater than var2
\
Else
\
End
Let's say variable 1 is your feelings towards Dawn and variable 2 is your feelings toward Julie. As you play the game and do something nice for Dawn, var1 is increased. So when you want to check who has more feelings you make that branch.
Variable 1 = 15
Variable 2 = 20
Let's see what would happen if I plug in these values to the previous branch
Branch -- if 15 is greater than 20
\ The code for Yes
Else
\ The code for No
End
In this case, the answer is no. Which tells you that you like Julie more. So then you need to add a piece of code that remembers which one is higher. There are a few ways to do that.
You could use a switch:
Branch -- if var1 is greater than var2
\ Turn ON switch 1 "I like Dawn more"
Else
\ Turn ON switch 2 "I like Julie more"
End
or another variable:
Branch -- if var1 is greater than var2
\ Set variable 3 "Which person do I like more" to 1
Else
\ Set variable 3 "Which person do I like more" to 2
End
Does that make sense?
It can be time consuming to check many variables against each other, but that is the most basic example and it's the first thing you need to understand in order to do the more complicated ones. I can explain further if you understand.
author=Link_2112
The most basic way is to use conditional branches.
It can be time consuming to check many variables against each other, but that is the most basic example and it's the first thing you need to understand in order to do the more complicated ones. I can explain further if you understand.
I was afraid it would come to all of that, but I will give it a try. I've got 7 characters. I do understand this and was able to keep up. I may put this game to the side and start one with, like, three characters, to get the variable-ing right. You really know your stuff, thank you.
Pages:
1













