UIS integration issue
-
- Posts: 29
- Joined: Sat Mar 27, 2021 7:34 am
UIS integration issue
Hi,
I am using the DS with the Opsive UCC/UIS in a multiplayer setting. After the lastest update of the multiplayer add-on I run into an issue when using the UIS Lua functions. Before the update the local player was always spawned first. So the GetInventory method of the UISLua class found the local player first (by using the "Player" tag). Now the master player is spawned first also on the client, and the local player is spawned later. Thus the GetInventory will return the inventory of the master player game object, not the one of the local player. Both players can have a conversation with NPCs, so I cannot hard code the inventory/player names. Is there a way to retrieve the GO name of the current player / conversant. Then I could pass this name as second argument to the Lua functions?
Thanks, Christian
I am using the DS with the Opsive UCC/UIS in a multiplayer setting. After the lastest update of the multiplayer add-on I run into an issue when using the UIS Lua functions. Before the update the local player was always spawned first. So the GetInventory method of the UISLua class found the local player first (by using the "Player" tag). Now the master player is spawned first also on the client, and the local player is spawned later. Thus the GetInventory will return the inventory of the master player game object, not the one of the local player. Both players can have a conversation with NPCs, so I cannot hard code the inventory/player names. Is there a way to retrieve the GO name of the current player / conversant. Then I could pass this name as second argument to the Lua functions?
Thanks, Christian
Re: UIS integration issue
Hi,
If the GameObject name matches the player's actor name, then you can use the variable Variable["Actor"]:
One way to get the player's actor name to match the GameObject name is to add a Dialogue Actor component to the player GameObject and set its DialogueActor.actor field to the GameObject name. Example:
If the GameObject name matches the player's actor name, then you can use the variable Variable["Actor"]:
Code: Select all
uccAddItem(Variable["Actor"], "Apples", 3)
Code: Select all
GetComponent<DialogueActor>().actor = gameObject.name;
-
- Posts: 29
- Joined: Sat Mar 27, 2021 7:34 am
Re: UIS integration issue
Thanks for the quick response. Just one question. Is the Actor variable always the same during a conversation, or does it change from step to step (because Actor and Conversant constantly switch roles here)?
Re: UIS integration issue
The Actor variable corresponds to the actor or GameObject that's being used as the conversation's primary actor -- that is, the GameObject assigned to the Dialogue System Trigger's Conversation Actor field or, if the field is unassigned, according to the rules here: Character GameObject Assignments.
If you're using the Opsive integration's DialogueSystemTriggerInteractable component, and if you've left the Conversation Actor field blank, it will use the player GameObject that triggered the interaction.
If you're using the Opsive integration's DialogueSystemTriggerInteractable component, and if you've left the Conversation Actor field blank, it will use the player GameObject that triggered the interaction.
-
- Posts: 29
- Joined: Sat Mar 27, 2021 7:34 am
Re: UIS integration issue
Thanks again. The life of an indie dev can be tough sometimes. Every time I get a quick and qualified response like yours, I feel honored and taken seriously. Keep up the great work, and your attitude towards us indie devs.
-
- Posts: 29
- Joined: Sat Mar 27, 2021 7:34 am
Re: UIS integration issue
Hi,
for the conversation this approach works fine now. But I run into an issue with the Dialogue System Trigger. I need to check the inventory in the conditions. The problem for UCC is that the collider is not on the player game object, but on a child. If I use the Variable["Actor"] in the condition, it will return the collider GO name, not the player. And thus the inventory is not found.
Thanks, Christian
for the conversation this approach works fine now. But I run into an issue with the Dialogue System Trigger. I need to check the inventory in the conditions. The problem for UCC is that the collider is not on the player game object, but on a child. If I use the Variable["Actor"] in the condition, it will return the collider GO name, not the player. And thus the inventory is not found.
Thanks, Christian
Re: UIS integration issue
Hi,
The uccAddItem() command should find the Inventory on the child GameObject. If the Inventory component isn't on the main GameObject, it uses GetComponentInChildren<Inventory>() to search its children.
The uccAddItem() command should find the Inventory on the child GameObject. If the Inventory component isn't on the main GameObject, it uses GetComponentInChildren<Inventory>() to search its children.
-
- Posts: 29
- Joined: Sat Mar 27, 2021 7:34 am
Re: UIS integration issue
Hi,
it's the other way around. The collider that interacts with the Dialogue System Trigger is on a child, so the inventory is on a parent. But I now created my on variable containing the local player name. I set this locally on each client, so it has different values on each client. With this I can get the correct inventory.
Thanks again for your help.
it's the other way around. The collider that interacts with the Dialogue System Trigger is on a child, so the inventory is on a parent. But I now created my on variable containing the local player name. I set this locally on each client, so it has different values on each client. With this I can get the correct inventory.
Thanks again for your help.
Re: UIS integration issue
Glad to help! (Well, you really solved this one yourself, so I'm just glad you got it working.)