QuaS
Cykotitan Pwned =/
You need to replace 2 functions in npc/lib/npcsystem/npchandler.lua
and onThink
now in npc .lua file you need to add to ur basic say function 1 arg:
where last arg is a delay. (TFS 0.4 rev 3660)
PHP:
function NpcHandler:say(message, focus, delay)
local delay = delay or 0;
if(NPCHANDLER_TALKDELAY == TALKDELAY_NONE or delay==0) then
if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
selfSay(message, focus)
return
else
selfSay(message)
return
end
end
-- TODO: Add an event handling method for delayed messages
if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
if(type(self.talkDelay[focus]) ~= "table") then
self.talkDelay[focus] = {};
end
table.insert(self.talkDelay[focus],{message = message, time = os.time() + delay, start = os.time()});
else
self.talkDelay = {
message = message,
time = os.time() + delay
}
end
end
and onThink
PHP:
function NpcHandler:onThink()
local callback = self:getCallback(CALLBACK_ONTHINK)
if(callback == nil or callback()) then
if(NPCHANDLER_TALKDELAY == TALKDELAY_ONTHINK) then
if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
for cid, talkDelay in pairs(self.talkDelay) do
if(type(talkDelay) == "table") then
for i=1,#talkDelay do
if(self:isFocused(cid)) then
if(talkDelay[i] and talkDelay[i].time ~= nil and talkDelay[i].message ~= nil and os.time() >= talkDelay[i].time) then
if(self.talkStart[cid] == talkDelay[i].start) then --talk start changes each msg from player.
selfSay(talkDelay[i].message, cid)
end
self.talkDelay[cid][i].time = nil;
end
else
if(talkDelay[i]) then
table.remove(talkDelay,i);
end
end
end
end
end
elseif(self.talkDelay.time ~= nil and self.talkDelay.message ~= nil and os.time() >= self.talkDelay.time) then
selfSay(self.talkDelay.message)
self.talkDelay.time = nil
self.talkDelay.message = nil
end
end
if(self:processModuleCallback(CALLBACK_ONTHINK)) then
if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
for pos, focus in pairs(self.focuses) do
if(focus ~= nil) then
if(not self:isInRange(focus)) then
self:onWalkAway(focus)
elseif((os.time() - self.talkStart[focus]) > self.idleTime) then
self:unGreet(focus)
else
self:updateFocus()
end
end
end
elseif(self.focuses ~= 0) then
if(not self:isInRange(self.focuses)) then
self:onWalkAway(self.focuses)
elseif(os.time()-self.talkStart > self.idleTime) then
self:unGreet(self.focuses)
else
self:updateFocus()
end
end
end
end
end
now in npc .lua file you need to add to ur basic say function 1 arg:
Lua:
npcHandler:say('The Brotherhood of Bones has suffered greatly in the past, but we did survive as we always will ...', cid)
npcHandler:say("You have proven resourceful by beating the silly riddles the Nightmare Knights set up to test their candidates ...", cid,4)
npcHandler:say("It's an amusing thought that after passing their test you might choose to join the ranks of their sworn enemies ... ", cid,7)
npcHandler:say("For the irony of this I ask you, ".. getCreatureName(cid) ..": Do you want to join the Brotherhood of Bones?", cid,10)
where last arg is a delay. (TFS 0.4 rev 3660)