Thanks you so much for your help, it really speeds up what I want to do.
Well, I couldn't find out how to stretch the UI upward to fit the correct size, but I hope I will after some other hours
I asked myself another question:
I want to use the bark system, when player walks by I want the trader to say:
"My, oh! Now, that's a nice <ItemNameAsString>, would you like to sell it to me?"
So, I need to get the TextNode to grab the itemname, color it to enlight it a bit and throw it out in the bark text.
You implemented something like this?
I also would like to use Bark OnTriggerEnter, so it only barks when Player is in near
New to Dialogue System, can't run response dialogue
Re: New to Dialogue System, can't run response dialogue
Hi,
For the response menu, this screenshot may help. Notice that I removed the Scroll Rect and ScrollBar, and changed the Scroll Content's RectTransform. I also disabled the background Image on the Response Menu Panel.
There are two parts to the trader's bark.
First, the trader needs to know what the player has.
Second, the trader needs to bark the text.
The first part depends on how you're handling inventory. In general, you will probably have a C# method to check the player's inventory. These C# methods can be registered with Lua so the Dialogue System can access them. For example, if you're using Opsive's Ultimate Inventory System integration, you'd use uisGetItemAmount(). If you're using More Mountains' Inventory Engine, you'd use mmGetItemQuantity().
Specific Item
If the trader will look for a specific item, it's easier. You can just check if, for example:
uisGetItemAmount("Broadsword", "') > 0.
The second part is easier in this case, too. You can bark the text like this:
Random Item
If you need to randomly pick an item from the player's inventory, that's more complicated. You'll need to write a C# method to randomly pick an item. For example, say you write a method to pick an item and set a Dialogue System variable to the name of the item. The method also returns true if it picked an item, and false if the player doesn't have any items to pick. Rough example:
We'll also assume you've registered the method with Lua so you can use it in the Dialogue System:
Then your Dialogue System Trigger can look more like this:
For the response menu, this screenshot may help. Notice that I removed the Scroll Rect and ScrollBar, and changed the Scroll Content's RectTransform. I also disabled the background Image on the Response Menu Panel.
There are two parts to the trader's bark.
First, the trader needs to know what the player has.
Second, the trader needs to bark the text.
The first part depends on how you're handling inventory. In general, you will probably have a C# method to check the player's inventory. These C# methods can be registered with Lua so the Dialogue System can access them. For example, if you're using Opsive's Ultimate Inventory System integration, you'd use uisGetItemAmount(). If you're using More Mountains' Inventory Engine, you'd use mmGetItemQuantity().
Specific Item
If the trader will look for a specific item, it's easier. You can just check if, for example:
uisGetItemAmount("Broadsword", "') > 0.
The second part is easier in this case, too. You can bark the text like this:
Random Item
If you need to randomly pick an item from the player's inventory, that's more complicated. You'll need to write a C# method to randomly pick an item. For example, say you write a method to pick an item and set a Dialogue System variable to the name of the item. The method also returns true if it picked an item, and false if the player doesn't have any items to pick. Rough example:
Code: Select all
public bool PickRandomItem() // (Note: This is just example code.)
{
if (playerInventory.numItems == 0)
{
return false; // Player doesn't have any items, so return false:
}
else
{
DialogueLua.SetVariable("desiredItem", playerInventory.itemNames[Random.Range(0, playerInventory.itemNames)]);
return true;
}
}
Code: Select all
void Awake()
{
Lua.RegisterFunction("PickRandomItem", this, SymbolExtensions.GetMethodInfo(() => PickRandomItem()));
}
Re: New to Dialogue System, can't run response dialogue
Oh, this is awesome!
I created everything like you described it, using my own Inventory System and assigned the Method, it also fires when Player enters and show up correct assigend item name, but there is no bark that appears and it fires about 20 times when Player enters and runs inside the range of collider
I'm a bit confused because I have to assign the Bark UI Bubble, or?
I created everything like you described it, using my own Inventory System and assigned the Method, it also fires when Player enters and show up correct assigend item name, but there is no bark that appears and it fires about 20 times when Player enters and runs inside the range of collider
I'm a bit confused because I have to assign the Bark UI Bubble, or?
Re: New to Dialogue System, can't run response dialogue
Hi,
If it runs multiple times, then multiple colliders (e.g., on the player's child GameObjects) are probably triggering it. If possible, make sure only one player collider is tagged Player and/or set the layers so only one collider will register a trigger collision.Nippy wrote: ↑Fri Mar 26, 2021 9:11 amI created everything like you described it, using my own Inventory System and assigned the Method, it also fires when Player enters and show up correct assigend item name, but there is no bark that appear and it fires about 20 times when Player enters and runs inside the range of collider
Yes, your character must have a bark UI. You can add one directly as a child or add a Dialogue Actor component and assign it to the Dialogue Actor. See the enemies in DemoScene2 for an example of setting up bark UIs.
Re: New to Dialogue System, can't run response dialogue
Great, thanks, it's working.
But using the bark only in dialogue system trigger is the only way?
Because If I want to display different text for more variety, it would be more handy to use it with the nodes, but I can't find a Lua Setting in the dialogue conversation tree?
Ok, found a way:
Just use Conversation as Bark Source, I hope my questions will help someone else in future
But using the bark only in dialogue system trigger is the only way?
Because If I want to display different text for more variety, it would be more handy to use it with the nodes, but I can't find a Lua Setting in the dialogue conversation tree?
Ok, found a way:
Just use Conversation as Bark Source, I hope my questions will help someone else in future
Re: New to Dialogue System, can't run response dialogue
I'm sure they will. Glad you got it working!