So i've basicly got the following code, now I am trying to add a couple of features to it, but i'm not sure if it's possible, that's why I wanted to ask.
- When I come in range, the NPC keeps on spawning and spawning when im moving around the location, how can I make it only spawn once when in area, for let's say 30 minutes? So only able to let the npc spawn once per 30 minutes?
- Is it possible to add a Broadcast when the NPC is spawned with the location? This would require a area check i think? for example: NPC <Name> has spawned in Goldshire.
- Can I add a game object (For example a light ray) at the NPC Location to determ it's location that would dissapear when the NPC has been killed?
local NPC_ID = 1900201
local Range = 5
local spawned = false
function OnSpawn(event, creature)
function SpawnInLOS(event, creature, plr)
if (not spawned and plr:GetUnitType() == "Player" and creature:IsWithinDistInMap(plr, Range)) then
creature:SpawnCreature(6, -1017.955811, -3049.391357, 12.823728, 4.598485, 3, 30000)
spawned = true;
RegisterCreatureEvent(1900021, 23, OnSpawn)
RegisterCreatureEvent(1900201, 27, SpawnInLOS)