-------------------------------------------------
Hello there. I didnt see any threads about this type of "delay" anymore, but maybe somebody still needs that.
It is little sucky, but its working for sure. Unless you dont get what is under PM me ;]
USAGE:
If you have 2 npcs and you want put disconect function in both of them you HAVE to do like that:
In FIRST npc you put
Likewise in second
Instead 1 and 2 you can put whatever you want but I have to warn you that if you won't do this like I showed you this might couse some side effects; ( I think you remember that another random npc was talking instead that which we wanted to talk )
I hope you got what I mean ^^
(SOMETHING LIKE 'bye' keyword but without words usage )
----------------------------------------------
DELAYED NPC TALKING ( I MEAN LONG STORIES FOR EXAMPLE)
----------------------------------------------
DELAYED ITEM RECIEVING
----------------------------------------------
DELAYED TALK_STATE SET (IN STORAGE VALUE)
---------------------------------------------
Hello there. I didnt see any threads about this type of "delay" anymore, but maybe somebody still needs that.
It is little sucky, but its working for sure. Unless you dont get what is under PM me ;]
USAGE:
If you have 2 npcs and you want put disconect function in both of them you HAVE to do like that:
In FIRST npc you put
Code:
function disconect[B]1[/B](param)
(REST OF CODE THERE)
function delayedDisconect[B]1[/B](cid, delay)
(REST OF CODE THERE)
Code:
function disconect[B]2[/B](param)
(REST OF CODE THERE)
function delayedDisconect[B]2[/B](cid, delay)
(REST OF CODE THERE)
Instead 1 and 2 you can put whatever you want but I have to warn you that if you won't do this like I showed you this might couse some side effects; ( I think you remember that another random npc was talking instead that which we wanted to talk )
I hope you got what I mean ^^
(SOMETHING LIKE 'bye' keyword but without words usage )
Code:
function disconect(param)
npcHandler:releaseFocus(param.cid)
end
function delayedDisconect(cid, delay)
if(not npcHandler:isFocused(cid)) then
return FALSE
else
local delay = delay or 0
local cid = cid or 0
local param = {cid = cid}
addEvent(disconect1, delay, param)
end
end
----------------------------------------------
DELAYED NPC TALKING ( I MEAN LONG STORIES FOR EXAMPLE)
Code:
function say(param)
npcHandler:say(param.text,param.cid)
end
function delayedSay(text, delay, cid)
if(not npcHandler:isFocused(cid)) then
return FALSE
else
local param = {cid = cid, text = text}
local delay = delay or 0
local cid = cid or 0
local nid = getNpcCid()
addEvent(say, delay, param)
end
end
--------------------------------------------
DELAYED ITEM RECIEVING
Code:
function item(param)
if(not npcHandler:isFocused(cid)) then
item = doCreateItemEx(param.id,param.subtype)
doPlayerAddItemEx(param.cid, item, 1)
end
return FALSE
end
function additem(cid, id, count, delay, subtype)
local param = {cid = cid, id = id}
local delay = delay or 0
local cid = cid or 0
local nid = getNpcCid()
local count = count or 0
local subtype = subtype or 0
addEvent(item, delay, param)
end
DELAYED TALK_STATE SET (IN STORAGE VALUE)
Code:
function talk_sstate(param)
setPlayerStorageValue(param.cid,param.key,param.value)
end
function delayedts(value, key, delay, cid)
if(not npcHandler:isFocused(cid)) then
return FALSE
else
local param = {cid = cid, value = value, key = key}
local delay = delay or 0
local cid = cid or 0
local nid = getNpcCid()
local key = key or 0
addEvent(talk_sstate, delay, param)
end
end