Comparing two or more variables

gotnovicks

Veteran
Veteran
Joined
Feb 15, 2015
Messages
76
Reaction score
9
First Language
Portuguese
Primarily Uses
N/A
Hi!

In the begining my game, there's a small questionary to setup the main actor's personality. It's something very simple, consists in a few question and each answers add some value to one of 4 variables.

At the end I try to compare to see which variable has the higher value, defining the actor's personality. Here's the event:

<Question 1>

<Answers>

repeats until the last question, then

Script call:

(variable #5 is named Results)

var i = $gameVariables[1];var j = $gameVariables[2];var k = $gameVariables[3];var l = $gameVariables[4];if (i > j || i > k || i > l) {$gameVariables.setValue(5, 1);} elseif (j > i || j > k || j > l) {$gameVariables.setValue(5, 2);} elseif (k > i || k > j || k > l) {$gameVariables.setValue(5, 3);} elseif (l > i || l > j || l > k) {$gameVariables.setValue(5, 4);}If Results == 1

<text: You are personality X>

end

If Results == 2

<text: Your are personality  Y>

etc...

_________________

The game reads the code, does not return any error but the text with personality results does not appear D:

Can someone helps me please? @_@
 

kiriseo

Veteran
Veteran
Joined
Oct 27, 2015
Messages
229
Reaction score
74
First Language
German
You can't access the $gameVariables array like that in MV.

To get the value you have to use:

Code:
$gameVariables.value(ID);
 

gotnovicks

Veteran
Veteran
Joined
Feb 15, 2015
Messages
76
Reaction score
9
First Language
Portuguese
Primarily Uses
N/A
worked! thanks ^^
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts


The main character of the book)
Things you can say about your rpg maker project but not your bf/gf: I'm not super committed but it's fun to play around with it.
putting a puzzle in my game that BSODs the player's computer if they complete it
I finally got a book out the door after seven years of nothing \^-^/ Now if I can get a game out the door too, that'd be great...

Forum statistics

Threads
94,366
Messages
920,302
Members
124,132
Latest member
voltrone
Top