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

Solved Error loading .xml file of NPCs

Sentinel3

New Member
Joined
Oct 16, 2014
Messages
180
Reaction score
0
Hello guys!

Using: TFS 1.0

When I start my own server it says that cannot load some .xml files of NPCs, the .xml scripts are OK, and the direction too.

Well I give you the .xml script, .lua script and the error I get.


Error obtained:
HTML:
[Error - Npc::loadFromXml] Failed to load data/npc/Nah'bob.xml: File was not found


.XML Script

HTML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Nah'Bob" script="default.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="80" head="0" body="0" legs="0" feet="0" addons="0"/>
    <parameters>
    <parameter key="message_greet" value="What do you want from me, |PLAYERNAME|?" />
        <parameter key="module_shop" value="1"/>
        <parameter key="shop_buyable" value="Beholder shield,2518,7000;Noble armor,2486,8000;Spike sword,2383,8000;War hammer,2391,10000"/>
        <parameter key="shop_sellable" value="Beholder shield,2518,1200;Crown shield,2519,8000;Dragon shield,2516,4000;Guardian shield,2515,2000;Phoenix shield,2539,16000;Blue robe,2656,10000;Crown armor,2487,12000;Noble armor,2486,900;Boots of haste,2195,30000;Broad sword,2413,500;Dragon lance,2414,9000;Fire axe,2432,8000;Fire sword,2392,4000;Ice rapier,2396,1000;Obsidian lance,2425,500;Spike sword,2383,1000;War hammer,2391,1200;Crown helmet,2491,2500;Crusader helmet,2497,6000;Royal helmet,2498,30000;Crown legs,2488,12000;Crown legs,7410,10000"/>
    </parameters>
</npc>


.LUA Script

HTML:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)                          npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)                       npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)                  npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                                      npcHandler:onThink() end

local function getTable()
    local list =
    {
        {id = 7436,        sell = 5000,        buy = 0,        name = 'Angelic Axe'},
        {id = 2656,        sell = 10000,        buy = 0,        name = 'Blue Robe'},
        {id = 2518,        sell = 1200,        buy = 7000,        name = 'Bonelord Shield'},
        {id = 2195,        sell = 30000,        buy = 0,        name = 'Boots of Haste'},
        {id = 2413,        sell = 500,            buy = 0,        name = 'Broadsword'},
        {id = 7412,        sell = 18000,        buy = 0,        name = 'Butcher\'s Axe'},
        {id = 2487,        sell = 12000,        buy = 0,        name = 'Crown Armor'},
        {id = 2491,        sell = 2500,        buy = 0,        name = 'Crown Helmet'},
        {id = 2488,        sell = 12000,        buy = 0,        name = 'Crown Legs'},
        {id = 2519,        sell = 8000,        buy = 0,        name = 'Crown Shield'},
        {id = 2497,        sell = 6000,        buy = 0,        name = 'Crusader Helmet'},
        {id = 2414,        sell = 9000,        buy = 0,        name = 'Dragon Lance'},
        {id = 2516,        sell = 4000,        buy = 0,        name = 'Dragon Shield'},
        {id = 7854,        sell = 1000,        buy = 0,        name = 'Earth Spike Sword'},
        {id = 7868,        sell = 1200,        buy = 0,        name = 'Earth War Hammer'},
        {id = 7869,        sell = 1000,        buy = 0,        name = 'Energy Spike Sword'},
        {id = 7883,        sell = 1200,        buy = 0,        name = 'Energy War Hammer'},
        {id = 7744,        sell = 1000,        buy = 0,        name = 'Fiery Spike Sword'},
        {id = 7758,        sell = 1200,        buy = 0,        name = 'Fiery War Hammer'},
        {id = 2432,        sell = 8000,        buy = 0,        name = 'Fire Axe'},
        {id = 2392,        sell = 4000,        buy = 0,        name = 'Fire Sword'},
        {id = 7454,        sell = 3000,        buy = 0,        name = 'Glorious Axe'},
        {id = 2515,        sell = 2000,        buy = 0,        name = 'Guardian Shield'},
        {id = 2396,        sell = 1000,        buy = 0,        name = 'Ice Rapier'},
        {id = 7763,        sell = 1000,        buy = 0,        name = 'Icy Spike Sword'},
        {id = 7777,        sell = 1200,        buy = 0,        name = 'Icy War Hammer'},
        {id = 2486,        sell = 900,            buy = 8000,        name = 'Noble Armor'},
        {id = 2425,        sell = 500,            buy = 3000,        name = 'Obsidian Lance'},
        {id = 2539,        sell = 16000,        buy = 0,        name = 'Phoenix Shield'},
        {id = 7410,        sell = 20000,        buy = 0,        name = 'Queen\'s Sceptre'},
        {id = 2498,        sell = 30000,        buy = 0,        name = 'Royal Helmet'},
        {id = 7451,        sell = 10000,        buy = 0,        name = 'Shadow Sceptre'},
        {id = 2383,        sell = 1000,        buy = 8000,        name = 'Spike Sword'},
        {id = 7391,        sell = 16000,        buy = 0,        name = 'Thaian Sword'},
        {id = 2391,        sell = 1200,        buy = 10000,    name = 'War Hammer'}
    }
return list
end

function creatureSayCallback(cid, type, msg)

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid   
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    return true
end

local function onTradeRequest(cid)
    TradeRequest(cid, npcHandler, getTable(), BlueDjinn, 4)
end
npcHandler:setCallback(CALLBACK_ONTRADEREQUEST, onTradeRequest)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Please read what the error message says:
"Failed to load data/npc/Nah'bob.xml: File was not found"

File not found - Make sure that the file exists in data/npc/ and if not, download it or create it.
 
Please read what the error message says:
"Failed to load data/npc/Nah'bob.xml: File was not found"

File not found - Make sure that the file exists in data/npc/ and if not, download it or create it.

I'm really sure that I'm not stupid, if you can read the post again please...

->"The .xml scripts are OK, and the direction too"<-

Prova_zpsd33b74d0.png
 
Sometimes you have problems with ' in the filename (quote sign). Windows 8 can't even put it in the name. You use linux or windows? Might give problems with both OS tough..
 
Sometimes you have problems with ' in the filename (quote sign). Windows 8 can't even put it in the name. You use linux or windows? Might give problems with both OS tough..

Thank you so much, when I remove the f*cking quote it works perfectly!

<Solved>
 
Back
Top