• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

NPC [How-to] Make NPCs tell stories

So no one who can actually give me a full "how it should look" .lua of this story npc?
 
it's allready done in tfs o_O

Lua:
                                        npcHandler:say(text, cid)
					npcHandler:say(text2, cid, duration2)
                                        npcHandler:say(text3, cid, duration3)
 
Refreshing! Does it work on TFS 0.2.14? I have tried to get this working, but it didn't work.
 
For 0.4 TFS, this will work.
Code:
npcHandler:say({"Story 1",
"Story 2"
"Story 3"}, cid)
 
Haha, dude... I have wasted many hours trying to create some delay, or find some storyteller npc, and you paste just 3 lines of so short and so simple code... and it works?! You must be kidding me, that's greeeat! Omg, can't believe that it has so simple solution :D

REP++

And yes, this works on TFS 0.2.14 !
 
npcHandler:say({"text", "text2"}, cid)
WORKED FOR ME TFS 2.1.4 THANKS THIS THREAD IS LIFE SAVING.
 
Code:
function npcDelayedTalk(cid, text, player)
if isNpc(cid) and isPlayer(player) then
doCreatureSay(cid, text, TALKTYPE_PRIVATE_NP, false, player, getThingPos(cid))
end
end

function selfStory(msg, player, delay)
local interval, npc = delay or 5000, getNpcCid()
local ret = {}

for i, message in pairs(msg) do
if i == 1 then
doCreatureSay(npc, message, TALKTYPE_PRIVATE_NP, false, player, getThingPos(npc))
else
local r = addEvent(npcDelayedTalk, (i-1)*interval, npc, message, player)
table.insert(ret, r)
end
end
return ret
end

add at the top of npc.lua or at the end ?
 
Back
Top