• 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!

Lua NPC Time

yolfran

Mapper-Chibcha
Joined
Jan 14, 2009
Messages
59
Reaction score
0
Location
Bucaramanga-Colombia!!!
Hello otlanders :D

I want to do an npc that talk with players slowly,for example

PHP:
npcHandler:say("I need you travel to lacost city ,and bringme an abacus that Lucius have.", cid) 
TIME=2 Seconds
npcHandler:say("He is in the Burj al arab Hotel.", cid) 
TIME=2 Seconds
npcHandler:say("Ohh.Give him this note please.", cid)
doPlayerAddItem(cid, 7726, 1)

2 seconds between the first conversation and the second one,thas all,but I have no idea how to do that :S
I use 0.3.6 crying damson
Thx for the help :D
 
Last edited:
Code:
local function delay(func, msg, cid)
	return isPlayer(cid) and func(msg, cid)
end
Code:
	selfSay("I need you travel to lacost city, and bring me an abacus that Lucius has.", cid) 
	addEvent(delay, 2000, selfSay, "He is in the Burj al arab Hotel.", cid)
	addEvent(delay, 4000, selfSay, "Ohh, give him this note please.", cid)
	doPlayerAddItem(cid, 7726, 1)
 
I'm curious, are you gonna use it for a quest?
Cause it would be dam cool to have an npc tell you about a quest but like 2 minutes after you ask him. Lmao xD
 
@up its only for the conversation xD ,and you just need wait 5 or 6 seconds :D

@topic

I have a little error here xD

this is the conversation:

00:44 Francis Drake: Hello Flipali.I looking for you,can you help me?
00:44 Flipali [45]: help
00:44 Francis Drake: I need you travel to lacost city, and bring me an abacus that Lucius has.
00:44 Eryn: He is in the Burj al arab Hotel.
00:44 Master Of trade: Ohh, give him this note please.

wtf,other npc talking in the same conversation :O,jajaja i dont know why :S
i'm using the funcition that cykotitan give,this is the npc now:

PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)                          npcHandler:onCreatureAppear(cid)                        end
function onCreatureDisappear(cid)                       npcHandler:onCreatureDisappear(cid)                     end
function onCreatureSay(cid, type, msg)                  npcHandler:onCreatureSay(cid, type, msg)                end
function onThink()                                      npcHandler:onThink()                                    end
function creatureSayCallback(cid, type, msg)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	--[[
	REMEMBER TO SET YOUR STORAGE AS YOURSTORAGE!
	]]--
local function delay(func, msg, cid)
	return isPlayer(cid) and func(msg, cid)
end
      local storage = 7423
	if(msgcontains(msg, 'hotel') or msgcontains(msg, 'quest') or msgcontains(msg, 'abacus') or msgcontains(msg, 'mission') or msgcontains(msg, 'help')) then
		if(getPlayerStorageValue(cid, storage) < 1) then
	selfSay("I need you travel to lacost city, and bring me an abacus that Lucius has.", cid) 
	addEvent(delay, 3000, selfSay, "He is in the Burj al arab Hotel.", cid)
	addEvent(delay, 6000, selfSay, "Ohh, give him this note please.", cid)
	doPlayerAddItem(cid, 7726, 1)
                  setPlayerStorageValue(cid, storage, 1)
		elseif(getPlayerStorageValue(cid, storage) == 1) then
			npcHandler:say("Do you have my abacus?", cid)
			talkState[talkUser] = 1
		elseif(getPlayerStorageValue(cid, storage) == 2) then
			npcHandler:say("Sorry, you have already helped me.", cid)
		end
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		if(doPlayerRemoveItem(cid,5798,1) == TRUE) then
			npcHandler:say("You saved me,take this item for an addon!!!", cid)
			doPlayerAddItem(cid, 6107, 1)
                  doPlayerAddExperience(cid, 30000)
			setPlayerStorageValue(cid, storage, 2)
                  talkState[talkUser] = 0
		else
			npcHandler:say("I need my abacus now!!!.", cid)
                  talkState[talkUser] = 0
		end
	elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
		npcHandler:say("Then not.", cid)
		talkState[talkUser] = 0
	end
	return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top