• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

hello i´m well script change help pls thx.

Status
Not open for further replies.

Xaver

Respected Member
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:
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:

Kaev

Super Moderator
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:
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.

There you go. :)
[MENTION=2]Faded[/MENTION]: I told him via PM that i will translate it for him so you can answer his questions more easily. His written german has also much errors, so google can't translate it correctly, just look at his posts. That's why i told him i would translate it for him. :)
 
Last edited:

Hyperion

Founder
There you go. :)
[MENTION=2]Faded[/MENTION]: I told him via PM that i will translate it for him so you can answer his questions more easily. His written german has also much errors, so google can't translate it correctly, just look at his posts. That's why i told him i would translate it for him. :)

Yeah, I know google is a horrible translator in general and was still a bit difficult to understand.
I only mentioned a translator so nobody would close the thread since it's non-english.

Thank you for translating him though, I'll update that on his main post.
 

slp13at420

Mad Scientist
I have been updating that script .. heck I try to update all my script for better performance/fun/functionality. -- based on my ability and knowledge.

https://github.com/BlackWolfsDen/misc/blob/master/Yelling_npc_Script_Auto.lua

again I DONT recommend you use this for mob's lol.

and I rush added a spot for spawning gob's/npc's plus a spawn duration timer. I threw it in real quick during my lunch break so I have NOT tested that feature....

ok tested and finaly got that damded ingamespawn timer to work lol need to set 3rd(after gps) argument to -1 for temp spawn I guess ... no real in-depth documentation other than AcEmu's bit about it lol.
there is also an un-listed value between map and x.

http://arcemu.org/wiki/Lua_PerformIngameSpawn
 
Last edited:

Xaver

Respected Member
ok i´m well object spawn no creature ^^

and no chat funktion only object 4-5 objects spawn on time, change the object on time. ^^

thx
 

slp13at420

Mad Scientist
it should spawn either an npc or game object depending on weather you used a 1 or 2 for spawn_type.
but it appears the gob's don't despawn lol
 

Xaver

Respected Member
ok this is not good xdxd

and one problem the object can gm see player no see the object.
 
Last edited:

slp13at420

Mad Scientist
it will spawn the gob but the gob wont de-spawn
Code:
PerformIngameSpawn(2, 500000, creature:GetMapId(), 0, creature:GetX()+2, creature:GetY(), creature:GetZ(), creature:GetO(), 1, 0, -1)
wont despawn by timer sooooooooo I added a timer to remove from world...
and yes everyone should see the gob's
 

Xaver

Respected Member
this script have one problem:

gobject is into db tabel gameobjects

and flooding db

one spawn = one entry in db

no remove from db

= 3, 4, 5, 6, days later have 20000 gobject into db ^^ this not good ^^ this script remove from world in wow but not remove from db when server restart is all full auras gobject in the game position who npc stay.
 
Last edited:

slp13at420

Mad Scientist
ok I think I fixed it
Code:
local gob = PerformIngameSpawn(spawn_type, spawn_id, creature:GetMapId(), 0, creature:GetX()+2, creature:GetY(), creature:GetZ(), creature:GetO(), 0)
now it it wont store to db.

:challengeaccepted:
 

Xaver

Respected Member
ok thx

I have a question
So when running script and I reloaded server so Eluna crash server
may be because the script objecte builds?

and they can not remove

can that be ??
 

slp13at420

Mad Scientist
hmmmm I dunno what would cause Eluna to crash your server..
I have been testing the crap out of this trying to get it to work properly . rather than waiting on the timer I just `reload Eluna` in the console then jump in front of the npc (for hours on end) over n over n over n over n over but never crashed/froze my core.

when is the last time you updated your core/Eluna ?
 

Xaver

Respected Member
hmm monday

test this for you server:

join the server and reload 10 x when script work flood reload also spam ok and report, thx
 

Xaver

Respected Member
I have last a question ^^

can you create this script for gobject ?? also gobject say cast and more ??

and solved this thread ^^ thx for you help.
 
Status
Not open for further replies.
Top