• 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+ [tfs 1.5 downgrded by nekiro]Npc reply to everyone even while they're busy with another playe

Felipe93

Ghost Member
Joined
Mar 21, 2015
Messages
1,990
Solutions
9
Reaction score
334
Location
Chile
How do I do if I want that NPC only interact with one player at a time? By now everyone can talk to npc even is the npc is already busy talking to another player.
@mano368 maybe do you know, or have seen this before?
Lua:
19:08 GM Ratx [37]: hi
19:08 Lily: Welcome, GM Ratx.
19:08 Testi [7]: hi
19:08 Lily: Welcome, Testi.
to
Code:
19:08 GM Ratx [37]: hi
19:08 Lily: Welcome, GM Ratx.
19:08 Testi [7]: hi
19:08 Lily: Welcome, Testi.
in this case i would expect that lily the NPC would have said to testi. That she is busy. What should i do in order to achieve this?

thanks in advance
maybe @mano368 @emil or @Gesior.pl
sorry to bother i tag you because i know you've watched my thread and 've tried to help me before

thanks in advance
 
I was looking here in some distros and i found this one (realera 8.0) with this npchandler and it's actually working with npc queue system of TFS 1.5
make sure that in npcsystem.lua you are loading queue.lua...
dofile('data/npc/lib/npcsystem/queue.lua')

i just tested the basics (talked to a npc with 2 chars and it worked fine)
Post automatically merged:

But.. imo, TFS 1.5 dowgrades (7.72 and 8.0) needs a review on this npc system :)
 

Attachments

