• 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 TFS not loading xml and lua npc scripts

taytay

New Member
Joined
Jul 21, 2021
Messages
18
Reaction score
0
I'm using Nekiros downgraded 7.72 and when I go to launch all the .xml and .lua scripts for NPCS will not load. These are the errors. Maybe the pathing is incorrect?

Lua:
[Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/default.lua
cannot open data/npc/scripts/data/npc/scripts/default.lua: No such file or directory

[Warning - NpcScript::NpcScript] Can not load script: oracle.lua
cannot open data/npc/scripts/data/npc/scripts/chester.lua: No such file or directory
[Error - Npc::loadFromXml] Failed to load data/npc/Gregor.xml: File was not found

These are the scripts.
default.lua
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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
function onPlayerEndTrade(cid)                npcHandler:onPlayerEndTrade(cid)            end
function onPlayerCloseChannel(cid)            npcHandler:onPlayerCloseChannel(cid)        end

npcHandler:addModule(FocusModule:new())

xml of npc
Code:
<?xml version="1.0"?>
<npc name="A Prisoner" script="data/npc/scripts/A Prisoner.lua" access="3" lookdir="1" walkinterval="2500">
    <health now="1" max="1"/>
    <look type="130" head="62" body="2" legs="22" feet="76" addons="0"/>
    <parameters>
    <parameter key="message_greet" value="Huh? What? I can see! Wow! A non-mino. Did they capture you as well?" />
    <parameter key="message_farewell" value="Next time we should talk about my surreal numbers." />
  </parameters>
</npc>

and lua of npc
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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

function creatureSayCallback(cid, type, msg)
    if(npcHandler.focus ~= cid) then
        return false
    end
       
        local key = "PD-D-KS-P-PD"
        local queststate1 = getPlayerStorageValue(cid,6667)

        if msgcontains(msg, 'math') and queststate1 == 1 then
        npcHandler:say('My surreal numbers are based on astonishing facts. Are you interested in learning the secret of mathemagics?')
        talk_state = 1
        elseif msgcontains(msg, 'yes') and talk_state == 1 then
            npcHandler:say('But first tell me your favourite colour please!')
                talk_state = 2
        elseif msgcontains(msg, 'green') and talk_state == 2 then
            npcHandler:say('Very interesting. So are you ready to proceed in you lesson in mathemagics?')
                doPlayerRemoveMoney(cid,1000)
                    talk_state = 3
        elseif msgcontains(msg, 'yes') and talk_state == 3 then
            npcHandler:say('So know that everthing is based on the simple fact that 1 + 1 = 2!')
                setPlayerStorageValue(cid,6668,1)
                talk_state = 4
        elseif msgcontains(msg, 'bye') and (talk_state >= 1 and talk_state <= 4) then
            npcHandler:say('Next time we should talk about my surreal numbers.')

            talk_state = 0
        elseif msgcontains(msg, 'key') then
        npcHandler:say('Do you want a key to the mad mage room?')
        talk_state = 5
        elseif msgcontains(msg, 'yes') and talk_state == 5 then
        npcHandler:say('Here you are a special key.')
        key = doPlayerAddItem(cid, 2088, 1)
        doSetItemActionId(key,3666)
        talk_state = 0
        end
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

any help is appreciated. thank you
 
Last edited:
Code:
<?xml version="1.0"?>
<npc name="A Prisoner" script="data/npc/scripts/A Prisoner.lua" access="3" lookdir="1" walkinterval="2500">
    <health now="1" max="1"/>
    <look type="130" head="62" body="2" legs="22" feet="76" addons="0"/>
    <parameters>
    <parameter key="message_greet" value="Huh? What? I can see! Wow! A non-mino. Did they capture you as well?" />
    <parameter key="message_farewell" value="Next time we should talk about my surreal numbers." />
  </parameters>
</npc>
You have script="data/npc/scripts/A Prisoner.lua"
Should be script="A Prisoner.lua"
 
You have script="data/npc/scripts/A Prisoner.lua"
Should be script="A Prisoner.lua"
thanks for the reply. i changed that over and it didnt load. does this also mean things like npcsystem.lua is incorrect?
Lua:
if(NpcSystem == nil) then
    
    -- Loads the underlying classes of the npcsystem.
    dofile('data/npc/scripts/lib/npcsystem/keywordhandler.lua')
    dofile('data/npc/scripts/lib/npcsystem/queue.lua')
    dofile('data/npc/scripts/lib/npcsystem/npchandler.lua')
    dofile('data/npc/scripts/lib/npcsystem/modules.lua')
 
thanks for the reply. i changed that over and it didnt load. does this also mean things like npcsystem.lua is incorrect?
Lua:
if(NpcSystem == nil) then
   
    -- Loads the underlying classes of the npcsystem.
    dofile('data/npc/scripts/lib/npcsystem/keywordhandler.lua')
    dofile('data/npc/scripts/lib/npcsystem/queue.lua')
    dofile('data/npc/scripts/lib/npcsystem/npchandler.lua')
    dofile('data/npc/scripts/lib/npcsystem/modules.lua')
Do you get an error? Also you need to watch out for extra spaces and caps as it might be case sensitive.

npcsystem.lua needs the longer file path, the npc.xml doesn't. For reference you can look at forgottenserver/Alice.xml at master · nekiro/forgottenserver (https://github.com/nekiro/forgottenserver/blob/master/data/npc/Alice.xml)
 
Do you get an error? Also you need to watch out for extra spaces and caps as it might be case sensitive.

npcsystem.lua needs the longer file path, the npc.xml doesn't. For reference you can look at forgottenserver/Alice.xml at master · nekiro/forgottenserver (https://github.com/nekiro/forgottenserver/blob/master/data/npc/Alice.xml)
i changed the path for all npcs to script="A Prisoner.lua" but the errors are the same (failed to load, file not found, doesnt exist)

ive tried looking for npc data files and tried them out but they still dont load.
even things like paralyze script and whatnot wont load
 
Back
Top