so I have a dialogue system that is heavily based on this two part tutorial
it has a majority of what I need, but now I’ve hit an issue. I need to be able to make events (like an explosion for example) happen based on what prompt was chosen. I tried just putting a function directly into the prompt, but that just breaks things. I don’t want to just “detect” what prompt was chosen and then make the event happen either. rough ex of what it would look like:
if prompt == "oh no a bomb" then makeExplosion() end
because that just looks and feels weird and would require me to add more prompts to detect if I add new prompts/events. another rough ex of what it would look like:
if prompt == "oh no a bomb" then
makeExplosion()
elseif prompt == "get rich 😎" then
getamillionbucks()
elseif prompt == "apple" then
apple()
end
basically I want to be able to make the event/function run directly from the prompt in the module script if possible like this:
[1] = {
Dialog = "OH NO A BOMB D:";
Responses = {
[1] = {Text = "oh no"; --[[the event/function here, ex:]] function module.bomb() --[[insert explosion]] end};
};
};
but the example above just breaks it. I just have no clue how to do something like what I want without breaking part of or the whole dialog script. pls help