i Have a queue file and the npcsystemlua is laoding it
Lua:
-- This file is part of Jiddo's advanced NpcSystem v3.0x. This npcsystem is free to use by anyone, for any purpuse.
-- Initial release date: 2007-02-21
-- Credits: Jiddo, honux(I'm using a modified version of his Find function).
-- Please include full credits whereever you use this system, or parts of it.
-- For support, questions and updates, please consult the following thread:
-- http://opentibia.net/topic/59592-release-advanced-npc-system-v30a/

if(Queue == nil) then
   
    Queue = {
        customers = nil,
        handler = nil,
    }
   
    -- Creates a new queue, connected to the given NpcHandler handler
    function Queue:new(handler)
        local obj = {}
        obj.handler = handler
        obj.customers = {}
        setmetatable(obj, self)
        self.__index = self
        return obj
    end
   
    -- Assigns a new handler to this queue.
    function Queue:setHandler(newHandler)
        self.handler = newHandler
    end
   
    -- Pushes a new cid onto the tail of this queue.
    function Queue:push(cid)
        if(isPlayer(cid)) then
            table.insert(self.customers, cid)
        end
    end
   
    -- Returns true if the given cid is already in the queue.
    function Queue:isInQueue(cid)
        return (isInArray(self.customers, cid) == true)
    end
   
    -- Removes and returns the first cid from the queue
    function Queue:pop()
        return table.remove(self.customers, 1)
    end
   
    -- Returns the first cid in the queue, but does not remove it!
    function Queue:peek()
        return self.customers[1]
    end
   
    -- Returns true if htis queue is empty.
    function Queue:empty()
        return(self:peek() == nil)
    end
   
    -- Returns the amount of players currently in the queue.
    function Queue:getSize()
        return table.maxn(self.customers)
    end
   
    -- Returns true if the creature with the given cid can be greeted by this npc.
    function Queue:canGreet(cid)
        if(isPlayer(cid)) then
            return self.handler:isInRange(cid)
        else
            return false
        end
    end
   
    -- Greets the player with the given cid.
    function Queue:greet(cid)
        if(self.handler ~= nil) then
            self.handler:greet(cid)
        else
            error('No handler assigned to queue!')
        end
    end
   
    -- Makes sure the next greetable player in the queue is greeted.
    function Queue:greetNext()
        while (not self:empty()) do
            local nextPlayer = self:pop()
            if(self:canGreet(nextPlayer)) then
                if(callback == nil or callback(nextPlayer)) then
                    self:greet(nextPlayer)
                    return true
                end
            end
        end
        return false
    end
   
end

i reviewed and realera 8.0 doesn't haver a queue file so where were you looking at? point it me out to review too
also i wouldn't like to use older libraries im rpetty sure the issue is in front of our eyes if im not wrong realera 8.0 had the same issue where player were able to talk to npc while he was already talking, but i can't find the post or thread where that issue was solved :( I would like to stick with the latest libraries

BUMP!
 
i Have a queue file and the npcsystemlua is laoding it
Lua:
-- This file is part of Jiddo's advanced NpcSystem v3.0x. This npcsystem is free to use by anyone, for any purpuse.
-- Initial release date: 2007-02-21
-- Credits: Jiddo, honux(I'm using a modified version of his Find function).
-- Please include full credits whereever you use this system, or parts of it.
-- For support, questions and updates, please consult the following thread:
-- http://opentibia.net/topic/59592-release-advanced-npc-system-v30a/

if(Queue == nil) then
  
    Queue = {
        customers = nil,
        handler = nil,
    }
  
    -- Creates a new queue, connected to the given NpcHandler handler
    function Queue:new(handler)
        local obj = {}
        obj.handler = handler
        obj.customers = {}
        setmetatable(obj, self)
        self.__index = self
        return obj
    end
  
    -- Assigns a new handler to this queue.
    function Queue:setHandler(newHandler)
        self.handler = newHandler
    end
  
    -- Pushes a new cid onto the tail of this queue.
    function Queue:push(cid)
        if(isPlayer(cid)) then
            table.insert(self.customers, cid)
        end
    end
  
    -- Returns true if the given cid is already in the queue.
    function Queue:isInQueue(cid)
        return (isInArray(self.customers, cid) == true)
    end
  
    -- Removes and returns the first cid from the queue
    function Queue:pop()
        return table.remove(self.customers, 1)
    end
  
    -- Returns the first cid in the queue, but does not remove it!
    function Queue:peek()
        return self.customers[1]
    end
  
    -- Returns true if htis queue is empty.
    function Queue:empty()
        return(self:peek() == nil)
    end
  
    -- Returns the amount of players currently in the queue.
    function Queue:getSize()
        return table.maxn(self.customers)
    end
  
    -- Returns true if the creature with the given cid can be greeted by this npc.
    function Queue:canGreet(cid)
        if(isPlayer(cid)) then
            return self.handler:isInRange(cid)
        else
            return false
        end
    end
  
    -- Greets the player with the given cid.
    function Queue:greet(cid)
        if(self.handler ~= nil) then
            self.handler:greet(cid)
        else
            error('No handler assigned to queue!')
        end
    end
  
    -- Makes sure the next greetable player in the queue is greeted.
    function Queue:greetNext()
        while (not self:empty()) do
            local nextPlayer = self:pop()
            if(self:canGreet(nextPlayer)) then
                if(callback == nil or callback(nextPlayer)) then
                    self:greet(nextPlayer)
                    return true
                end
            end
        end
        return false
    end
  
end

i reviewed and realera 8.0 doesn't haver a queue file so where were you looking at? point it me out to review too
also i wouldn't like to use older libraries im rpetty sure the issue is in front of our eyes if im not wrong realera 8.0 had the same issue where player were able to talk to npc while he was already talking, but i can't find the post or thread where that issue was solved :( I would like to stick with the latest libraries

BUMP!
i just said i tested it and worked. (idk what distro u are looking, but ofc it's not the same, i don't have the link of the post, i just have it in my pc)
the problem is not the queue file, it's on the npchandler that don´t call the queue functions... the file i've sent do use those functions.
compare the "onGreet" functions of both files and you will see..
 
I would even like to implement this, but it's very annoying when they use this system to randomize for example. I want to solve the other problem we have in common xD
 
Back
Top