Code:
local NPC_Entry = 90061 -- Your Invisible Trigger NPC ID
local Inrange_Distance = 200 -- Edit to your Desired Distance in Yards.
function TriggerNPC(unit, event)
unit:RegisterEvent("Aura_Trigger", 2000, 0) -- 2000 = How often it occurs.
end
function Aura_Trigger(unit, event, player)
local plrs = unit:GetInRangePlayers()
for k, v in pairs(plrs) do
if (unit:GetDistance(v) < Inrange_Distance) then
v:CastSpell(69127)
v:CastSpell(69127)
end
end
end
RegisterUnitEvent(NPC_Entry, 18, "TriggerNPC")
I used this script as a invisible trigger for icecrown citadel, it works the same way.
Change :CastSpell to :AddItem(id, amount).
When you spawn the npc it doesn't have to be a invisible display id, just change it's phase so nobody can see it. .npc setphase (x)