Files
RandomScriptsforAzerothCore/OrgArcher.lua

46 lines
1.4 KiB
Lua
Raw Normal View History

2023-03-07 20:43:48 -07:00
local OrgArcher = {}
2023-03-03 16:34:18 -07:00
local function CastShoot(eventId, delay, calls, creature)
2023-03-07 20:43:48 -07:00
local range = 200 -- set range to 200 yards
local target = creature:GetNearestCreature(range, 400035) -- find nearest target within range
if target ~= nil then
creature:CastSpell(target, 37770, true) -- cast shoot on target
end
2023-03-03 16:34:18 -07:00
end
local function CastSerpentSting(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 36984, true)
end
local function CastMultiShot(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 30990, true)
end
2023-03-07 20:43:48 -07:00
local function CastShootOnSpawn(event, creature)
local range = 200 -- set range to 200 yards
local target = creature:GetNearestCreature(range, 400035) -- find nearest target within range
if target ~= nil then
creature:CastSpell(target, 37770, true) -- cast shoot on target
end
end
2023-03-03 16:34:18 -07:00
local function OnEnterCombat(event, creature, target)
2023-03-07 20:43:48 -07:00
creature:RegisterEvent(CastShoot, 750, 0)
creature:RegisterEvent(CastSerpentSting, 15000, 0)
creature:RegisterEvent(CastMultiShot, 5000, 0)
end
2023-03-03 16:34:18 -07:00
local function OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
local function OnDied(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(400041, 1, OnEnterCombat)
RegisterCreatureEvent(400041, 2, OnLeaveCombat)
2023-03-07 20:43:48 -07:00
RegisterCreatureEvent(400041, 4, OnDied)
RegisterCreatureEvent(400035, 5, CastShootOnSpawn)