Hello!
I’m making a simple dialogue system for my game. I’ve got a class Decision that derives from Scriptable Object so I can make my dialogues easily in editor. I want to add a function bool isPossible() which would check if a list of functions attached in inspector are all returning true. Example:
We are talking with character “Pretty Girl”. All the options are:
- Bye! (always possible)
- That’s a flower for you! (only possible if I have a flower in my inventory)
- Did it hurt when you fell from heaven? (only possible if your charisma is over 9000)
- Would you like to see a magic trick? (only possible if your wisdom is over 8 and you have flower in your inventory).
I’ve got object “functions” with all important functions (bool searchForItem(Item), bool checkAtributeLevel(Atribute), bool checkIfQuestCompleted(Quest)).
I think it’s clear now. My first idea was to use UnityEvent to simply attach all the functions in inspector easily. But the problem is that I can’t get any information about values returned by those functions (actually I can’t even attach functions returnig anything). The second idea I had was to add a second parameter which would be the decision which invoked the function so I can do some operations which would help me get the right feedback. But unfortunately UnityEvent does not support multiple parameters (I found a metod for parameters of type declared in advance which is a problem as I sometimes need to pass an item and other time I need to pass an atribute or anything.
The last idea I had was to make a list of all items needed, all atributes levels needed, quests completed and any possible condition. But that’s a lot of lists and it won’t be easy to add new conditions later.
I want to make a flexible system which will work in many games not just in this one I’m currently working on.
Is there any way I can make it work?
Thank you Unity Community for all the answers in advance! ![]()