I have been using the function doNpcTalkAlot, but I have stummbled upon two problems.
The first one is that if I walk away, the NPC will continue talking.
The second one, everytime the NPC talks, every player in talking range (3 sqm) recieves the message in the NPC window instead of just the player it is inteded to.
If anybody could help me, I would apreciate it a lot
Here are the functions I have in npchandler.lua and npc.lua
The first one is that if I walk away, the NPC will continue talking.
The second one, everytime the NPC talks, every player in talking range (3 sqm) recieves the message in the NPC window instead of just the player it is inteded to.
If anybody could help me, I would apreciate it a lot
Here are the functions I have in npchandler.lua and npc.lua
Code:
function doCreatureSayWithDelay(cid,text,type,delay,e,pcid)
if delay<=0 then
doCreatureSay(cid,text,type, false,pcid)
else
local func=function(pars)
doCreatureSay(pars.cid,pars.text,pars.type, false,pars.pcid)
pars.e.done=TRUE
end
e.done=FALSE
e.event=addEvent(func,delay,{cid=cid, text=text, type=type, e=e,pcid=pcid})
end
end
function doNPCTalkALot(msgs,interval,pcid)
local e={}
local ret={}
if interval==nil then interval=10000 end --10 seconds is default time between messages
for aux=1,table.getn(msgs) do
e[aux]={}
doCreatureSayWithDelay(getNpcCid(),msgs[aux],TALKTYPE_PRIVATE_FROM_NPC,(aux-1)*interval,e[aux],pcid)
table.insert(ret,e[aux])
end
return(ret)
end