372 lines
14 KiB
Go
372 lines
14 KiB
Go
-- 基础信息
|
||
local base_info = {
|
||
group_id = 220005010
|
||
}
|
||
|
||
-- Trigger变量
|
||
local defs = {
|
||
max_gear = 4,
|
||
timer = 10,
|
||
group_id = 220005010,
|
||
gadget_1 = 10001,
|
||
gadget_2 = 10002,
|
||
gadget_3 = 10003,
|
||
gadget_4 = 10005,
|
||
gadget_chest = 0
|
||
}
|
||
|
||
--================================================================
|
||
--
|
||
-- 配置
|
||
--
|
||
--================================================================
|
||
|
||
-- 怪物
|
||
monsters = {
|
||
}
|
||
|
||
-- NPC
|
||
npcs = {
|
||
}
|
||
|
||
-- 装置
|
||
gadgets = {
|
||
{ config_id = 10001, gadget_id = 70900007, pos = { x = -234.114, y = 27.813, z = 168.074 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 1, state = GadgetState.Action01, persistent = true },
|
||
{ config_id = 10002, gadget_id = 70900007, pos = { x = -227.356, y = 27.813, z = 174.720 }, rot = { x = 0.000, y = 270.000, z = 0.000 }, level = 1, state = GadgetState.Action01, persistent = true },
|
||
{ config_id = 10003, gadget_id = 70900007, pos = { x = -234.085, y = 27.813, z = 174.570 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 1, state = GadgetState.Action01, persistent = true },
|
||
{ config_id = 10005, gadget_id = 70900007, pos = { x = -227.421, y = 27.813, z = 168.056 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 1, state = GadgetState.Action01, persistent = true },
|
||
{ config_id = 10009, gadget_id = 70350025, pos = { x = -257.591, y = 31.412, z = 171.546 }, rot = { x = 0.000, y = 90.000, z = 0.000 }, level = 1 },
|
||
{ config_id = 10010, gadget_id = 70900201, pos = { x = -289.577, y = 32.986, z = 171.626 }, rot = { x = 0.000, y = 87.592, z = 0.000 }, level = 1 },
|
||
{ config_id = 10011, gadget_id = 70350019, pos = { x = -216.913, y = 25.323, z = 160.570 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 1, state = GadgetState.GearAction1 },
|
||
{ config_id = 10012, gadget_id = 70350019, pos = { x = -239.733, y = 25.467, z = 184.172 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 1, state = GadgetState.GearAction1 },
|
||
{ config_id = 10013, gadget_id = 70350019, pos = { x = -218.668, y = 25.438, z = 182.493 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 1, state = GadgetState.GearAction1 }
|
||
}
|
||
|
||
-- 区域
|
||
regions = {
|
||
}
|
||
|
||
-- 触发器
|
||
triggers = {
|
||
{ config_id = 1010004, name = "GADGET_STATE_CHANGE_10004", event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "condition_EVENT_GADGET_STATE_CHANGE_10004", action = "action_EVENT_GADGET_STATE_CHANGE_10004" },
|
||
{ config_id = 1010006, name = "GADGET_STATE_CHANGE_10006", event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "condition_EVENT_GADGET_STATE_CHANGE_10006", action = "action_EVENT_GADGET_STATE_CHANGE_10006", trigger_count = 0 },
|
||
{ config_id = 1010007, name = "TIMER_EVENT_10007", event = EventType.EVENT_TIMER_EVENT, source = "time1", condition = "", action = "action_EVENT_TIMER_EVENT_10007", trigger_count = 0 },
|
||
{ config_id = 1010008, name = "VARIABLE_CHANGE_10008", event = EventType.EVENT_VARIABLE_CHANGE, source = "active_count", condition = "condition_EVENT_VARIABLE_CHANGE_10008", action = "action_EVENT_VARIABLE_CHANGE_10008", trigger_count = 0 },
|
||
{ config_id = 1010014, name = "GADGET_STATE_CHANGE_10014", event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "condition_EVENT_GADGET_STATE_CHANGE_10014", action = "action_EVENT_GADGET_STATE_CHANGE_10014", trigger_count = 0 },
|
||
{ config_id = 1010015, name = "GADGET_STATE_CHANGE_10015", event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "condition_EVENT_GADGET_STATE_CHANGE_10015", action = "action_EVENT_GADGET_STATE_CHANGE_10015", trigger_count = 0 },
|
||
{ config_id = 1010016, name = "GADGET_STATE_CHANGE_10016", event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "condition_EVENT_GADGET_STATE_CHANGE_10016", action = "action_EVENT_GADGET_STATE_CHANGE_10016", trigger_count = 0 },
|
||
{ config_id = 1010017, name = "TIMER_EVENT_10017", event = EventType.EVENT_TIMER_EVENT, source = "time2", condition = "", action = "action_EVENT_TIMER_EVENT_10017", trigger_count = 0 },
|
||
{ config_id = 1010018, name = "TIMER_EVENT_10018", event = EventType.EVENT_TIMER_EVENT, source = "time3", condition = "", action = "action_EVENT_TIMER_EVENT_10018", trigger_count = 0 },
|
||
{ config_id = 1010019, name = "TIMER_EVENT_10019", event = EventType.EVENT_TIMER_EVENT, source = "time4", condition = "", action = "action_EVENT_TIMER_EVENT_10019", trigger_count = 0 }
|
||
}
|
||
|
||
-- 变量
|
||
variables = {
|
||
{ config_id = 1, name = "active_count", value = 0, no_refresh = false }
|
||
}
|
||
|
||
--================================================================
|
||
--
|
||
-- 初始化配置
|
||
--
|
||
--================================================================
|
||
|
||
-- 初始化时创建
|
||
init_config = {
|
||
suite = 1,
|
||
end_suite = 0,
|
||
rand_suite = false
|
||
}
|
||
|
||
--================================================================
|
||
--
|
||
-- 小组配置
|
||
--
|
||
--================================================================
|
||
|
||
suites = {
|
||
{
|
||
-- suite_id = 1,
|
||
-- description = suite_1,
|
||
monsters = { },
|
||
gadgets = { 10001, 10002, 10003, 10005, 10009, 10011, 10012, 10013 },
|
||
regions = { },
|
||
triggers = { "GADGET_STATE_CHANGE_10004", "GADGET_STATE_CHANGE_10006", "TIMER_EVENT_10007", "VARIABLE_CHANGE_10008", "GADGET_STATE_CHANGE_10014", "GADGET_STATE_CHANGE_10015", "GADGET_STATE_CHANGE_10016", "TIMER_EVENT_10017", "TIMER_EVENT_10018", "TIMER_EVENT_10019" },
|
||
rand_weight = 100
|
||
}
|
||
}
|
||
|
||
--================================================================
|
||
--
|
||
-- 触发器
|
||
--
|
||
--================================================================
|
||
|
||
-- 触发条件
|
||
function condition_EVENT_GADGET_STATE_CHANGE_10004(context, evt)
|
||
if 10009 ~= evt.param2 or GadgetState.GearStart ~= evt.param1 then
|
||
return false
|
||
end
|
||
|
||
return true
|
||
end
|
||
|
||
-- 触发操作
|
||
function action_EVENT_GADGET_STATE_CHANGE_10004(context, evt)
|
||
-- 创建id为10010的gadget
|
||
if 0 ~= ScriptLib.CreateGadget(context, { config_id = 10010 }) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : create_gadget")
|
||
return -1
|
||
end
|
||
|
||
-- 杀死Group内指定的monster和gadget
|
||
if 0 ~= ScriptLib.KillGroupEntity(context, { group_id = 220005006, monsters = {}, gadgets = {6002} }) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : kill_monsters_and_gadgets_by_group")
|
||
return -1
|
||
end
|
||
|
||
return 0
|
||
end
|
||
|
||
-- 触发条件
|
||
function condition_EVENT_GADGET_STATE_CHANGE_10006(context, evt)
|
||
if 10001 ~= evt.param2 or GadgetState.Action02 ~= evt.param1 then
|
||
return false
|
||
end
|
||
|
||
return true
|
||
end
|
||
|
||
-- 触发操作
|
||
function action_EVENT_GADGET_STATE_CHANGE_10006(context, evt)
|
||
-- 延迟4秒后,向groupId为:220005010的对象,请求一次调用,并将string参数:"time1" 传递过去
|
||
if 0 ~= ScriptLib.CreateGroupTimerEvent(context, 220005010, "time1", 4) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : create_timerevent_by_group")
|
||
return -1
|
||
end
|
||
|
||
-- 针对当前group内变量名为 "active_count" 的变量,进行修改,变化值为 1
|
||
if 0 ~= ScriptLib.ChangeGroupVariableValue(context, "active_count", 1) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : change_GroupVariable")
|
||
return -1
|
||
end
|
||
|
||
return 0
|
||
end
|
||
|
||
-- 触发操作
|
||
function action_EVENT_TIMER_EVENT_10007(context, evt)
|
||
-- 将configid为 10001 的物件更改为状态 GadgetState.Action01
|
||
if 0 ~= ScriptLib.SetGadgetStateByConfigId(context, 10001, GadgetState.Action01) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_gadget_state_by_configId")
|
||
return -1
|
||
end
|
||
|
||
-- 针对当前group内变量名为 "active_count" 的变量,进行修改,变化值为 -1
|
||
if 0 ~= ScriptLib.ChangeGroupVariableValue(context, "active_count", -1) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : change_GroupVariable")
|
||
return -1
|
||
end
|
||
|
||
return 0
|
||
end
|
||
|
||
-- 触发条件
|
||
function condition_EVENT_VARIABLE_CHANGE_10008(context, evt)
|
||
if evt.param1 == evt.param2 then return false end
|
||
|
||
-- 判断变量"active_count"为4
|
||
if ScriptLib.GetGroupVariableValue(context, "active_count") ~= 4 then
|
||
return false
|
||
end
|
||
|
||
return true
|
||
end
|
||
|
||
-- 触发操作
|
||
function action_EVENT_VARIABLE_CHANGE_10008(context, evt)
|
||
-- 将configid为 10001 的物件更改为状态 GadgetState.GearStart
|
||
if 0 ~= ScriptLib.SetGadgetStateByConfigId(context, 10001, GadgetState.GearStart) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_gadget_state_by_configId")
|
||
return -1
|
||
end
|
||
|
||
-- 将configid为 10002 的物件更改为状态 GadgetState.GearStart
|
||
if 0 ~= ScriptLib.SetGadgetStateByConfigId(context, 10002, GadgetState.GearStart) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_gadget_state_by_configId")
|
||
return -1
|
||
end
|
||
|
||
-- 将configid为 10003 的物件更改为状态 GadgetState.GearStart
|
||
if 0 ~= ScriptLib.SetGadgetStateByConfigId(context, 10003, GadgetState.GearStart) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_gadget_state_by_configId")
|
||
return -1
|
||
end
|
||
|
||
-- 将configid为 10005 的物件更改为状态 GadgetState.GearStart
|
||
if 0 ~= ScriptLib.SetGadgetStateByConfigId(context, 10005, GadgetState.GearStart) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_gadget_state_by_configId")
|
||
return -1
|
||
end
|
||
|
||
-- 将configid为 10009 的物件更改为状态 GadgetState.GearStart
|
||
if 0 ~= ScriptLib.SetGadgetStateByConfigId(context, 10009, GadgetState.GearStart) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_gadget_state_by_configId")
|
||
return -1
|
||
end
|
||
|
||
-- 取消group中对应名称的TimerEvent
|
||
if 0 ~= ScriptLib.CancelGroupTimerEvent(context, 220005010, "time1") then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : cancel_timerevent_by_group")
|
||
return -1
|
||
end
|
||
|
||
-- 取消group中对应名称的TimerEvent
|
||
if 0 ~= ScriptLib.CancelGroupTimerEvent(context, 220005010, "time2") then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : cancel_timerevent_by_group")
|
||
return -1
|
||
end
|
||
|
||
-- 取消group中对应名称的TimerEvent
|
||
if 0 ~= ScriptLib.CancelGroupTimerEvent(context, 220005010, "time3") then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : cancel_timerevent_by_group")
|
||
return -1
|
||
end
|
||
|
||
-- 取消group中对应名称的TimerEvent
|
||
if 0 ~= ScriptLib.CancelGroupTimerEvent(context, 220005010, "time4") then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : cancel_timerevent_by_group")
|
||
return -1
|
||
end
|
||
|
||
return 0
|
||
end
|
||
|
||
-- 触发条件
|
||
function condition_EVENT_GADGET_STATE_CHANGE_10014(context, evt)
|
||
if 10002 ~= evt.param2 or GadgetState.Action02 ~= evt.param1 then
|
||
return false
|
||
end
|
||
|
||
return true
|
||
end
|
||
|
||
-- 触发操作
|
||
function action_EVENT_GADGET_STATE_CHANGE_10014(context, evt)
|
||
-- 延迟4秒后,向groupId为:220005010的对象,请求一次调用,并将string参数:"time2" 传递过去
|
||
if 0 ~= ScriptLib.CreateGroupTimerEvent(context, 220005010, "time2", 4) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : create_timerevent_by_group")
|
||
return -1
|
||
end
|
||
|
||
-- 针对当前group内变量名为 "active_count" 的变量,进行修改,变化值为 1
|
||
if 0 ~= ScriptLib.ChangeGroupVariableValue(context, "active_count", 1) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : change_GroupVariable")
|
||
return -1
|
||
end
|
||
|
||
return 0
|
||
end
|
||
|
||
-- 触发条件
|
||
function condition_EVENT_GADGET_STATE_CHANGE_10015(context, evt)
|
||
if 10003 ~= evt.param2 or GadgetState.Action02 ~= evt.param1 then
|
||
return false
|
||
end
|
||
|
||
return true
|
||
end
|
||
|
||
-- 触发操作
|
||
function action_EVENT_GADGET_STATE_CHANGE_10015(context, evt)
|
||
-- 延迟4秒后,向groupId为:220005010的对象,请求一次调用,并将string参数:"time3" 传递过去
|
||
if 0 ~= ScriptLib.CreateGroupTimerEvent(context, 220005010, "time3", 4) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : create_timerevent_by_group")
|
||
return -1
|
||
end
|
||
|
||
-- 针对当前group内变量名为 "active_count" 的变量,进行修改,变化值为 1
|
||
if 0 ~= ScriptLib.ChangeGroupVariableValue(context, "active_count", 1) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : change_GroupVariable")
|
||
return -1
|
||
end
|
||
|
||
return 0
|
||
end
|
||
|
||
-- 触发条件
|
||
function condition_EVENT_GADGET_STATE_CHANGE_10016(context, evt)
|
||
if 10005 ~= evt.param2 or GadgetState.Action02 ~= evt.param1 then
|
||
return false
|
||
end
|
||
|
||
return true
|
||
end
|
||
|
||
-- 触发操作
|
||
function action_EVENT_GADGET_STATE_CHANGE_10016(context, evt)
|
||
-- 延迟4秒后,向groupId为:220005010的对象,请求一次调用,并将string参数:"time4" 传递过去
|
||
if 0 ~= ScriptLib.CreateGroupTimerEvent(context, 220005010, "time4", 4) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : create_timerevent_by_group")
|
||
return -1
|
||
end
|
||
|
||
-- 针对当前group内变量名为 "active_count" 的变量,进行修改,变化值为 1
|
||
if 0 ~= ScriptLib.ChangeGroupVariableValue(context, "active_count", 1) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : change_GroupVariable")
|
||
return -1
|
||
end
|
||
|
||
return 0
|
||
end
|
||
|
||
-- 触发操作
|
||
function action_EVENT_TIMER_EVENT_10017(context, evt)
|
||
-- 将configid为 10002 的物件更改为状态 GadgetState.Action01
|
||
if 0 ~= ScriptLib.SetGadgetStateByConfigId(context, 10002, GadgetState.Action01) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_gadget_state_by_configId")
|
||
return -1
|
||
end
|
||
|
||
-- 针对当前group内变量名为 "active_count" 的变量,进行修改,变化值为 -1
|
||
if 0 ~= ScriptLib.ChangeGroupVariableValue(context, "active_count", -1) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : change_GroupVariable")
|
||
return -1
|
||
end
|
||
|
||
return 0
|
||
end
|
||
|
||
-- 触发操作
|
||
function action_EVENT_TIMER_EVENT_10018(context, evt)
|
||
-- 将configid为 10003 的物件更改为状态 GadgetState.Action01
|
||
if 0 ~= ScriptLib.SetGadgetStateByConfigId(context, 10003, GadgetState.Action01) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_gadget_state_by_configId")
|
||
return -1
|
||
end
|
||
|
||
-- 针对当前group内变量名为 "active_count" 的变量,进行修改,变化值为 -1
|
||
if 0 ~= ScriptLib.ChangeGroupVariableValue(context, "active_count", -1) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : change_GroupVariable")
|
||
return -1
|
||
end
|
||
|
||
return 0
|
||
end
|
||
|
||
-- 触发操作
|
||
function action_EVENT_TIMER_EVENT_10019(context, evt)
|
||
-- 将configid为 10005 的物件更改为状态 GadgetState.Action01
|
||
if 0 ~= ScriptLib.SetGadgetStateByConfigId(context, 10005, GadgetState.Action01) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_gadget_state_by_configId")
|
||
return -1
|
||
end
|
||
|
||
-- 针对当前group内变量名为 "active_count" 的变量,进行修改,变化值为 -1
|
||
if 0 ~= ScriptLib.ChangeGroupVariableValue(context, "active_count", -1) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : change_GroupVariable")
|
||
return -1
|
||
end
|
||
|
||
return 0
|
||
end |