Bug
New Member
- Joined
- Jan 7, 2011
- Messages
- 111
- Reaction score
- 1
Gettin problems with npc:
My npc scripts:
Code:
[16:19:28.650] [Error - NpcScript Interface]
[16:19:28.650] data/npc/scripts/aluguelmounts2.lua:onCreatureSay
[16:19:28.650] Description:
[16:19:28.650] data/npc/scripts/aluguelmounts2.lua:23: attempt to index global 'rent_mounts' (a nil value)
[16:19:28.650] stack traceback:
[16:19:28.650] data/npc/scripts/aluguelmounts2.lua:23: in function 'callback'
[16:19:28.650] data/npc/lib/npcsystem/npchandler.lua:456: in function 'onCreatureSay'
[16:19:28.650] data/npc/scripts/aluguelmounts2.lua:9: in function <data/npc/scripts/aluguelmounts2.lua:9>
My npc scripts:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local storage = 18600;
local startTime = os.time()
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(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, 'rent') then
selfSay('Do you want to rent a horse for one day at a price of 500 gold?', cid)
end
if msgcontains(msg, 'yes') then
if not getPlayerMount(cid, 25) then
if doPlayerRemoveMoney(cid, 500) then
doPlayerAddMount(cid,25)
setPlayerStorageValue(cid, storage, startTime)
selfSay('I\'ll give you one of our experienced ones. Take care! Look out for low hanging branches.', cid)
else
selfSay('Sorry, you are too poor. I\d rent one to you for free but I\m afraid you might be desperate enough to eat the horse, sorry.', cid)
end
else
selfSay('You already have this mount.', cid)
end
end
end
if msgcontains(msg, 'transport') then
selfSay('We can bring you to Thais with one of our coaches for 125 gold. Are you interested?', cid)
end
if msgcontains(msg, 'yes') then
if doPlayerRemoveMoney(cid, 125) then
doTeleportThing(cid, newpos)
else
selfSay('You don\'t have enough money.', cid)
end
end
if msgcontains(msg, 'no') then
selfSay('You have no idea what you are missing.', cid)
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())