Hello guys
I want some help with my NPCs, I want them to do two things:
First I want them not to say things right away, but to wait idk two seconds or so
Second I wanted them to advertise things on default chat.
As for the first problem, I'm using this function:
before every selfSay, but the first message (after hi) and all the other "built in" responses aren't affected, also the server freezes during the delay.
i've found this function on my libs:
wait = coroutine.yield
but I don't know how yo use it
for the second problem, I have no idea about how to aproach it.
thanks for your time
I want some help with my NPCs, I want them to do two things:
First I want them not to say things right away, but to wait idk two seconds or so
Second I wanted them to advertise things on default chat.
As for the first problem, I'm using this function:
Code:
function delay_s(delay)
local vb = "test.vbs"
local f = assert(io.open(vb,"w"))
f:write("WScript.Sleep(" .. (tonumber(delay) * 1000) .. ")\n")
f:close()
os.execute(vb)
end
i've found this function on my libs:
wait = coroutine.yield
Code:
function runThread(co)
if(coroutine.status(co) ~= 'dead') then
local _, delay = coroutine.resume(co)
addEvent(continueThread, delay, co)
end
end
function createThread(data)
local dataType, func = type(data), nil
if(dataType == 'string') then
func = loadstring(data)
elseif(dataType == 'function') then
func = data
end
if(func ~= nil) then
local co = coroutine.create(func)
runThread(co)
else
print("[createThread]", "Invalid data specified.")
end
end
for the second problem, I have no idea about how to aproach it.
thanks for your time
Last edited: