Hello.
I was trying to make a npc which would sell item with action id on TFS 0.3 but when I use this
I Recive item but without actionid..
and bug in console
and whole script
P
I was trying to make a npc which would sell item with action id on TFS 0.3 but when I use this
Code:
doSetItemActionId(doPlayerAddItem(cid, 2090, 1,1), 3940)
I Recive item but without actionid..
and bug in console
Code:
[05/11/2008 18:37:02] Lua Script Error: [Npc interface]
[05/11/2008 18:37:02] data/npc/scripts/key.lua:onCreatureSay
[05/11/2008 18:37:02] luaDoSetItemActionId(). Item not found
and whole script
Code:
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(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, 'Czesc') then
selfSay('Chcesz kupic przedmiot z action id?')
talkState = 1
elseif msgcontains(msg, 'yes') and talkState == 1 then
if pay(cid, 1) then
doSetItemActionId(doPlayerAddItem(cid, 2090, 1,1), 3940)
selfSay('Prosze, o to twoj zakupiony przedmiot.')
else
selfSay('Nie masz tyle pieniedzy.')
end
talkState = 0
elseif msgcontains(msg, 'no') and (talkState == 1) then
selfSay('Ok, than.')
talkState = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())