if an action fails: switch to the first dialog if no other on_failure dialog is defined

This commit is contained in:
Sokomine 2022-01-06 18:05:39 +01:00
parent 45336ed4d4
commit ef66268424

View File

@ -179,11 +179,7 @@ yl_speak_up.execute_next_action = function(player, a_id, result_of_a_id)
local this_action = actions[ sorted_key_list[ nr ]]
-- if there is an on_failure target dialog: go there
if(this_action.a_on_failure) then
-- go back to the same dialog
if(not(dialog.n_dialogs[this_action.a_on_failure])) then
this_action.a_on_failure = d_id
end
-- set the current action to nil
yl_speak_up.speak_to[pname].a_id = nil
-- no option of the new dialog has been selected yet
@ -199,11 +195,6 @@ yl_speak_up.execute_next_action = function(player, a_id, result_of_a_id)
d_id = this_action.a_on_failure,
alternate_text = this_action.alternate_text})
return
else
yl_speak_up.debug_msg(player, n_id, o_id, "Action "..
tostring(a_id).." failed, but no a_on_failure target "..
"dialog defined. Continuing execution.")
end
end
end
-- get the next entry