From d16cc44e6cf184a0444011cdbc871006880aae94 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Mon, 12 Jul 2021 00:31:27 +0200 Subject: [PATCH] convert to numbers were necessary in the effects --- fs_edit_effects.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fs_edit_effects.lua b/fs_edit_effects.lua index 4d89e18..4a307e8 100644 --- a/fs_edit_effects.lua +++ b/fs_edit_effects.lua @@ -454,36 +454,36 @@ yl_speak_up.execute_effect = function(player, n_id, o_id, r) -- quest_step and maximum are effectively the same -- TODO: later on, quest steps may be strings local var_val = yl_speak_up.get_quest_variable_value(pname, r.r_variable) - if(var_value) then - new_value = math.max(var_val, r.r_var_cmp_value) + if(var_value and tonumber(var_val) and tonumber(r.r_var_cmp_value)) then + new_value = math.max(tonumber(var_val), tonumber(r.r_var_cmp_value)) else new_value = r.r_var_cmp_value end elseif(r.r_operator and r.r_operator == "maximum") then local var_val = yl_speak_up.get_quest_variable_value(pname, r.r_variable) - if(var_value) then - new_value = math.max(var_val, r.r_var_cmp_value) + if(var_value and tonumber(var_val) and tonumber(r.r_var_cmp_value)) then + new_value = math.max(tonumber(var_val), tonumber(r.r_var_cmp_value)) else new_value = r.r_var_cmp_value end elseif(r.r_operator and r.r_operator == "minimum") then local var_val = yl_speak_up.get_quest_variable_value(pname, r.r_variable) - if(var_value) then - new_value = math.min(var_val, r.r_var_cmp_value) + if(var_value and tonumber(var_val) and tonumber(r.r_var_cmp_value)) then + new_value = math.min(tonumber(var_val), tonumber(r.r_var_cmp_value)) else new_value = r.r_var_cmp_value end elseif(r.r_operator and r.r_operator == "increment") then local var_val = yl_speak_up.get_quest_variable_value(pname, r.r_variable) - if(var_value) then - new_value = var_val + r.r_var_cmp_value + if(var_value and tonumber(var_val) and tonumber(r.r_var_cmp_value)) then + new_value = tonumber(var_val) + tonumber(r.r_var_cmp_value) else new_value = r.r_var_cmp_value end elseif(r.r_operator and r.r_operator == "decrement") then local var_val = yl_speak_up.get_quest_variable_value(pname, r.r_variable) - if(var_value) then - new_value = var_val + r.r_var_cmp_value + if(var_value and tonumber(var_val) and tonumber(r.r_var_cmp_value)) then + new_value = tonumber(var_val) + tonumber(r.r_var_cmp_value) else new_value = -1 * r.r_var_cmp_value end