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

TFS 1.X+ MESSAGE_WALKAWAY In NPCs channel

Lopaskurwa

Active Member
Joined
Oct 6, 2017
Messages
873
Solutions
2
Reaction score
49
Hi
How to send
[MESSAGE_IDLETIMEOUT] = "Good bye.",
[MESSAGE_WALKAWAY] = "Good bye.",
in NPCs channel instead of default chat?
 
Solution
Well then you have different code, because that gif was taken just before i posted it, after testing on my server.
Post the code you had for the function NpcHandler: onThink().

also post the code you have for then functions.
unGreet
and onWalkAway


Lua:
 function NpcHandler:onThink()
        local callback = self:getCallback(CALLBACK_ONTHINK)
        if callback == nil or callback() then
            if NPCHANDLER_TALKDELAY == TALKDELAY_NONE then
                for cid, talkDelay in pairs(self.talkDelay) do
                    if talkDelay.time ~= nil and talkDelay.message ~= nil and os.time() >= talkDelay.time then
                        selfSay(talkDelay.message, cid, talkDelay.publicize and true or false)...
Thats the exact same code I have and it works, did you restart the server after editing the code?
I think you can do it with a reload of /reload global, /reload config
But i restarted the whole server.

Lua:
    function NpcHandler:onThink()
        local callback = self:getCallback(CALLBACK_ONTHINK)
        if callback == nil or callback() then
            if NPCHANDLER_TALKDELAY == TALKDELAY_NONE then
                for cid, talkDelay in pairs(self.talkDelay) do
                    if talkDelay.time ~= nil and talkDelay.message ~= nil and os.time() >= talkDelay.time then
                        selfSay(talkDelay.message, cid, talkDelay.publicize and true or false)
                        self.talkDelay[cid] = nil
                    end
                end
            end
            if self:processModuleCallback(CALLBACK_ONTHINK) then
                for pos, focus in pairs(self.focuses) do
                    if focus ~= nil then
                        if not self:isInRange(focus) then
                           self:unGreet(focus)  -- self:onWalkAway(focus)
                        elseif self.talkStart[focus] ~= nil and (os.time() - self.talkStart[focus]) > self.idleTime then
                            self:unGreet(focus) -- here
                        else
                            self:updateFocus()
                        end
                    end
                end
            end
        end
    end
Probably miss understood something. Now works, thanks.
 
Back
Top