Dialogues: Added function to select random dialogues for NPCs from random data.

Modified NPCs so random dialogues are chosen on initialization.
Added function to start a dialogue, choosing randomly NPCs dialogues.
Changed NPC code to use new dialogue code
This commit is contained in:
zorman2000
2016-12-01 14:37:00 -05:00
parent 46e3d2543b
commit 762337cc6d
5 changed files with 206 additions and 37 deletions

View File

@ -613,17 +613,17 @@ mobs:register_mob("advanced_npc:npc", {
npc.dialogue.POSITIVE_GIFT_ANSWER_PREFIX..item_name,
function()
if receive_gift(self, clicker) == false then
start_chat(self, clicker)
npc.dialogue.start_dialogue(self, clicker)
end
end,
npc.dialogue.NEGATIVE_ANSWER_LABEL,
function()
start_chat(self, clicker)
npc.dialogue.start_dialogue(self, clicker)
end,
name
)
else
start_chat(self, clicker)
npc.dialogue.start_dialogue(self, clicker)
end
end,
@ -702,6 +702,9 @@ local function npc_spawn(self, pos)
-- Determines if NPC is married or not
ent.is_married_to = nil
-- Initialize dialogues
ent.dialogues = npc.dialogue.select_random_dialogues_for_npc(ent.sex, "phase1")
minetest.log(dump(ent))