Files
Leviathan/GameServer/Resource/script/ETC_run_monster_skill.lua
T
2026-06-01 12:46:52 +02:00

109 lines
3.5 KiB
Lua

-- ETC_run_monster_skill module
function get_module_name()
return "ETC_run_monster_skill"
end
-- A function that allows you to use the skill of a monster when called from a trigger.
-- Use the server function monster_skill_cast (skill_index, monster handle, target handle) to use the skill.
-- Function arguments to be called on the trigger.
-- trigger (monster_handle, target_handle, trigger_index, x, y, layer, is_dungeon_raid_monster)
-- The index is all zero base, so the monster skill is 0, 1, 2, 3, and the trigger is 0, 1.
-- Triggers for cast:
-- TRIGGER_TYPE_NONE = 0,
-- TRIGGER_TYPE_HP_BELOW_ONCE = 1,
-- TRIGGER_TYPE_HP_BELOW_ALWAYS = 2,
-- TRIGGER_TYPE_TIME_ONCE = 3,
-- TRIGGER_TYPE_TIME_ALWAYS = 4, -- trigger_x_value_y is timer (constantly cast once per x seconds)
-- TRIGGER_TYPE_TIME_ALWAYS_INCLUDE_START = 5,
-- TRIGGER_TYPE_TIME_HP_BELOW = 6,
-- TRIGGER_TYPE_TIME_HP_OVER = 7,
function trigger( monster_handle, target_handle, idx, x, y, layer, sub_id )
local monster_id = get_monster_id( monster_handle )
-- 0 : TTTTTT
-- 1 : MTTTTT
-- 2 : MMTTTTT
-- 3 : TMTTTT
-- 4 : TTMMTT
-- 5 : TTTMMT
-- 6 : TTTMTT
if (sub_id == 0) then
monster_skill_cast( idx, monster_handle, target_handle )
else
if (sub_id==1 and idx==0) or (sub_id==2 and (idx==0 or idx==1)) or (sub_id==3 and idx==1) or (sub_id==4 and (idx==2 or idx==3)) or (sub_id==5 and (idx==3 or idx==4)) or (sub_id==6 and idx==3) then
monster_skill_cast( idx, monster_handle, monster_handle )
else
monster_skill_cast( idx, monster_handle, target_handle )
end
end
end
function trigger_ag( monster_handle, target_handle, idx, x, y, layer, sub_id )
local monster_id = get_monster_id( monster_handle )
if idx == 0 then
add_state(5997, 9, 500, target_handle)
elseif idx == 1 then
add_state(13005, 50, 12000, target_handle)
add_state(5997, 11, 8640000, target_handle)
set_auto_user( 1, target_handle )
end
end
function trigger_02M( monster_handle, target_handle, idx, x, y, layer, sub_id )
local monster_id = get_monster_id( monster_handle )
if idx == 0 then
monster_skill_cast( 2, monster_handle, monster_handle )
end
end
function trigger_02T13T( monster_handle, target_handle, idx, x, y, layer, sub_id )
local monster_id = get_monster_id( monster_handle )
if idx == 0 then
monster_skill_cast( 2, monster_handle, target_handle )
elseif idx == 1 then
monster_skill_cast( 3, monster_handle, target_handle )
end
end
function trigger_9060016( monster_handle, target_handle, idx, x, y, layer, sub_id )
local monster_id = get_monster_id( monster_handle )
if idx == 0 then
monster_skill_cast( 0, monster_handle, monster_handle )
elseif idx == 1 then
monster_skill_cast( 2, monster_handle, target_handle )
elseif idx == 2 then
monster_skill_cast( 1, monster_handle, target_handle )
elseif idx == 3 then
respawn_near_monster( monster_handle, 2055001, 6 )
end
end
function trigger_9070012( monster_handle, target_handle, idx, x, y, layer, sub_id )
local monster_id = get_monster_id( monster_handle )
if idx == 0 then
monster_skill_cast( 0, monster_handle, monster_handle )
elseif idx == 1 then
monster_skill_cast( 1, monster_handle, target_handle )
elseif idx == 2 then
monster_skill_cast( 2, monster_handle, target_handle )
elseif idx == 3 then
respawn_near_monster( monster_handle, 2065001, 6 )
elseif idx == 4 then
monster_skill_cast( 4, monster_handle, target_handle )
elseif idx == 5 then
monster_skill_cast( 5, monster_handle, target_handle )
end
end