Meferot
New Member
- Joined
- Jan 28, 2008
- Messages
- 57
- Reaction score
- 1
This is my error:
and it's a script:
How to add action id in new tfs?
PHP:
[Error - Npc interface]
data/npc/scripts/tasior.lua:onCreatureSay
Description:
data/npc/scripts/tasior.lua:37: attempt to call global 'doSetItemActionId' (a ni
l value)
stack traceback:
data/npc/scripts/tasior.lua:37: in function 'callback'
data/npc/lib/npcsystem/npchandler.lua:390: in function 'onCreatureSay'
data/npc/scripts/tasior.lua:8: in function <data/npc/scripts/tasior.lua:
8>
and it's a script:
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
-----------------------------------------addon----------------------
if msgcontains(msg, "first nobleman addon") or msgcontains(msg, "first nobleman") then
if getPlayerLevel(cid) >= 200 then
npcHandler:say("Currently I\'m offering accessories for the nobleman - and, of course, noblewoman - outfit. Would you like pick up a hat for 150,000 gold coins?", cid)
talk_state = 1
else
selfSay("Sorry but I don\'t trade with humans who have level smaller than 200.", cid)
end
elseif msgcontains(msg, 'second nobleman addon') or msgcontains(msg, 'second nobleman') then
if getPlayerLevel(cid) >= 200 then
selfSay('Currently I\'m offering accessories for the nobleman - and, of course, noblewoman - outfit. Would you like pick up a coat for 150,000 gold coins?', cid)
talk_state = 2
else
selfSay('Sorry but I don\'t trade with humans who have level smaller than 200.', cid)
end
-------------------yes----------------------------
elseif msgcontains(msg, 'yes') and talk_state == 1 then
if(doPlayerRemoveMoney(cid, 150000) == TRUE) then
selfSay('Congratulations! Here is your brand-new accessory, I hope you like it. Please visit us again!', cid)
nobleman = doPlayerAddItem(cid,10503,1)
doSetItemActionId(nobleman, 1014)
doSetItemSpecialDescription(nobleman, "First Nobleman Addon.")
else
selfSay("Maybe next time..." , cid)
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
if(doPlayerRemoveMoney(cid, 150000) == TRUE) then
selfSay('Congratulations! Here is your brand-new accessory, I hope you like it. Please visit us again!', cid)
nobleman1 = doPlayerAddItem(cid,10503,1)
doSetItemActionId(nobleman1, 1015)
doSetItemSpecialDescription(nobleman1, "First Nobleman Addon.")
else
selfSay("Maybe next time..." , cid)
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
How to add action id in new tfs?
Last edited: