Page 1 of 1

Using a dynamic source of OCEAN Traits Deeds

Posted: Wed Feb 05, 2020 5:57 am
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?

Re: Using a dynamic source of OCEAN Traits Deeds

Posted: Wed Feb 05, 2020 9:12 am
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);

Re: Using a dynamic source of OCEAN Traits Deeds

Posted: Fri Feb 07, 2020 7:02 pm
by mariomor
Thank you Tony Li! It was easier to nail it with your tip ;)

Re: Using a dynamic source of OCEAN Traits Deeds

Posted: Fri Feb 07, 2020 7:37 pm
by Tony Li
Glad to help!