Hi, thank you for bearing with this question of mine:
To explain - I want a subtitled conversation (not a bark) that explains the current situation of a card game, like which player won a hand or not.
Problem is that while I have the actors' names/which characters are present in the game, I'm not super sure how to pass 'winning' players to the conversation to have fields in the text update? I imagine I could use conditionals to also check how many players won if at all, to condense all the possible outcomes in the conversation itself.
I know I can register C# Methods to help with this but there's a lot of moving parts so I'm unsure what the best route forward is.
To summarize:
- I want dialog to update based on winner amount + who the winners are.
- This means I'll have to read the game's values (I have arrays with the right player objects in them), but it's feeding the right strings and quantities to the LUA-side of the conversation that confuse me, since I don't understand when I'd get the timing for it or when it happens.
Oh, and if I want the game to wait until the conversation's done, do I just use a while loop checking for whether the conversation's ended or not? (And apologies for the simpler question, but what's the method that checks whether there's any ongoing conversations or not? I assume that would return a bool which I could feed into this loop.)
Dynamic Conversations without too many variables?
-
- Posts: 47
- Joined: Tue May 16, 2023 10:37 pm
Re: Dynamic Conversations without too many variables?
Hi,
Write your conversation using a generic Player actor. If necessary, at runtime you can tell the Dialogue System to use a specific actor in place of the generic one. For more info on this, see: Character GameObject Assignments.
If you only need to show the winner's name and amount, you can set two Lua variables before the conversation starts. Example C# code:
In your conversation:
This will set several values:
You can also register your own C# methods with Lua, such as:
Then use that in your dialogue text:
Write your conversation using a generic Player actor. If necessary, at runtime you can tell the Dialogue System to use a specific actor in place of the generic one. For more info on this, see: Character GameObject Assignments.
If you only need to show the winner's name and amount, you can set two Lua variables before the conversation starts. Example C# code:
Code: Select all
DialogueLua.SetVariable("Winner", winnerName);
DialogueLua.SetVariable("WinningAmount", winningAmount);
DialogueManager.StartConversation("Won Hand");
- Dialogue Text: "[var=Winner] won $[var=WinningAmount]."
Code: Select all
DialogueManager.StartConversation("Won Hand", wildBill.transform);
- C# property DialogueManager.currentActor will be set to the GameObject's transform.
- Lua variable Variable["Actor"] will be set to the actor's display name.
- Lua variable Variable["ActorIndex"] will be set to the actor's index in the Actor[] table.
You can also register your own C# methods with Lua, such as:
Code: Select all
public double GetWinningAmount()
{
// return winning amount for DialogueManager.currentActor.
}
- Dialogue Text: "[var=Winner] won $[lua(GetWinningAmount())]."