Dankoo
Active Member
- Joined
- Sep 4, 2010
- Messages
- 1,007
- Reaction score
- 27
I use this function to make NPC's delays:
The problem is, when someone is chatting with the NPC, everyone can see it... For example:
http://i51.tinypic.com/5xuz2u.jpg
(link to image, 'cause it's kinda big)
Trust me, I really tried to fix it, it's not about lazyness.. 'Been trying here for +1 hour and no success, I'm frustrated :s
LUA:
function doCreatureSayWithDelay(cid,text,type,delay,e,cid)
if delay<=0 then
doCreatureSay(cid,text,type, false,cid)
else
local func=function(pars)
doCreatureSay(pars.cid,pars.text,pars.type, false,pars.cid)
pars.e.done=TRUE
end
e.done=FALSE
e.event=addEvent(func,delay,{cid=cid, text=text, type=type, e=e,cid=cid})
end
end
function doNPCTalkALot(msgs,interval,cid)
local e={}
local ret={}
if interval==nil then interval=6000 end --6 seconds is default time between messages
for aux=1,table.getn(msgs) do
e[aux]={}
doCreatureSayWithDelay(getNpcCid(),msgs[aux],TALKTYPE_MONSTER,(aux-1)*interval,e[aux],pcid)
table.insert(ret,e[aux])
end
return(ret)
end
LUA:
doNPCTalkALot({"Message 1", "Message 2", "Message 3", "So on"},3000,cid)
The problem is, when someone is chatting with the NPC, everyone can see it... For example:
http://i51.tinypic.com/5xuz2u.jpg
(link to image, 'cause it's kinda big)
Trust me, I really tried to fix it, it's not about lazyness.. 'Been trying here for +1 hour and no success, I'm frustrated :s