I'm trying to create an advanced dialog, but i can't get it work.
I got this:
local map = ...
local game = map:get_game()
function oldman_npc:on_interaction() -- oldman_npc is the name of the NPC
if not game:get_value("4b_oldman_helped") then
game:start_dialog("oldmans_cave.question", function(answer) -- Old mans asks a YES/NO question
if answer == 2 then
game:start_dialog("oldmans_cave.answer1", function() -- Answer YES >> Get 20 rupees
hero:start_treasure("rupee", 3, "4b_oldman_helped")
4b_oldman_helped = true
end)
else -- Answer NO
game:start_dialog("oldmans_cave.answer2")
return
end)
else
game:start_dialog("oldmans_cave.done") -- Old man refers to the 20 rupees he gave.
return
end
end
Why is this not working? I don't get a dialog at all when hitting the action key in front of the NPC.