• 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 Namteh.lua Please help me. He's not working!

rookki90

Maniacus totalus
Joined
Apr 15, 2009
Messages
68
Reaction score
1
Hello. Today I wrote this npc, and I can't summon him in game.
log from putty:
[19:26:15.267] Info: failed to load external entity "data/npc/namteh.xml"

script xml:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Namteh" script="data/npc/scripts/Namteh.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="138" head="19" body="69" legs="107" feet="50" addons="0"/>
<voices>
<voice text="Help, help! We need your help!" interval2="100" margin="1" yell="no"/>
</voices>
<parameters>
<parameter key="message_farewell" value="Good bye. Please come back as fast as you can!" />
<parameter key="message_walkaway" value="Good bye. Please come back as fast as you can!" />
<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="name;thais;darashia;" />
<parameter key="keyword_reply1" value="My name is Namteh. I'm mayor of Baldura. Our village is under attack. Dragond, dragons!" />
<parameter key="message_greet" value="Hello, |PLAYERNAME|. How can I help you?"/>
</parameters>
</npc>

and lua code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)



-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end
-- OTServ event handling functions end


-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!

local travelNode = keywordHandler:addKeyword({'fight'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Our {village} is under attack! If you want to join to us just say {fight}. We need your help... '})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=1365, y=1202, z=7} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Are you not ready yet? Come back if you will be sure!'})


keywordHandler:addKeyword({'village'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cos tam cos tam'})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Zjedz zupy'})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Jebac to!'})


npcHandler:addModule(FocusModule:new())

Help me, what's wrong is?!
Kind regards,
rookki90
 
it means files are named wrong because your using linux i think ;p

Make sure script is named

Namteh.lua and not namteh.lua

Lua:
<npc name="Namteh" script="data/npc/scripts/Namteh.lua" walkinterval="2000" floorchange="0">

Linux is case sensitive so if you put small letter for script inside .xml then script lua also has to be small. same with Capital lettering.
 
Back
Top Bottom