• 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 message delay

Sniperfox

New Member
Joined
Jun 11, 2007
Messages
401
Reaction score
1
Location
The Netherlands
How would i make it so that a npc has a delay between 2 sentences?
For example:

PHP:
selfSay(msg,'Ok then, i will explain you what to do.')
Delay here
selfSay(msg,'explanation')
 
From my "noobish one" NPC:

Code:
function say()
    selfSay('Thank you very much omgzors, take this as a reward.')
end

function shutTheFuckUp()
    stopEvent(say)
    stopEvent(shutTheFuckUp)
end

And it did work

So You'll just have to add in "delay here" addEvent(say, 3000, getNpcCid() where 3k is 3 s

Note: the shutTheFuckUp() is not needed.
 
Last edited:
First of all thank you for your help.

I'm just a beginner at lua but i'm working on learning it, i tried adding the addevent between my selfSay but it resulted in a error.

What i'm using now:
PHP:
    elseif msgcontains(msg,'yes') and talk_state == 1 then
        if getPlayerStorageValue(cid,4701) == -1 then
            setPlayerStorageValue(cid,4701,1)
                selfSay(msg,'Ok then, i will explain you what to do.')
                addEvent(say, 3000, getNpcCid())
                selfSay(msg,'There are 5 teleports in 3 different rooms, each has it\'s own level recuirment.')
                addEvent(say, 3000, getNpcCid())
                selfSay(msg,'The first room has a level recuirment of 300 and contains 3 tasks.')
        else
            selfsay('I am sorry but i already explained everything to you.')
        end
The error i got:
[02/04/2008 21:02:55] Lua Script Error: [Npc interface]
[02/04/2008 21:02:55] data/npc/scripts/certificate.lua:eek:nCreatureSay

[02/04/2008 21:02:55] luaAddEvent(). callback parameter should be a function.
 
First of all thank you for your help.

I'm just a beginner at lua but i'm working on learning it, i tried adding the addevent between my selfSay but it resulted in a error.

What i'm using now:
PHP:
    elseif msgcontains(msg,'yes') and talk_state == 1 then
        if getPlayerStorageValue(cid,4701) == -1 then
            setPlayerStorageValue(cid,4701,1)
                selfSay(msg,'Ok then, i will explain you what to do.')
                addEvent(say, 3000, getNpcCid())
                selfSay(msg,'There are 5 teleports in 3 different rooms, each has it\'s own level recuirment.')
                addEvent(say, 3000, getNpcCid())
                selfSay(msg,'The first room has a level recuirment of 300 and contains 3 tasks.')
        else
            selfsay('I am sorry but i already explained everything to you.')
        end
The error i got:

You are missing:
Code:
function say()
selfSay('bla bla')
end
add it below the script
 
Code:
function selfsay2(s)
doCreatureSay(a.npc,"Bye noob",TALKTYPE_SAY)
end



selfSay('Hello noob')
a = {npc = getNpcCid()}
addEvent(selfsay2, 5000, a)
 
Back
Top