njitram
New Member
- Joined
- May 15, 2008
- Messages
- 14
- Reaction score
- 0
Hellow
I have a small problem with the creation of LUA files for NPC's:
mining.lua
Twan.xml
This dont work, why im not sure.. can some one help me out?
I have a small problem with the creation of LUA files for NPC's:
mining.lua
PHP:
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
if msgcontains(msg,'spells') or msgcontains(msg,'help') then
npcHandler:say('Hello i can teach you mining for free')
end
return 1
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
if msgcontains(msg,'mining') or msgcontains(msg,'help') then
setPlayerStorageValue(cid,40001,1)
setPlayerStorageValue(cid,40002,1)
setPlayerStorageValue(cid,40003,1)
setPlayerStorageValue(cid,40004,1)
npcHandler:say('Here you go!')
end
npcHandler:addModule(FocusModule:new())
Twan.xml
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Twan" script="data/npc/scripts/mining.lua" autowalk="1" floorchange="0">
<health now="100" max="100"/>
<look type="138" head="57" body="59" legs="40" feet="76" addons="0"/>
<parameters>
</parameters>
</npc>
This dont work, why im not sure.. can some one help me out?
Last edited: