Deeds impacting Personality Traits

Announcements, support questions, and discussion for Love/Hate.
Post Reply
MLGAvalon
Posts: 3
Joined: Fri Jun 25, 2021 11:57 am

Deeds impacting Personality Traits

Post by MLGAvalon »

Hey folks!

I'm very new to C#, completely new at Lua, and in way over my head. 😅 I'm using Dialogue System & Love/Hate for an adventure game I'm building for some clients. They fortunately know my programming competence level.

Anywho, my goal is to have a meter reflect a personality trait on the character's status bar, that shows the incremental changes when deeds are done. I created the personality trait, and the code in the UI that pulls from the Traits script and updates the slider. What I'm having trouble with is having a Deed make any impact at all.

My goal: in Dialogue System, once a certain node in a conversation is reached, it impacts this trait by +5. I've tried Deed reporting with Impressionability turned up to 100%, I've tried Lua code to try and brute force get & set trait. I'm spinning in circles here. Is there a tutorial or code reference I'm missing?

Thanks friends.
-MLG
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Deeds impacting Personality Traits

Post by Tony Li »

Hi,

Here's an example scene:

LH_DS_PersonalityExample_2021-06-25.unitypackage

It looks like this:

lhDSExample.png
lhDSExample.png (5.77 KiB) Viewed 3833 times

The scene has two characters/factions: Player and NPC. The faction database has a single personality trait: Virtue.

The NPC has a script that manages the text in the upper left.

If you click the Donate or Steal buttons, they'll make the Player's DeedReporter report a deed to the NPC. The NPC is kind of a blank slate with good affinity to the Player, so anything the Player does will strengthen affinity.

The NPC also has 100% impressionability. If you click Donate, a deed with high Virtue, the NPC's Virtue will be influenced to increase accordingly. The first time you click Donate, the impression will just be ramping up, so the number won't be noticeable. However, with subsequent clicks you'll see the number go up. Similarly, if you click Steal, the number will go down.

The Talk button, will start a conversation. You can choose from three responses: Donate, Steal, and Teach About Virtue. Donate and Steal work like the UI buttons except they use a Lua function. The third response's Script field manually increases the NPC's Virtue using Lua functions. (I didn't type any Lua functions. I clicked the Script field's "..." button and chose them from the Custom submenu in the dropdown menu.) The third response also uses a sequencer command to tell the NPC's script to update the text.

If you have questions about how any of it is set up, just let me know. I threw the example together pretty quickly and didn't add comments to the short scripts. If any of it isn't clear, let me know.
MLGAvalon
Posts: 3
Joined: Fri Jun 25, 2021 11:57 am

Re: Deeds impacting Personality Traits

Post by MLGAvalon »

This is amazing, thank you! I think I have had some fundamental misunderstandings of this plugin, it's so much more robust than I expected. I'm excited to implement it, it's going to create such dynamic interactions.

What I'm trying to do now is set up that when a player does something, it changes the player's own trait. No NPCs involved. I'll dig into this example though and see if I can modify things from here.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Deeds impacting Personality Traits

Post by Tony Li »

Hi,

There are two ways you can do that:

1. Set the player's Impressionability to a high value, and tick the Faction Manager's Can Witness Self.

2. Or manually adjust the player's trait like that third response does in the example scene.
MLGAvalon
Posts: 3
Joined: Fri Jun 25, 2021 11:57 am

Re: Deeds impacting Personality Traits

Post by MLGAvalon »

Screenshot LUA Love-hate SetPersonalityTrait.png
Screenshot LUA Love-hate SetPersonalityTrait.png (360.22 KiB) Viewed 3828 times
Please excuse the blackouts, I'm under NDA on a bunch of things. I tried to manually adjust, but struck out. I feel like I'm missing something obvious. I'm looking back at your example scene now. Thank you for taking the time to engage & help me with this. 💜
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Deeds impacting Personality Traits

Post by Tony Li »

Hi,

No need to add a Traits component. It won't be used. The Traits component is only used to add traits to a GameObject that doesn't have a Faction Member component. (This is a fairly rare use case.)

The Player's traits are contained inside the Faction Member component -- technically, it's in the Faction Member's Faction in the Faction Database.

To view the runtime values of the faction database, inspect the Faction Manager GameObject. Double-click on the Faction Database field. This will make the inspector show the runtime, in-memory version of the Faction Database.
Post Reply