Hello!
I'm implementing a very simple Affinity System using Love/Hate and Dialogue System on a prototype, where I have an NPC (with it's own faction) and the conversation branches where some options will modify the affinity with the player (just for testing, so it's a really simple Dialogue Tree) and modify which branch of dialogue will appear to the player.
I'm using LUA Scripting at certain dialogues that will modify the Affinity, but It appears as they are only Setting, not Modifying the value. For example, I have a dialogue where the NPC will decrease the Affinity for the player by 1, and another that will increase by 1. But even if I always choose one or the other, the affinity never goes different than 1 or -1. It doesn't even go to Zero! I'm probably missing something here. Can anyone help?
Below are scripts being used at the Player Dialogues:
Scripts:
ModifyAffinity("RedInmate", "Player", -1)
ModifyAffinity("RedInmate", "Player", 1)
Thanks!
Modify Affinity using Dialogue System & LUA
-
- Posts: 5
- Joined: Thu Jul 27, 2017 2:44 pm
-
- Posts: 5
- Joined: Thu Jul 27, 2017 2:44 pm
Re: Modify Affinity using Dialogue System & LUA
I found the problem... Inside the "LoveHateLua.cs" that come with the Third Party Support for Dialogue System, the registration of the function "ModifyAffinity" is using the wrong function, as seen in the image below:
I just needed to modify that line (38) to:
I just needed to modify that line (38) to:
Code: Select all
Lua.RegisterFunction("ModifyAffinity", null, SymbolExtensions.GetMethodInfo(() => ModifyAffinity(string.Empty, string.Empty, (double) 0)));
Re: Modify Affinity using Dialogue System & LUA
Ah, you just beat me to it. Sorry about that bug. I'm pushing out an update today to fix it!
-
- Posts: 5
- Joined: Thu Jul 27, 2017 2:44 pm
Re: Modify Affinity using Dialogue System & LUA
No problem! Thanks for the quick response and fix!