Modeling relationship reactions to deeds

Announcements, support questions, and discussion for Love/Hate.
Post Reply
joeykid6
Posts: 17
Joined: Thu Feb 07, 2019 1:57 pm

Modeling relationship reactions to deeds

Post by joeykid6 »

Hi Tony,

So, I'm trying to make sense of how to model the effects of a deed depending on relationship status. It's probably easiest to explain with an example.

Let's say I have a deed called "Flirt" and a relationship trait called "Lust." Let's say NPC-Jack feels high Lust toward NPC-Jill. In this case, if Jill flirts with Jack, I want the Flirt deed to cause a positive reaction (i.e. increased arousal and pleasure and increased lust for Jill). This is assuming that Jack's personality traits make him receptive to flirting.

However, let's say there's another NPC called Margaret, and Jack is not lusting after her but is instead repulsed by her. If Margaret flirts with Jack, this should produce a negative reaction in Jack (maybe higher arousal with much lower pleasure and even lower lust in the relationship trait). This should happen even though Jack is generally receptive to flirting.

I guess my question is whether this is all built into the system or if I need to add an additional layer of my own. In other words, as far as I can tell, the alignment of personality traits is the primary factor that affects how a deed is received, not the state of the relationship. If that's the case, how do I factor in relationship traits and values to the equation?

Or am I just misunderstanding something about the evaluation algorithm?

Let me know what you think, thanks!

Best,
Joe
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Modeling relationship reactions to deeds

Post by Tony Li »

Hi Joe,

You will want to add an additional evaluation function for two reasons:

1. The basic evaluation function affects PAD and affinity, but not custom-defined relationship traits.

2. In Love/Hate's default model, a deed always has a positive or negative impact. If you define Flirt as having a positive impact, then when Jill flirts with Jack, Jack will perceive it as positive -- and when Margaret flirts with Jack, Jack will still perceive it as positive. So, using the default function, Jack will soften his attitude toward Margaret (i.e., improve affinity).

To replace the evaluation function, assign a new function to the FactionMember's EvaluateRumor hook. For example:

Code: Select all

FactionMember self = GetComponent<FactionMember>()l
self.EvaluateRumor = MyEvaluateRumor;
...
Rumor MyEvaluateRumor(Rumor 	rumor, FactionMember source)
{
    // Get the ID of the Lust trait:
    FactionDatabase database = FactionManager.instance.database;
    int lustID = database.GetRelationshipTraitID("Lust");
    
    // What Lust do I feel toward the actor (e.g., Jill or Margaret)?
    int actorID = rumor.actorFactionID;
    float lustTowardActor = database.GetRelationshipTrait(self.factionID, actorID, lustID);
    
    // If we're repulsed, make good deeds bad:
    if (lustTowardActor < 0 && rumor.impact > 0) rumor.impact = -rumor.impact;
    
    // OPTIONAL: Maybe you want to also update Lust based on this deed:
    float lustChange = rumor.impact; // Customize this to your liking.
    database.ModifyPersonalRelationshipTrait(self.factionID, actionID, lustID, lustChange);
    
    // Do the default evaluation for affinity: (The rumor's impact will now be negative in the Margaret case)
    Rumor result = self.DefaultEvaluateRumor(rumor, source);
    
    return result;
}
joeykid6
Posts: 17
Joined: Thu Feb 07, 2019 1:57 pm

Re: Modeling relationship reactions to deeds

Post by joeykid6 »

Great, thanks so much, Tony! I will give this a try.

One more quick follow-up on the power differential curve: are power numbers set somewhere in Love/Hate, or are those also something I would set in my own code (and track separately) and then feed in when evaluating a deed?

Forgive me for all the questions. I've read the manual several times and looked at the API, but I'm still trying to grasp how all the parts work together.

Thanks as always for your excellent support!
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Modeling relationship reactions to deeds

Post by Tony Li »

Hi Joe,

By default, every faction member has a power level of 1.

To change it, assign a function to FactionMember.GetPowerLevel:

Code: Select all

GetComponent<FactionMember>().GetPowerLevel = GetMyClassLevel();
...
float GetMyClassLevel() { return myLevel; }
You can also optionally assign a different function to FactionMember.GetSelfPerceivedPowerLevel. The faction member will use this function to get its own power level. For example, an overly confident character could return 2 * GetPowerLevel().
joeykid6
Posts: 17
Joined: Thu Feb 07, 2019 1:57 pm

Re: Modeling relationship reactions to deeds

Post by joeykid6 »

Excellent, thank you!
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Modeling relationship reactions to deeds

Post by Tony Li »

Glad to help! :-)
Post Reply