I'm looking for a way to have the highest variable out of a set of several to display in a text command (Specifically scrolling text). The specific context is that the PC will be able to make several choices throughout the game that will add to variable keeping track of how many times they preformed a Sin/Virtue. Upon death, I want a scrolling message to inform the player the were transformed into a demon of whichever sin they exibited most and then display more information about the story. Is there an easy way to do this (With or without a script)? Will I need to forgo having it be a scrolling text box?
Displaying name of the highest variable out of a set in a text command
RPG Maker VXAce SupportFirst, add this small script:
class Game_Interpreter
def highest_var(*args)
args.collect {|id| $game_variables[id]}.max
end
end
Then, in a script call before the text, add this, changing the numbers in vars to the variable numbers that count the sins
vars = [1,2,3,4,5,6,7]
$game_variables[INSERT VARIABLE NUMBER HERE] = highest_var(*vars)
Then, 7 conditional branches all in each other's ELSE condition. All of these conditional branches should be checking if the variable you chose to check the highest number is equal to one of the 7 sin variables like so:

Then, in a script call, put this in one of the conditional branches
txt = "INSERT SIN HERE"
$game_variables[INSERT FREE VARIABLE] = txt
Copy and paste that script call, changing it to different sins every time

Then, finally, in the text, when you want to say the sin simply put \v[Whatever variable you put the text in]
Hope this helps!
class Game_Interpreter
def highest_var(*args)
args.collect {|id| $game_variables[id]}.max
end
end
Then, in a script call before the text, add this, changing the numbers in vars to the variable numbers that count the sins
vars = [1,2,3,4,5,6,7]
$game_variables[INSERT VARIABLE NUMBER HERE] = highest_var(*vars)
Then, 7 conditional branches all in each other's ELSE condition. All of these conditional branches should be checking if the variable you chose to check the highest number is equal to one of the 7 sin variables like so:

Then, in a script call, put this in one of the conditional branches
txt = "INSERT SIN HERE"
$game_variables[INSERT FREE VARIABLE] = txt
Copy and paste that script call, changing it to different sins every time

Then, finally, in the text, when you want to say the sin simply put \v[Whatever variable you put the text in]
Hope this helps!
Thank you so much! I wasn't even sure something like this was possible but it works great! Now how do I report my question answered?
No problem!
How do you want me to credit you for the script and the help?
Nope. No need!
You sure? I'll put your name (Benja) on a list of special thanks if nothing else.
Only if you want to. I appreciate you wanting to credit me though!
@JamesVossWhen you want your thread closed, simply Report your opening post using the clickable 'Report Post' at the top of the post, and ask for it to be closed. Mods might miss individual posts, but will see Reports. So, picking up on your post of earlier today...
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
Original thread: https://forums.rpgmakerweb.com/threads/displaying-name-of-the-highest-variable-out-of-a-set-in-a-text-command.65880/