-- 基础信息 local base_info = { group_id = 155006087 } -- Trigger变量 local defs = { active_step = 201, inactive_step = 0, gadget_array = {87001,87002,87003,87004,87005}, reset_gear_list = {} } -- DEFS_MISCS local v = 0 local v_error = 0 local max_bit = #defs.gadget_array --================================================================ -- -- 配置 -- --================================================================ -- 怪物 monsters = { } -- NPC npcs = { } -- 装置 gadgets = { { config_id = 87001, gadget_id = 70900056, pos = { x = 453.328, y = 178.420, z = -330.917 }, rot = { x = 7.572, y = 359.982, z = 359.731 }, level = 1, persistent = true, area_id = 200 }, { config_id = 87002, gadget_id = 70900056, pos = { x = 473.458, y = 182.983, z = -366.188 }, rot = { x = 13.177, y = 0.326, z = 3.196 }, level = 1, persistent = true, area_id = 200 }, { config_id = 87003, gadget_id = 70900056, pos = { x = 477.713, y = 178.894, z = -342.367 }, rot = { x = 10.634, y = 0.142, z = 356.085 }, level = 1, persistent = true, area_id = 200 }, { config_id = 87004, gadget_id = 70900056, pos = { x = 459.850, y = 180.814, z = -352.123 }, rot = { x = 5.621, y = 0.118, z = 1.651 }, level = 1, persistent = true, area_id = 200 }, { config_id = 87005, gadget_id = 70900056, pos = { x = 499.259, y = 184.905, z = -372.218 }, rot = { x = 14.552, y = 0.633, z = 359.196 }, level = 1, persistent = true, area_id = 200 }, { config_id = 87006, gadget_id = 70211111, pos = { x = 497.999, y = 183.226, z = -366.092 }, rot = { x = 14.175, y = 30.550, z = 8.992 }, level = 16, drop_tag = "解谜中级稻妻", isOneoff = true, persistent = true, explore = { name = "chest", exp = 1 }, area_id = 200 } } -- 区域 regions = { } -- 触发器 triggers = { { config_id = 1087007, name = "GADGET_STATE_CHANGE_87007", event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "condition_EVENT_GADGET_STATE_CHANGE_87007", action = "action_EVENT_GADGET_STATE_CHANGE_87007", trigger_count = 0 }, { config_id = 1087008, name = "VARIABLE_CHANGE_87008", event = EventType.EVENT_VARIABLE_CHANGE, source = "gear_reset", condition = "", action = "action_EVENT_VARIABLE_CHANGE_87008", trigger_count = 0 }, { config_id = 1087009, name = "VARIABLE_CHANGE_87009", event = EventType.EVENT_VARIABLE_CHANGE, source = "trigger_output", condition = "condition_EVENT_VARIABLE_CHANGE_87009", action = "", trigger_count = 0 }, { config_id = 1087010, name = "VARIABLE_CHANGE_87010", event = EventType.EVENT_VARIABLE_CHANGE, source = "trigger_output", condition = "condition_EVENT_VARIABLE_CHANGE_87010", action = "action_EVENT_VARIABLE_CHANGE_87010", trigger_count = 0 } } -- 变量 variables = { { config_id = 1, name = "sort", value = 0, no_refresh = true }, { config_id = 2, name = "gear_reset", value = 0, no_refresh = true }, { config_id = 3, name = "v_error", value = 0, no_refresh = true }, { config_id = 4, name = "trigger_output", value = 0, no_refresh = true } } --================================================================ -- -- 初始化配置 -- --================================================================ -- 初始化时创建 init_config = { suite = 1, end_suite = 0, rand_suite = false } --================================================================ -- -- 小组配置 -- --================================================================ suites = { { -- suite_id = 1, -- description = , monsters = { }, gadgets = { 87001, 87002, 87003, 87004, 87005 }, regions = { }, triggers = { "GADGET_STATE_CHANGE_87007", "VARIABLE_CHANGE_87008", "VARIABLE_CHANGE_87009", "VARIABLE_CHANGE_87010" }, rand_weight = 100 } } --================================================================ -- -- 触发器 -- --================================================================ -- 触发条件 function condition_EVENT_GADGET_STATE_CHANGE_87007(context, evt) for i=1,#defs.gadget_array do if defs.gadget_array[i] == evt.param2 then return true end end return false end -- 触发操作 function action_EVENT_GADGET_STATE_CHANGE_87007(context, evt) if max_bit > 9 or max_bit <= 1 then return -1 end if evt.param1 == defs.active_step then --操作顺序入栈 for i = 1,max_bit do if defs.gadget_array[i] == evt.param2 then v = ScriptLib.GetGroupVariableValue(context, "sort") v = 10*v + i ScriptLib.SetGroupVariableValue(context, "sort", v) break end if i == max_bit and defs.gadget_array[i] ~= evt.param2 then ScriptLib.SetGroupVariableValue(context, "v_error", 1) v = 10*v end end end --v的位数足够时进行出栈检测 if v > 10^(max_bit-1) then v_error = ScriptLib.GetGroupVariableValue(context, "v_error") --v_error有问题时直接清空栈并重置 if 0 == v_error then for i=max_bit,1,-1 do if v%10 ~= i then v_error = 1 break end v = math.floor(v/10) end end v = 0 if v_error ~= 1 then v_error = -1 end ScriptLib.SetGroupVariableValue(context, "sort", v) ScriptLib.SetGroupVariableValue(context, "gear_reset", v_error) ScriptLib.SetGroupVariableValue(context, "v_error", 0) end return 0 end -- 触发操作 function action_EVENT_VARIABLE_CHANGE_87008(context, evt) if evt.param1 == evt.param2 then return -1 end if evt.param1 == 1 then if #defs.reset_gear_list == 0 then defs.reset_gear_list = suites[1].gadgets end for i=1,#defs.reset_gear_list do ScriptLib.SetGroupGadgetStateByConfigId(context, 0, defs.reset_gear_list[i], defs.inactive_step) end ScriptLib.SetGroupVariableValue(context, "trigger_output", -1) elseif -1 == evt.param1 then --外接标记 ScriptLib.SetGroupVariableValue(context, "trigger_output", 1) end --还原标记 ScriptLib.SetGroupVariableValue(context, "gear_reset", 0) return 0 end -- 触发条件 function condition_EVENT_VARIABLE_CHANGE_87009(context, evt) if evt.param1 == evt.param2 then return false end if evt.param1 == -1 then return true end return false end -- 触发条件 function condition_EVENT_VARIABLE_CHANGE_87010(context, evt) if evt.param1 == evt.param2 then return false end if evt.param1 > 0 then return true end return false end -- 触发操作 function action_EVENT_VARIABLE_CHANGE_87010(context, evt) -- 创建id为87006的gadget if 0 ~= ScriptLib.CreateGadget(context, { config_id = 87006 }) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : create_gadget") return -1 end return 0 end