Hi,
For one of my projects, I'm trying to make an object activate/deactivate depending on the value of a status. In the dialogue database using GetStatus(Actor[], Actor[]) ~= "Met" and SetStatus(Actor[],Actor[]), "Met" works perfectly fine, yet translating this into a C# script appears very tricky. I notice that there are functions that can be accessed like DialogueLua.GetStatus() and DialogueLua.SetStatus(), but the parameters require LuaTables and I have been unable to find a way to convert Actor tables to LuaTables.
At the end of the day I simply want to be able to check Statuses through C#, so any help or pointers are greatly appreciated!
How to properly use DialogueLua.GetStatus() within C# scripts?
-
- Posts: 16
- Joined: Sun Nov 17, 2019 12:07 am
Re: How to properly use DialogueLua.GetStatus() within C# scripts?
Hi,
Write a little utility function:
Then you can use it like this:
Write a little utility function:
Code: Select all
public string GetActorStatus(string actorName1, string actorName2)
{
string actorIndex1 = DialogueLua.StringToTableIndex(actorName1);
string actorIndex2 = DialogueLua.StringToTableIndex(actorName2);
return Lua.Run($"return GetStatus(Actor['{actorIndex1}'], Actor['{actorIndex2}'])").asString;
}
Code: Select all
if (GetActorStatus("Player", "Private Hart") ~= "Met")
{ ... }
-
- Posts: 16
- Joined: Sun Nov 17, 2019 12:07 am
Re: How to properly use DialogueLua.GetStatus() within C# scripts?
Got it, thanks Tony! I'll try it out and reply here if I can't make it work the way I want.
-
- Posts: 16
- Joined: Sun Nov 17, 2019 12:07 am
Re: How to properly use DialogueLua.GetStatus() within C# scripts?
Oh, and thanks so much for the really quick reply and how clear and concise your explanation was! I'm learning more and more each day I use this thing, haha.