SUMEKAZEKI
ADM Custom Rook
- Joined
- Sep 10, 2016
- Messages
- 39
- Reaction score
- 4
hello, i try to make npc and receive this error:
code:
code:
LUA:
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 function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
if msgcontains({'donkey'}, msg) then
npcHandler:say('Do you want to taming a donkey for backpack of apple slices?', cid)
npcHandler.topic[cid] = 1
return true
end
npcHandler.topic[cid] == 1 then
if player:setStorageValue(Storage.DonkeyMount, 1) then
npcHandler:say('You already have a Donkey.', cid)
return true
end
if not player:removeItem(13537, 1)) then
npcHandler:say('You do not have a bag of apple slices to tamed donkey!', cid)
return true
end
local mountId = {13}
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:addMount(mountId[math.random(#mountId)])
player:setStorageValue(Storage.DonkeyMount, 1)
npcHandler:say('I\'ll give you one of our experienced ones. Take care! Look out for low hanging branches.', cid)
end
npcHandler.topic[cid] = 0
elseif msgcontains(msg, 'no') and npcHandler.topic[cid] > 0 then
npcHandler:say('Then not.', cid)
npcHandler.topic[cid] = 0
end
return true
end
npcHandler:setMessage(MESSAGE_GREET, 'Salutations, |PLAYERNAME| I guess you are here for the {donkey}.')
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())