forked from Sokomine/yl_speak_up
actually store assigned quest steps in npc savefile
This commit is contained in:
parent
861c44024a
commit
4993656940
@ -299,7 +299,34 @@ yl_speak_up.input_fs_add_quest_steps = function(player, formname, fields)
|
||||
if(msg ~= "OK") then
|
||||
return show_error_fs(player, msg)
|
||||
end
|
||||
-- TODO: the NPC needs to be saved as well
|
||||
-- store the new connection in the NPC file itself (do not load generic dialogs)
|
||||
local dialog = yl_speak_up.load_dialog(n_id, false)
|
||||
if(dialog and dialog.n_dialogs and d_id and o_id
|
||||
and dialog.n_dialogs[d_id]
|
||||
and dialog.n_dialogs[d_id].d_options
|
||||
and dialog.n_dialogs[d_id].d_options[o_id]) then
|
||||
-- ok - the tables exist, so we can store the connection
|
||||
dialog.n_dialogs[d_id].d_options[o_id].quest_id = quest.var_name
|
||||
dialog.n_dialogs[d_id].d_options[o_id].quest_step = work_step
|
||||
-- write it back to disc
|
||||
yl_speak_up.save_dialog(n_id, dialog)
|
||||
else
|
||||
return show_error_fs(player, "Failed to save this quest step for this NPC.")
|
||||
end
|
||||
-- the player is working on the NPC - thus, the NPC may be in a modified stage
|
||||
-- that hasn't been written to disc yet, and we need to adjust this stage as well
|
||||
dialog = yl_speak_up.speak_to[pname].dialog
|
||||
if(dialog and dialog.n_dialogs and d_id and o_id
|
||||
and dialog.n_dialogs[d_id]
|
||||
and dialog.n_dialogs[d_id].d_options
|
||||
and dialog.n_dialogs[d_id].d_options[o_id]) then
|
||||
-- ok - the tables exist, so we can store the connection
|
||||
dialog.n_dialogs[d_id].d_options[o_id].quest_id = quest.var_name
|
||||
dialog.n_dialogs[d_id].d_options[o_id].quest_step = work_step
|
||||
yl_speak_up.speak_to[pname].dialog = dialog
|
||||
else
|
||||
return show_error_fs(player, "Failed to update NPC.")
|
||||
end
|
||||
-- show the newly created or selected step
|
||||
yl_speak_up.speak_to[pname].quest_step = work_step
|
||||
return yl_speak_up.show_fs(player, "manage_quest_steps", work_step)
|
||||
|
Loading…
Reference in New Issue
Block a user