• 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+ Npc error.

kuks

New Member
Joined
Apr 30, 2017
Messages
24
Reaction score
3
Hi all,

I would like create my own NPC "Captain Jack" and i think everythink is fine but my serwer didn't read this npc.

This is error from my consol but i don't know why he read double line data/npc/scripts/data/npc/scripts/
Code:
[Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/Captain Jack.lua
cannot open data/npc/scripts/data/npc/scripts/Captain Jack.lua: No such file or directory

data/NPC/scripts/Captain Jack
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

local travelNode = keywordHandler:addKeyword({'Roshamuul'}, StdModule.say, {npcHandler = npcHandler, text = 'Do you want go to Roshamuul?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = Position(1555, 819, 7) })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, reset = true, text = 'We would like to serve you some time.'})

npcHandler:addModule(FocusModule:new())

data/NPC/Captain Jack
Code:
<npc name="Captain Jack" script="data/npc/scripts/Captain Jack.lua" autowalk="1" floorchange="0" access="5" level="1" maglevel="1">
    <health now="150" max="150"/>
    <look type="133" head="20" body="120" legs="75" feet="13" corpse="2212"/>
    <parameters>
 
    </parameters>
</npc>
 
Hi all,

I would like create my own NPC "Captain Jack" and i think everythink is fine but my serwer didn't read this npc.

This is error from my consol but i don't know why he read double line data/npc/scripts/data/npc/scripts/
Code:
[Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/Captain Jack.lua
cannot open data/npc/scripts/data/npc/scripts/Captain Jack.lua: No such file or directory

data/NPC/scripts/Captain Jack
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

local travelNode = keywordHandler:addKeyword({'Roshamuul'}, StdModule.say, {npcHandler = npcHandler, text = 'Do you want go to Roshamuul?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = Position(1555, 819, 7) })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, reset = true, text = 'We would like to serve you some time.'})

npcHandler:addModule(FocusModule:new())

data/NPC/Captain Jack
Code:
<npc name="Captain Jack" script="data/npc/scripts/Captain Jack.lua" autowalk="1" floorchange="0" access="5" level="1" maglevel="1">
    <health now="150" max="150"/>
    <look type="133" head="20" body="120" legs="75" feet="13" corpse="2212"/>
    <parameters>

    </parameters>
</npc>
Well, the error is pretty specific, it can't find that file.

Two things to check at this point would be..
1) Capitalization. Make sure that you've named the lua file with the same case distinction as what you've written inside the npc's xml document.
2) Make sure the file you've created is in fact a .lua file. Often when creating a new file, windows will default it to a .txt or a .file document, unless you explicitly name it .lua

If those two things don't solve the issue.. double and triple check that the .lua document is in the correct folder.
Once or twice in the past I've seen someone place it into the lib folder by accident instead of the script folder.
No harm done, just move the file to the correct folder and your on your way.

Hope that helps! 😁
 
I checked several times...I just copy and paste name of file but it's nothing change.
My folder "lib" have only one file....

He can't fine because he try find this file in
data/npc/scripts/data/npc/scripts

he should be try read this file from
data/npc/scripts

Mayby here is a problem?
 
Ok i know where is a problem
Code:
<npc name="Captain Jack" script="data/npc/scripts/Captain Jack.lua"
correct version
Code:
<npc name="Captain Jack" script="Captain Jack.lua"

But now when i said hi NPC just said only
Code:
Captain Jack: Greetings,
and he don't answear nothing when i said "Roshamuul"
I do somethink wront in scripts?
 
Back
Top