• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

addEvent on SlefSay[NPC]

Pitufo™

InfinityOT.com
Joined
Feb 14, 2008
Messages
1,438
Reaction score
10
Location
Mexico, Cuernavaca
Can somone give me an example for addEvent on Selfsay for NPC...

Ive tried alot of things, the only one workings is using like this:

addEvent(selfsay, 5000, cid)

The addEvent works but the NPC im talking too doesnt say the addEvent is another NPC that tell me the addEvent LOL,

Also ive tried with:

addEvent(selfsay, 5000, getNpcCid())
addEvent(selfsay, 5000, {cid=getNpcCid()})

And many other things...

Im using TFS 0.3 Beta 2
 
PHP:
funcion specialUltraMegaSuperSay(p)
selfSay(p.msg, p.cid)
end

addEvent(specialUltraMegaSuperSay, 5000, {msg="Text",cid=cid})

edit:

example for working on 8.2 servers and later.

PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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

funcion specialUltraMegaSuperSay(p)
selfSay(p.msg, p.cid)
end

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return FALSE
	end

	
	if msgcontains(msg, 'cookie') then
		npcHandler:say("Let me think.", cid)
                addEvent(specialUltraMegaSuperSay, 5000, {msg="Oh yah, it's like this XXXX",cid=cid})
	end
	
	return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Edit: It works but another NPC send me the addEvent lol, not the one im talking too.

Edit2: Both scripts are working but i whant that the same NPC gives me the addEvent not another NPC...
 
Last edited:
Look this image:

http://img352.imageshack.us/img352/6784/errorfu8.png

errorfu8.png
 
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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

funcion specialUltraMegaSuperSay(p)
npcHandler:say(p.msg, p.cid)
end

function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return FALSE
    end

    
    if msgcontains(msg, 'cookie') then
        npcHandler:say("Let me think...", cid)
        addEvent(specialUltraMegaSuperSay, 5000, {msg="Oh yah, it's like this...",cid=cid})
    end
    
    return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

that?
 
Back
Top