Relationship Traits

Announcements, support questions, and discussion for Love/Hate.
Post Reply
turdle2080
Posts: 7
Joined: Wed Jul 04, 2018 4:48 pm

Relationship Traits

Post by turdle2080 »

in the Faction Database we set up Relationship traits, but how do we access/affect them? the manual gives examples of respect, lust and duty, which i have included in my database, but i don't understand how to get at anything other than affinity.
User avatar
Tony Li
Posts: 20721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Relationship Traits

Post by Tony Li »

Hi,

I'll cover this from a scripting perspective, but you can do the same in Playmaker, plyGame, Makinom, or Node Canvas.

Relationship traits are stored in the FactionDatabase.

Use the FactionManager to access the FactionDatabase:

Code: Select all

var factionManager = FindObjectOfType<FactionManager>();
var factionDatabase = factionManager.factionDatabase;
(The upcoming version 1.9.0 has a FactionManager.instance property so you won't have to use FindObjectOfType any more.)

The names of the relationship traits are in the FactionDatabase's relationshipTraitDefinitions property:

Code: Select all

Debug.Log("Relationship traits:");
for (int id = 0; id < factionDatabase.relationshipTraitDefinitions.Length; id++)
{
    Debug.Log(id + ": " + factionDatabase.relationshipTraitDefinitions[id].name);
}
To get the relationship trait values of a specific faction, use FactionDatabase.GetRelationshipTraitID() to get the trait's id, then FactionDatabase.GetRelationshipTrait() to get the faction's relationship trait value toward another faction:

Code: Select all

var lustID = factionDatabase.GetRelationshipTraitID("Lust");
var lustValue = factionDatabase.GetRelationshipTrait("Apollo", "Daphne", lustID);
There are corresponding SetRelationshipTrait() and ModifyRelationshipTrait() functions, which respectively set the value to an absolute number or increment it. You can also call FindPersonalRelationshipTrait() to see if the faction has a direct relationship with the subject or if the value is inherited from a parent faction.

FactionMembers judge deeds by running them through a deed evaluation function. The default deed evaluation function only updates affinity and PAD values. If you want it to also affect other relationship traits, assign your own deed evaluation function to the faction member's EvaluateRumor delegate. In your evaluation function, you can call DefaultEvaluateRumor() to include the default deed evaluation functionality, and then add your extra code.
turdle2080
Posts: 7
Joined: Wed Jul 04, 2018 4:48 pm

Re: Relationship Traits

Post by turdle2080 »

Thanks for getting back to me. appreciate the help. i've just started playing around with Love/Hate, so i'm still figuring it out.

on a bit of a tangent, is there good way to handle jealousy? say, in a dating sim, if you had two female characters who were friendly to eachother, and another character who they both fancy flirts with one of them, i want the other to have a negative reaction, even though they are friendly factions.

thanks again
User avatar
Tony Li
Posts: 20721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Relationship Traits

Post by Tony Li »

Hi,

I like to preface long replies with a short answer. But in this case no short answer suffices, so pardon my long ramble.

Jealousy is complex. There are a lot of ways you can model it. I'll outline a few.

Let's say the two females are Ann and Barb, and the third character is Charlie. Ann flirts with Charlie, and Barb gets jealous.

One way to implement this is to define Ann's flirting as a deed with negative impact because it threatens Barb's potential relationship with Charlie. So the deed "Ann flirts with Charlie" is really "Ann threatens others' potential relationships with Charlie." Ann flirts with Charlie. Barb sees this. Since Barb likes the deed target (Charlie), she has a negative reaction to Ann. The catch here is that you don't want to report this deed to Charlie, since for him it might be a positive thing.

Alternatively, you could frame Ann's flirting as a betrayal of Barb's friendship. So the deed isn't "Ann flirts with Charlie", but "Ann betrays Barb," which has a negative impact.

Or you could define a second faction member for Charlie, say called "Charlie's Availability", that represents the up-for-grabs feeling that anyone could hook up with Charlie. Give everyone who's interested in Charlie a positive affinity to Charlie's Availability. Since flirting starts to solidify a relationship, it negatively impacts Charlie's Availability. When Ann flirts with Charlie, report the deed "Ann hurts Charlie's Availability" with a negative impact. Anyone who likes Charlie's Availability will lose affinity for Ann. In this case, untick the FactionManager's Can Witness Self checkbox so Ann won't judge herself badly for reducing Charlie's Availability.

The ideas above work within the existing framework. Another possibility is to add another relationship trait and change the deed evaluation function. You could call this trait Cooperativeness or, flipping it, Competitiveness. Ann and Barb, despite having high affinity to each other, would have negative Cooperativeness when it comes to romance. Barb doesn't want to cooperate with Ann flirting with Charlie. But maybe Ann's mother wants her to connect with Charlie, so the mother would have positive Cooperativeness. Your new deed evaluation function would have to factor in Cooperativeness when evaluating certain deeds like flirting.

You just had to ask about the trickiest emotion, huh? ;)
turdle2080
Posts: 7
Joined: Wed Jul 04, 2018 4:48 pm

Re: Relationship Traits

Post by turdle2080 »

thanks, no worries about no short answer. i like the idea about having a second faction member on Charlie called charlies availability. a couple questions about that approach, would Charlies base faction member be alerted by a deed report if Ann negatively affects charlies availability? and is there a way to prevent faction members from being notified of a deed report? or i suppose i could set it so Charlies main faction member has a negative affinity towards his availability which would make it so he has a positive reaction to his loss of availability (by being flirted with).
User avatar
Tony Li
Posts: 20721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Relationship Traits

Post by Tony Li »

turdle2080 wrote: Thu Jul 05, 2018 10:55 pmor i suppose i could set it so Charlies main faction member has a negative affinity towards his availability which would make it so he has a positive reaction to his loss of availability (by being flirted with).
I think that's a good way to look at it. Charlie's not happy with his availability (i.e., being alone/unloved), so he'd view anything that negatively impacts his availability as a good thing.

There's no automated way to prevent faction members from being notified of a deed report. Every faction member has a "CanSee" delegate. The original idea of CanSee is to check things like line-of-sight raycasts. But you could use it to filter out certain deeds using other criteria. It would require some scripting, though.
User avatar
Tony Li
Posts: 20721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Relationship Traits

Post by Tony Li »

BTW, version 1.9.0 is pending publication on the Asset Store. It adds a Permitted Evaluators value to deeds, with these options:
  • Everyone: (Default) Anyone who can see the deed or receive it through gossip can evaluate it. (Works like 1.8.9)
  • Only Target: Only the target of the deed can evaluate it.
  • Everyone Except Target: Other witnesses can evaluate the deed, but the target can't. This might be useful for your jealousy deed to prevent Charlie from judging the flirtation as a negative event.
Post Reply