Displaying name of the highest variable out of a set in a text command

Status
Not open for further replies.

JamesVoss

Villager
Member
Joined
Jul 26, 2016
Messages
25
Reaction score
7
First Language
English
Primarily Uses
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?
 

Benja

Lead Developer
Veteran
Joined
Mar 5, 2014
Messages
131
Reaction score
25
First Language
English
Primarily Uses
RMVXA
First, 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:


scren.PNG


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


scren2.PNG


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!
 

JamesVoss

Villager
Member
Joined
Jul 26, 2016
Messages
25
Reaction score
7
First Language
English
Primarily Uses
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?
 

Benja

Lead Developer
Veteran
Joined
Mar 5, 2014
Messages
131
Reaction score
25
First Language
English
Primarily Uses
RMVXA
No problem! 
 

JamesVoss

Villager
Member
Joined
Jul 26, 2016
Messages
25
Reaction score
7
First Language
English
Primarily Uses
How do you want me to credit you for the script and the help?
 

Benja

Lead Developer
Veteran
Joined
Mar 5, 2014
Messages
131
Reaction score
25
First Language
English
Primarily Uses
RMVXA
Nope. No need!
 

JamesVoss

Villager
Member
Joined
Jul 26, 2016
Messages
25
Reaction score
7
First Language
English
Primarily Uses
You sure? I'll put your name (Benja) on a list of special thanks if nothing else.
 

Benja

Lead Developer
Veteran
Joined
Mar 5, 2014
Messages
131
Reaction score
25
First Language
English
Primarily Uses
RMVXA
Only if you want to. I appreciate you wanting to credit me though!
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
@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.
 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,981
Members
137,563
Latest member
cexojow
Top