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

Lua NPC Issues

darkshin

New old member
Joined
Dec 14, 2010
Messages
231
Reaction score
22
Hello Guys!! I am facing some issues regarding to NPCs. I hope you guys can help me figure out a solution for them.

ISSUES:

1. Whenever I add a callback to greeting, the npcs don't focus at the player.
Code:
local function greetCallback(cid)
    local player = Player(cid)
   
    if player:getStorageValue(7001) == -1 then
    npcHandler:say({"You are so smart that can't fix me, baaaah! Newbieeeeeeee"}, cid)
    return false
    end
   
    return true
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback) //Registering
Even if I add:
Code:
npcHandler:addFocus(player)
The Npc will stare for a moment at the player but then console will return me an error at "getDistanceTo" and
the npc will start walk randomly again.

2. If I create xml Npc Files with different names like: "Jonas.xml" but the name inside the xml is the same as other file, it will load this file instead of Jonas.xml.

My question for this is why??
At sources it should be loaded by the filename:
Code:
pugi::xml_document doc;
    pugi::xml_parse_result result = doc.load_file(filename.c_str());
    if (!result) {
        printXMLError("Error - Npc::loadFromXml", filename, result);
        return false;
    }

Hope you guys can help me out figuring this!
Any help is appreciated!
 

Similar threads

Back
Top