mirror of
https://gitea.your-land.de/Sokomine/yl_speak_up.git
synced 2025-08-20 19:25:48 +02:00
if an action fails: switch to the first dialog if no other on_failure dialog is defined
This commit is contained in:
parent
45336ed4d4
commit
ef66268424
@ -179,31 +179,22 @@ yl_speak_up.execute_next_action = function(player, a_id, result_of_a_id)
|
|||||||
|
|
||||||
local this_action = actions[ sorted_key_list[ nr ]]
|
local this_action = actions[ sorted_key_list[ nr ]]
|
||||||
-- if there is an on_failure target dialog: go there
|
-- if there is an on_failure target dialog: go there
|
||||||
if(this_action.a_on_failure) then
|
|
||||||
-- go back to the same dialog
|
-- set the current action to nil
|
||||||
if(not(dialog.n_dialogs[this_action.a_on_failure])) then
|
yl_speak_up.speak_to[pname].a_id = nil
|
||||||
this_action.a_on_failure = d_id
|
-- no option of the new dialog has been selected yet
|
||||||
end
|
yl_speak_up.speak_to[pname].o_id = nil
|
||||||
-- set the current action to nil
|
-- show the new dialog
|
||||||
yl_speak_up.speak_to[pname].a_id = nil
|
yl_speak_up.debug_msg(player, n_id, o_id, "Action "..
|
||||||
-- no option of the new dialog has been selected yet
|
tostring(a_id).." failed. Switching to dialog "..
|
||||||
yl_speak_up.speak_to[pname].o_id = nil
|
tostring(this_action.a_on_failure)..".")
|
||||||
-- show the new dialog
|
yl_speak_up.speak_to[pname].d_id = this_action.a_on_failure
|
||||||
yl_speak_up.debug_msg(player, n_id, o_id, "Action "..
|
yl_speak_up.speak_to[pname].o_id = nil
|
||||||
tostring(a_id).." failed. Switching to dialog "..
|
yl_speak_up.speak_to[pname].a_id = nil
|
||||||
tostring(this_action.a_on_failure)..".")
|
yl_speak_up.show_fs(player, "talk", {n_id = n_id,
|
||||||
yl_speak_up.speak_to[pname].d_id = this_action.a_on_failure
|
d_id = this_action.a_on_failure,
|
||||||
yl_speak_up.speak_to[pname].o_id = nil
|
alternate_text = this_action.alternate_text})
|
||||||
yl_speak_up.speak_to[pname].a_id = nil
|
return
|
||||||
yl_speak_up.show_fs(player, "talk", {n_id = n_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
|
||||||
end
|
end
|
||||||
-- get the next entry
|
-- get the next entry
|
||||||
|
Loading…
Reference in New Issue
Block a user