Code: Select all
//ActorName = gameObject.name;
dialogueActor = gameObject.AddComponent<DialogueActor>();
dialogueActor.actor = ActorName;
string luaScript = "Actor['" + ActorName + "'] = { Name = '" + ActorName + "', Display_Name = '" + gameObject.name + "'}";
Lua.Run(luaScript);
SetRelationship = "SetRelationship(Actor[" + @"""" + DialogueLua.StringToTableIndex(dialogueActor.actor) + @"""" + "], Actor[" + @"""Player""" + "]," + @"""NPC"""+ ", "+initialValue+")";
Lua.Run(SetRelationship);
GetRelationship = "return GetRelationship(Actor[" + @"""" + DialogueLua.StringToTableIndex(dialogueActor.actor) + @"""" + "], Actor[" + @"""Player""" + "]," + @"""NPC""" + ")";
relationValue = Lua.Run(GetRelationship).AsFloat;
The issue we are running into is that using IncRelationship in this manner-IncRelationship(Actor[Variable["ConversantIndex"]], Actor["Player"], "NPC", value) does not seem to do anything in the dialogue system. It does not actually update the value. We tested it out by running GetRelationship.AsFloat in the Update() method but it remains at initialValue forever.