-- 基础信息 local base_info = { group_id = 199003090 } -- Trigger变量 local defs = { point_sum = 11, route_2 = 900300029, gadget_seelie = 90002 } -- DEFS_MISCS defs.final_point = defs.point_sum - 1 --================================================================ -- -- 配置 -- --================================================================ -- 怪物 monsters = { } -- NPC npcs = { } -- 装置 gadgets = { { config_id = 90001, gadget_id = 70500000, pos = { x = -716.155, y = 252.593, z = -15.961 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 20, point_type = 9306, isOneoff = true, persistent = true, area_id = 403 }, { config_id = 90002, gadget_id = 70310244, pos = { x = -729.080, y = 242.461, z = -37.379 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 20, start_route = false, area_id = 403 } } -- 区域 regions = { { config_id = 90007, shape = RegionShape.SPHERE, radius = 5, pos = { x = -729.031, y = 241.807, z = -37.520 }, area_id = 403 } } -- 触发器 triggers = { { config_id = 1090003, name = "GADGET_STATE_CHANGE_90003", event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "condition_EVENT_GADGET_STATE_CHANGE_90003", action = "action_EVENT_GADGET_STATE_CHANGE_90003" }, { config_id = 1090004, name = "PLATFORM_REACH_POINT_90004", event = EventType.EVENT_PLATFORM_REACH_POINT, source = "", condition = "condition_EVENT_PLATFORM_REACH_POINT_90004", action = "action_EVENT_PLATFORM_REACH_POINT_90004", trigger_count = 0 }, { config_id = 1090005, name = "GROUP_LOAD_90005", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "condition_EVENT_GROUP_LOAD_90005", action = "action_EVENT_GROUP_LOAD_90005", trigger_count = 0 }, { config_id = 1090006, name = "AVATAR_NEAR_PLATFORM_90006", event = EventType.EVENT_AVATAR_NEAR_PLATFORM, source = "", condition = "condition_EVENT_AVATAR_NEAR_PLATFORM_90006", action = "action_EVENT_AVATAR_NEAR_PLATFORM_90006", trigger_count = 0 }, { config_id = 1090007, name = "ENTER_REGION_90007", event = EventType.EVENT_ENTER_REGION, source = "", condition = "condition_EVENT_ENTER_REGION_90007", action = "action_EVENT_ENTER_REGION_90007", trigger_count = 0 }, { config_id = 1090008, name = "GROUP_LOAD_90008", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "condition_EVENT_GROUP_LOAD_90008", action = "action_EVENT_GROUP_LOAD_90008", trigger_count = 0 } } -- 变量 variables = { { config_id = 1, name = "finish", value = 0, no_refresh = true } } --================================================================ -- -- 初始化配置 -- --================================================================ -- 初始化时创建 init_config = { suite = 3, end_suite = 2, rand_suite = false } --================================================================ -- -- 小组配置 -- --================================================================ suites = { { -- suite_id = 1, -- description = suite_1, monsters = { }, gadgets = { 90002 }, regions = { 90007 }, triggers = { "GADGET_STATE_CHANGE_90003", "PLATFORM_REACH_POINT_90004", "GROUP_LOAD_90005", "AVATAR_NEAR_PLATFORM_90006", "ENTER_REGION_90007", "GROUP_LOAD_90008" }, rand_weight = 100 }, { -- suite_id = 2, -- description = suite_2, monsters = { }, gadgets = { 90001 }, regions = { }, triggers = { }, rand_weight = 100 }, { -- suite_id = 3, -- description = , monsters = { }, gadgets = { }, regions = { }, triggers = { }, rand_weight = 100 } } --================================================================ -- -- 触发器 -- --================================================================ -- 触发条件 function condition_EVENT_GADGET_STATE_CHANGE_90003(context, evt) if 90001 ~= evt.param2 or GadgetState.ChestOpened ~= evt.param1 then return false end return true end -- 触发操作 function action_EVENT_GADGET_STATE_CHANGE_90003(context, evt) -- 永久关闭CongfigId的Gadget,需要和Groups的RefreshWithBlock标签搭配 if 0 ~= ScriptLib.KillEntityByConfigId(context, { config_id = 90002 }) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : kill_entity_by_configId") return -1 end return 0 end -- 触发条件 function condition_EVENT_PLATFORM_REACH_POINT_90004(context, evt) -- 判断是gadgetid 为 90002的移动平台,是否到达了900300029 的路线中的 10 点 if 90002 ~= evt.param1 then return false end if 900300029 ~= evt.param2 then return false end if 10 ~= evt.param3 then return false end return true end -- 触发操作 function action_EVENT_PLATFORM_REACH_POINT_90004(context, evt) -- 将本组内变量名为 "finish" 的变量设置为 1 if 0 ~= ScriptLib.SetGroupVariableValue(context, "finish", 1) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_groupVariable") return -1 end -- 卸载指定gadget if 0 ~= ScriptLib.RemoveEntityByConfigId(context, 199003090, EntityType.GADGET, 90002 ) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : remove_gadget_by_configid") return -1 end -- 创建id为90001的gadget if 0 ~= ScriptLib.CreateGadget(context, { config_id = 90001 }) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : create_gadget") return -1 end -- group调整group进度,只对非randSuite有效 if 0 ~= ScriptLib.GoToGroupSuite(context, 199003090, 2) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : goto_groupSuite") return -1 end return 0 end -- 触发条件 function condition_EVENT_GROUP_LOAD_90005(context, evt) -- 判断变量"finish"为0 if ScriptLib.GetGroupVariableValue(context, "finish") ~= 0 then return false end return true end -- 触发操作 function action_EVENT_GROUP_LOAD_90005(context, evt) -- 重新生成指定group,指定suite if 0 ~= ScriptLib.RefreshGroup(context, { group_id = 199003090, suite = 1 }) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : refresh_group_to_suite") return -1 end return 0 end -- 触发条件 function condition_EVENT_AVATAR_NEAR_PLATFORM_90006(context, evt) if defs.gadget_seelie ~= evt.param1 then return false end if defs.route_2 ~= evt.param2 then return false end if defs.final_point == evt.param3 then return false end return true end -- 触发操作 function action_EVENT_AVATAR_NEAR_PLATFORM_90006(context, evt) if 0 ~= ScriptLib.StartPlatform(context, 90002) then return -1 end -- 运营数据埋点,匹配LD定义的规则使用 if 0 ~= evt.param3 then ScriptLib.MarkPlayerAction(context, 2005, 2, evt.param3 + 1) end return 0 end -- 触发条件 function condition_EVENT_ENTER_REGION_90007(context, evt) if evt.param1 ~= 90007 then return false end -- 判断角色数量不少于1 if ScriptLib.GetRegionEntityCount(context, { region_eid = evt.source_eid, entity_type = EntityType.AVATAR }) < 1 then return false end return true end -- 触发操作 function action_EVENT_ENTER_REGION_90007(context, evt) -- 设置移动平台路径 if 0 ~= ScriptLib.SetPlatformRouteId(context, 90002, 900300029) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_platform_routeId") return -1 end -- 运营数据埋点,匹配LD定义的规则使用 if 0 ~= ScriptLib.MarkPlayerAction(context, 2005, 1, 1) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : mark_playerAction") return -1 end -- 启动移动平台 if 0 ~= ScriptLib.StartPlatform(context, 90002) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : start_platform") return -1 end return 0 end -- 触发条件 function condition_EVENT_GROUP_LOAD_90008(context, evt) -- 判断变量"finish"为1 if ScriptLib.GetGroupVariableValue(context, "finish") ~= 1 then return false end return true end -- 触发操作 function action_EVENT_GROUP_LOAD_90008(context, evt) -- group调整group进度,只对非randSuite有效 if 0 ~= ScriptLib.GoToGroupSuite(context, 199003090, 2) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : goto_groupSuite") return -1 end return 0 end