Using a dynamic source of OCEAN Traits Deeds

Announcements, support questions, and discussion for Love/Hate.
Post Reply
mariomor
Posts: 2
Joined: Wed Feb 05, 2020 5:19 am

Using a dynamic source of OCEAN Traits Deeds

Post by mariomor »

Hi,

I have a algorithm that generates deeds dynamically, i.e. OCEAN traits based deeds coming from a algorithm which I developed to fit in my game(using a set of variables, statistics, etc).

As such I don't feel the need to use Deeds Templates as these are static/pre-defined. Therefore, I'd like to report the Deed that my algorithm generates dynamically using, for instance:

Deed dynamicDeed = new Deed();
dynamicDeed .Assign("tag", issuerFactionMember.factionID, impact, aggression, actorPowerLevel, traits, PermittedEvaluators.EveryoneExceptTarget);


Questions:
1) Is the method above the best way to report a dynamic deed? Do you advise any other approach, using L&H API?
2) Traits argument above is of float[] type, so basically something like {0,5; 0.3; -10, 10, 25}. How can I guarantee the match between the OCEAN traits and the OCEAN values? the first position in the array stands for O trait, second position for C and so on?

BR,
Mario.

p.s. can you please add some code sample for my better understanding?
User avatar
Tony Li
Posts: 22086
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using a dynamic source of OCEAN Traits Deeds

Post by Tony Li »

Hi Mario,

Yes to both questions. The order of the traits should match the order of the personality traits in your faction database (i.e., O-C-E-A-N).

For efficiency, Love/Hate uses pools instead of instantiating and destroying objects at runtime. Here's some example code:

Code: Select all

// Romeo kisses Juliet. Define the deed:
string tag = "kiss";
int targetFactionID = Juliet.factionID;
float impact = 10;
float aggression = 2;
float actorPowerLevel = Romeo.GetPowerLevel();
float[] traits = new float[5] { 10, 0, 20, 5, -10 }; // Openness, Conscientiousness, Extraversion, Agreeableness, Neuroticism
var deed = Deed.GetNew(tag, targetFactionID, impact, aggression, actorPowerLevel, traits);

// Report the deed:
bool requiresSight = true;
FactionManager.instance.CommitDeed(Romeo, deed, requiresSight);

// Release the deed object:
Deed.Release(deed);
mariomor
Posts: 2
Joined: Wed Feb 05, 2020 5:19 am

Re: Using a dynamic source of OCEAN Traits Deeds

Post by mariomor »

Thank you Tony Li! It was easier to nail it with your tip ;)
User avatar
Tony Li
Posts: 22086
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using a dynamic source of OCEAN Traits Deeds

Post by Tony Li »

Glad to help!
Post Reply