Hello, i have a script that everyone of you know, but i want to modify it.
It should do the following:
I want to spawn objects after some time like in this script:
I know that this looks terrififying for professional developer, but the NPC should change his aura every few seconds.
I hope you understand what i mean.
It should do the following:
I want to spawn objects after some time like in this script:
Code:
local npcid = {974569}; -- you can apply this to multiple npc's here.
local delay = 1*60*50 -- 30 seconds
local cycles = 1 -- must be value 1 . any value other than 1 MAY cause events to stack and freeze the core.
local allways = 1 -- constant fire after triggered = 1 // neutral after triggered fires once = 0
local ANN = {};
ANN[npcid] = {-- {"Statement", stated, linked, emote, spellid}
[1] = {"", 0, 0, 10, 0},
[2] = {"", 1, 0, 10, 0},
};
local function Drop_Event_On_Death(eventid, creature, killer)
ANN[creature:GetGUIDLow()] = nil;
creature:RemoveEvents()
end
local function Announce(id, creature)
if(ANN[npcid][id][4] == 0)then -- check emote column for emote.
creature:Emote(ANN[npcid][id][4])
creature:SummonGameObject(180246, creature:GetX(), creature:GetY(), creature:GetZ(), creature:GetO(), 3, 0)
creature:SummonGameObject(180246, creature:GetX(), creature:GetY(), creature:GetZ(), creature:GetO(), 3, 0)
creature:SummonGameObject(180246, creature:GetX(), creature:GetY(), creature:GetZ(), creature:GetO(), 3, 0)
end
if(ANN[npcid][id][2] == 0)then -- check stated column if say.
creature:SendUnitSay(ANN[npcid][id][1], 0)
creature:SummonGameObject(187079, creature:GetX(), creature:GetY(), creature:GetZ(), creature:GetO(), 3, 0)
creature:SummonGameObject(187079, creature:GetX(), creature:GetY(), creature:GetZ(), creature:GetO(), 3, 0)
creature:SummonGameObject(187079, creature:GetX(), creature:GetY(), creature:GetZ(), creature:GetO(), 3, 0)
end
if(ANN[npcid][id][2] == 1)then -- check stated column if yell.
creature:SendUnitYell(ANN[npcid][id][1], 0)
creature:SummonGameObject(181174, creature:GetX(), creature:GetY(), creature:GetZ(), creature:GetO(), 3, 0)
creature:SummonGameObject(181174, creature:GetX(), creature:GetY(), creature:GetZ(), creature:GetO(), 3, 0)
creature:SummonGameObject(181174, creature:GetX(), creature:GetY(), creature:GetZ(), creature:GetO(), 3, 0)
end
if(ANN[npcid][id][3] == 0)then -- check the linked column for key id.
Announce(ANN[npcid][id][3], creature)
end
if(ANN[npcid][id][5] == 0)then -- check the spellid column for spell id.
creature:CastSpell(creature, ANN[npcid][id][5], true)
end
end
local function TimedSay(eventId, delay, repeats, creature)
local ostime = tonumber(GetGameTime())
local seed = (ostime*ostime)
math.randomseed(seed)
local Ann = math.random(1, #ANN[npcid])
Announce(Ann, creature)
creature:RemoveEvents()
ANN[creature:GetGUIDLow()] = nil;
if(allways == 1)then
creature:RegisterEvent(TimedSay, delay, cycles)
ANN[creature:GetGUIDLow()] = {reset = 1,};
end
end
local function OnMotion(event, creature, unit)
if(unit:GetObjectType()=="Creature")then
if(ANN[creature:GetGUIDLow()]==nil)then
ANN[creature:GetGUIDLow()] = {reset = 1,};
creature:RegisterEvent(TimedSay, delay, cycles)
else
end
else
end
end
for npc=1, #npcid do
RegisterCreatureEvent(npcid[npc], 27, OnMotion)
RegisterCreatureEvent(npcid[npc], 4, Drop_Event_On_Death)
end
I know that this looks terrififying for professional developer, but the NPC should change his aura every few seconds.
I hope you understand what i mean.
Last edited by a moderator: