- Joined
- Jul 30, 2013
- Messages
- 225
- Reaction score
- 423
- First Language
- English
- Primarily Uses
- RMMV
Pretty much, let's say I have a bunch of variables, and I wish to find out which one is the highest, how would I do so?
I created this:
var maxValue = Math.max($gameVariables[1], $gameVariables[2], $gameVariables[3], $gameVariables[4], $gameVariables[5]); if($gameVariables[1] == maxValue)$gameVariables[6] = 1;if($gameVariables[2] == maxValue)$gameVariables[6] = 2;if($gameVariables[3] == maxValue)$gameVariables[6] = 3;if($gameVariables[4] == maxValue)$gameVariables[6] = 4;if($gameVariables[5] == maxValue)$gameVariables[6] = 5;but it has failed to work.
Can someone explain what I need to do?
I created this:
var maxValue = Math.max($gameVariables[1], $gameVariables[2], $gameVariables[3], $gameVariables[4], $gameVariables[5]); if($gameVariables[1] == maxValue)$gameVariables[6] = 1;if($gameVariables[2] == maxValue)$gameVariables[6] = 2;if($gameVariables[3] == maxValue)$gameVariables[6] = 3;if($gameVariables[4] == maxValue)$gameVariables[6] = 4;if($gameVariables[5] == maxValue)$gameVariables[6] = 5;but it has failed to work.
Can someone explain what I need to do?
Last edited by a moderator:
