Finding highest personality trait value?

Announcements, support questions, and discussion for Love/Hate.
Post Reply
aotihav
Posts: 6
Joined: Thu Sep 13, 2018 6:35 pm

Finding highest personality trait value?

Post by aotihav »

First of all, thank you so much for Love/Hate! It's really a great asset!
I was wondering if there was a way to find the highest personality trait value at a given time: e.g. a character with 50 Respect, -50 Deception, and 75 Loyalty returning Loyalty as the highest value? I completely understand if that's outside the scope of Love/Hate.
User avatar
Tony Li
Posts: 20723
Joined: Thu Jul 18, 2013 1:27 pm

Re: Finding highest personality trait value?

Post by Tony Li »

Hi,

There isn't a built-in method or visual scripting action, but you can check it manually in a little method, something like:

Code: Select all

var db = FactionManager.instance.factionDatabase;
var faction = db.LookupFactionByName("Some Name");
int highestIndex = 0;
int highestValue = -100;
for (int i = 0; i < faction.traits.Length; i++)
{
    if (faction.traits[i] > highestValue) highestIndex = i;
}
Debug.Log("Highest trait is " + db.personalityTraitDefinitions[highestIndex].name + " at " + highestValue);
Post Reply