Hey, from what I understand: selfSay("text", target) is how it works.Hello. ;p
My question is:
Can make it with delay?
Example:
Text1 after 1sec
Text2 after 2sec
Etc.
Code:selfSay('Text1') selfSay( 'Text2' ) selfSay('Text3')
local ispiro_npc_delay = {}
function say(text, target)
local cid = getNpcCid()
local delay = ispiro_npc_delay[cid][target] or getWorldUpTime()
if(getWorldUpTime() >= delay) then
selfSay(text, target)
ispiro_npc_delay[cid][target] = getWorldUpTime()+1
else
addEvent(say, 250, text, target) -- try again in a second?
end
end
local ispiro_npc_delay = {}
function say(text)
local cid = getNpcCid()
local delay = ispiro_npc_delay[cid] or getWorldUpTime()
if(getWorldUpTime() >= delay) then
selfSay(text)
ispiro_npc_delay[cid] = getWorldUpTime()+1
else
addEvent(say, 250, text) -- try again in a second?
end
end
Yea, I thought of that, but what if he doesn't want it in that order, but the order player requests it.I guess he just wanted:
selfSay("text1", cid)
addEvent(selfSay, 1000, "text2", cid)
addEvent(selfSay, 2000, "text3", cid)
Dunno if its the correct form of addEvent tho![]()
Text1 after 1sec
Text2 after 2sec
Etc.
Code:
selfSay('Text1')
selfSay( 'Text2' )
selfSay('Text3')
function say(cid, text)
doCreatureSay(cid, text)
end
selfSay('Text1')
addEvent(say, 1000, getNpcCid(), 'Text2')
addEvent(say, 2000, getNpcCid(), 'Text3')
addEvent(say, 3000, getNpcCid(), 'Text4')
-- an alternative can be:
local text = {"text1", "text2", "text3", "text4"}
for i, v in ipairs(text) do
addEvent(say, (i*1000)-1000, getNpcCid(), v)
end
Well, I'm not sure really what's the problem.Nah it doesnt work
There is bug which says "addevent : a parameter should be a function" or something like that.
Maybe someone have a function getNpcCid()?P
I think i should add it into functions.lua
Btw. Im using TFS 0.3
function say(param)
doCreatureSay(param.cid, param.text)
end
selfSay('Text1')
addEvent(say, 1000, {cid = getNpcCid(), text = 'Text2'})
addEvent(say, 2000, {cid = getNpcCid(), text = 'Text3'})
addEvent(say, 3000, {cid = getNpcCid(), text = 'Text4'})