-- 基础信息 local base_info = { group_id = 243012002 } -- Trigger变量 local defs = { gadget_1 = 2001, group_1 = 243012002, group_core = 243012003, challenge_father = 999, challenge1 = 120, PoolList = 21027, MonsterCount = 5, challenge_kill = 233, total_count = 5, min_count = 3, max_count = 3, tag = 0, Region1 = 2008 } --================================================================ -- -- 配置 -- --================================================================ -- 怪物 monsters = { } -- NPC npcs = { } -- 装置 gadgets = { { config_id = 2001, gadget_id = 70360010, pos = { x = 32.738, y = -19.674, z = -52.183 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 1 } } -- 区域 regions = { { config_id = 2008, shape = RegionShape.CUBIC, size = { x = 80.000, y = 50.000, z = 80.000 }, pos = { x = 32.738, y = -19.674, z = -52.183 } } } -- 触发器 triggers = { { config_id = 1002002, name = "GADGET_CREATE_2002", event = EventType.EVENT_GADGET_CREATE, source = "", condition = "condition_EVENT_GADGET_CREATE_2002", action = "action_EVENT_GADGET_CREATE_2002" }, { config_id = 1002003, name = "SELECT_OPTION_2003", event = EventType.EVENT_SELECT_OPTION, source = "", condition = "condition_EVENT_SELECT_OPTION_2003", action = "action_EVENT_SELECT_OPTION_2003", trigger_count = 0 }, { config_id = 1002004, name = "VARIABLE_CHANGE_2004", event = EventType.EVENT_VARIABLE_CHANGE, source = "success", condition = "condition_EVENT_VARIABLE_CHANGE_2004", action = "action_EVENT_VARIABLE_CHANGE_2004", trigger_count = 0 }, -- { config_id = 1002005, name = "CHALLENGE_SUCCESS_2005", event = EventType.EVENT_CHALLENGE_SUCCESS, source = "120", condition = "", action = "" }, { config_id = 1002006, name = "CHALLENGE_FAIL_2006", event = EventType.EVENT_CHALLENGE_FAIL, source = "120", condition = "", action = "action_EVENT_CHALLENGE_FAIL_2006" }, { config_id = 1002007, name = "ANY_MONSTER_DIE_2007", event = EventType.EVENT_ANY_MONSTER_DIE, source = "", condition = "condition_EVENT_ANY_MONSTER_DIE_2007", action = "action_EVENT_ANY_MONSTER_DIE_2007", trigger_count = 0 }, { config_id = 1002008, name = "LEAVE_REGION_2008", event = EventType.EVENT_LEAVE_REGION, source = "", condition = "condition_EVENT_LEAVE_REGION_2008", action = "action_EVENT_LEAVE_REGION_2008", trigger_count = 0 }, { config_id = 1002009, name = "ANY_MONSTER_LIVE_2009", event = EventType.EVENT_ANY_MONSTER_LIVE, source = "", condition = "condition_EVENT_ANY_MONSTER_LIVE_2009", action = "action_EVENT_ANY_MONSTER_LIVE_2009", trigger_count = 0 }, { config_id = 1002010, name = "ANY_MONSTER_DIE_2010", event = EventType.EVENT_ANY_MONSTER_DIE, source = "", condition = "", action = "action_EVENT_ANY_MONSTER_DIE_2010", trigger_count = 0 } } -- 点位 points = { { config_id = 2011, pos = { x = 25.547, y = -20.225, z = -49.999 }, rot = { x = 0.000, y = 85.813, z = 0.000 } }, { config_id = 2012, pos = { x = 27.273, y = -19.498, z = -43.684 }, rot = { x = 0.000, y = 117.552, z = 0.000 } }, { config_id = 2013, pos = { x = 33.832, y = -19.554, z = -40.419 }, rot = { x = 0.000, y = 184.777, z = 0.000 } }, { config_id = 2014, pos = { x = 39.860, y = -19.498, z = -43.148 }, rot = { x = 0.000, y = 205.216, z = 0.000 } }, { config_id = 2015, pos = { x = 41.762, y = -19.498, z = -49.293 }, rot = { x = 0.000, y = 273.550, z = 0.000 } } } -- 变量 variables = { { config_id = 1, name = "success", value = 0, no_refresh = false } } --================================================================ -- -- 初始化配置 -- --================================================================ -- 初始化时创建 init_config = { suite = 1, end_suite = 0, rand_suite = false } --================================================================ -- -- 小组配置 -- --================================================================ suites = { { -- suite_id = 1, -- description = , monsters = { }, gadgets = { 2001 }, regions = { 2008 }, triggers = { "GADGET_CREATE_2002", "SELECT_OPTION_2003", "VARIABLE_CHANGE_2004", "CHALLENGE_SUCCESS_2005", "CHALLENGE_FAIL_2006", "LEAVE_REGION_2008", "ANY_MONSTER_DIE_2010" }, rand_weight = 100 }, { -- suite_id = 2, -- description = , monsters = { }, gadgets = { }, regions = { }, triggers = { "CHALLENGE_SUCCESS_2005", "CHALLENGE_FAIL_2006" }, rand_weight = 100 } } --================================================================ -- -- 触发器 -- --================================================================ -- 触发条件 function condition_EVENT_GADGET_CREATE_2002(context, evt) if defs.gadget_1 ~= evt.param1 then return false end return true end -- 触发操作 function action_EVENT_GADGET_CREATE_2002(context, evt) -- 设置操作台选项 if 0 ~= ScriptLib.SetWorktopOptionsByGroupId(context, defs.group_1, defs.gadget_1, {7}) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_wok_options_by_configid") return -1 end return 0 end -- 触发条件 function condition_EVENT_SELECT_OPTION_2003(context, evt) -- 判断是gadgetid 2001 option_id 7 if 2001 ~= evt.param1 then return false end if 7 ~= evt.param2 then return false end return true end -- 触发操作 function action_EVENT_SELECT_OPTION_2003(context, evt) --向编号999的父挑战挂接子挑战 ScriptLib.ExecuteGroupLua(context,defs.group_core,"SetKillMonsterTarget" ,{defs.group_1, defs.MonsterCount}) ScriptLib.ExecuteGroupLua(context,defs.group_core,"StartSubChallengeKillMonster" ,{defs.challenge1, defs.challenge_kill}) --开启怪物潮 ScriptLib.AutoPoolMonsterTide(context, 1, defs.group_1, {defs.PoolList}, 0, {}, {}, {total_count=defs.total_count, min_count=defs.min_count, max_count=defs.max_count, tag=defs.tag, fill_time=0, fill_count=0, is_ordered = true}) -- 删除指定group: 243007004 ;指定config:4001;物件身上指定option:7; if 0 ~= ScriptLib.DelWorktopOptionByGroupId(context, defs.group_1, defs.gadget_1, 7) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : del_work_options_by_group_configId") return -1 end -- 将configid为 4001 的物件更改为状态 GadgetState.Default if 0 ~= ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_1, GadgetState.GearStop) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_gadget_state_by_configId") return -1 end -- 卸载指定gadget if 0 ~= ScriptLib.RemoveEntityByConfigId(context, defs.group_core, EntityType.GADGET, 3008 ) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : remove_gadget_by_configid") return -1 end return 0 end -- 触发条件 function condition_EVENT_VARIABLE_CHANGE_2004(context, evt) if evt.param1 == evt.param2 then return false end -- 判断变量"success"为1 if ScriptLib.GetGroupVariableValue(context, "success") ~= 1 then return false end -- 判断变量"success"为0 if ScriptLib.GetGroupVariableValueByGroup(context, "success", 243012003) ~= 0 then return false end return true end -- 触发操作 function action_EVENT_VARIABLE_CHANGE_2004(context, evt) -- 针对当前group内变量名为 "f1" 的变量,进行修改,变化值为 1 if 0 ~= ScriptLib.ChangeGroupVariableValueByGroup(context, "success", 1, defs.group_core) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : change_GroupVariable_by_group") return -1 end return 0 end -- 触发操作 function action_EVENT_CHALLENGE_FAIL_2006(context, evt) -- 改变指定group组243007013中, configid为4001的gadget的state if 0 ~= ScriptLib.SetGroupGadgetStateByConfigId(context, defs.group_1, defs.gadget_1, GadgetState.Default) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_gadget_state_by_GroupId_ConfigId") return -1 end -- 设置操作台选项 if 0 ~= ScriptLib.SetWorktopOptionsByGroupId(context, defs.group_1, defs.gadget_1, {7}) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_wok_options_by_configid") return -1 end -- 重新生成指定group,指定suite if 0 ~= ScriptLib.RefreshGroup(context, { group_id = defs.group_1, suite = 1 }) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : refresh_group_to_suite") return -1 end return 0 end -- 触发条件 function condition_EVENT_ANY_MONSTER_DIE_2007(context, evt) --检查configeID是否大于0 if 0 >= evt.param1 then return false end return true end -- 触发操作 function action_EVENT_ANY_MONSTER_DIE_2007(context, evt) -- 针对当前group内变量名为 "key" 的变量,进行修改,变化值为 1 if 0 ~= ScriptLib.ChangeGroupVariableValue(context, "key1", 1) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : change_GroupVariable") return -1 end --通知父挑战积分+1 ScriptLib.ExecuteGroupLua(context, defs.group_core, "AddChildChallengeScore", {1}) return 0 end -- 触发条件 function condition_EVENT_LEAVE_REGION_2008(context, evt) -- 判断是区域8011 if ScriptLib.GetRegionConfigId(context, { region_eid = evt.source_eid }) ~= defs.Region1 then return false end return true end -- 触发操作 function action_EVENT_LEAVE_REGION_2008(context, evt) --离开区域 挑战失败 ScriptLib.ExecuteGroupLua(context, defs.group_core, "StopMistTrialChildChallenge", {defs.challenge1,0}) --清理怪物潮 ScriptLib.ClearPoolMonsterTide(context, defs.group_1, 1); -- 重新生成指定group,指定suite if 0 ~= ScriptLib.RefreshGroup(context, { group_id = defs.group_1, suite = 1 }) then ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : refresh_group_to_suite") return -1 end return 0 end -- 触发条件 function condition_EVENT_ANY_MONSTER_LIVE_2009(context, evt) if defs.monster_1 ~= evt.param1 then return false end return true end -- 触发操作 function action_EVENT_ANY_MONSTER_LIVE_2009(context, evt) --向编号999的父挑战挂接子挑战 ScriptLib.ExecuteGroupLua(context, defs.group_core, "DefineFatherIndex",{defs.challenge_father}) ScriptLib.ExecuteGroupLua(context, defs.group_core, "DefineChildChallengeScore",{ 1, 1}) ScriptLib.ExecuteGroupLua(context, defs.group_core, "AttachChildChallengeFromDiffGroup",{defs.challenge1, 233, 2}) return 0 end -- 触发操作 function action_EVENT_ANY_MONSTER_DIE_2010(context, evt) --发送怪物死亡通知 ScriptLib.ExecuteGroupLua(context, defs.group_core, "AddMistTrialChildChallengeScore", {1}) return 0 end