Problem creating/triggering dialogue system.
First off, please excuse if this problem is noob-ish. But I am still fairly new to Unity and C3#.
Setup for the problem: I am using scriptable objects to create rooms, items, actions for a text based game. I am now in the middle of creating an action that will be used to initiate dialogue with an 'NPC'.
I have three NPC dialogue scripts in this system:
Dialogue.cs: A serializable script that can be applied to an object to give it attributes. For example: NPC Name, NPC Alignment and The sentences that the NPC will say to the player. | Pastebin: https://pastebin.com/Kd1YBRA8
DialogueManager.cs: Used to start and unpack dialogue to screen. | Pastebin: https://pastebin.com/uwWu003A
npcTrigger.cs: Used to initiate the dialogue with the NPC. | Pastebin: https://pastebin.com/hdemMfM7
There is a starting room that looks like this: https://imgur.com/a/E988j As you can see it takes any number of intractable objects.
I created an intractable object called 'testNPC' that looks like this: https://imgur.com/a/94G9I
As im sure you can also see, this interactable object does not have any input actions associated with it. I cannot associate my input action 'talk' with 'testNPC' because it is not derived from ScriptableObject (Here is my 'Talk' script for reference). This is because I have derived 'talk' from npcTrigger so that I can call my TriggerDialogue function. (Pastebin: https://pastebin.com/6xXY1cJ4)
The problem: So, I guess my question would be: How do I derive talk
from ScriptableObject
, but also retain the ability to call my TriggerDialogue
function? I need to be able to associate this action
with my GameController
and my testNPC
.
Maybe I am not thinking properly and just need to go to bed. Thanks for any help in advance.
Your answer
![](https://koobas.hobune.stream/wayback/20220612152725im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do I get collision and trigger to work? 2 Answers
scene/gameobject wont deactivate after trigger 1 Answer
How to display text from a text object to another text object? 1 Answer
textmesh OnTriggerEnter 1 Answer
How to render text on top of the objects that are generated on the map using a script? 1 Answer