brendan2
Sensation black
- Joined
- Feb 19, 2009
- Messages
- 507
- Reaction score
- 1
a found a npc to give you a mining skill but all he says is hi when I say hi. how do i script npc.xml to make him activate and give you mining skill?
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Mining dwarf" script="data/npc/scripts/mining.lua" autowalk="1" floorchange="0">
<health now="100" max="100"/>
<look type="69"/>
<parameters>
</parameters>
</npc>
Pretty sure this is the problem i dont no what to put to make it activate mining.lua
Heres lua.
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler
nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler
nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler
nCreatureSay(cid, type, msg) end
function onThink() npcHandler
nThink() end
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
if msgcontains(msg,'spells') or msgcontains(msg,'help') then
selfSay('Hello i can teach you mining for free. If you would like to learn mining please say mining')
elseif msgcontains(msg,'mining') then
setPlayerStorageValue(cid,40001,1)
setPlayerStorageValue(cid,40002,1)
setPlayerStorageValue(cid,40003,1)
setPlayerStorageValue(cid,40004,1)
npcHandler:say('Here you go!')
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Mining dwarf" script="data/npc/scripts/mining.lua" autowalk="1" floorchange="0">
<health now="100" max="100"/>
<look type="69"/>
<parameters>
</parameters>
</npc>
Pretty sure this is the problem i dont no what to put to make it activate mining.lua
Heres lua.
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler
function onCreatureDisappear(cid) npcHandler
function onCreatureSay(cid, type, msg) npcHandler
function onThink() npcHandler
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
if msgcontains(msg,'spells') or msgcontains(msg,'help') then
selfSay('Hello i can teach you mining for free. If you would like to learn mining please say mining')
elseif msgcontains(msg,'mining') then
setPlayerStorageValue(cid,40001,1)
setPlayerStorageValue(cid,40002,1)
setPlayerStorageValue(cid,40003,1)
setPlayerStorageValue(cid,40004,1)
npcHandler:say('Here you go!')
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())