dogox222
%00
- Joined
- Jan 10, 2011
- Messages
- 71
- Reaction score
- 0
Hi, I've scripted an avar tar NPC, but it doesn't give the addons correctly. I need some help.
The script:
All is working correctly but the NPC doesn't give the addons. There are no errors shown.
Thanks.
The script:
Code:
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
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'outfit') or msgcontains(msg, 'Outfit')) then
selfSay('I\'m tired of all these young unskilled wannabe heroes. Every Tibian can show his skills or actions by wearing a special outfit. To prove oneself worthy of the demon outfit, this is how it goes: The base outfit will be granted for completing the annihilator quest, which isn\'t much of a challenge nowadays, in my opinion. Anyway the shield however will only be granted to those adventurers who have finished the demon helmet quest. Well, the helmet is for those who really are tenacious and have hunted down all 6666 demons and finished the demon oak as well. Are you interested?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes')) then
if(talkState[talkUser] == 1) then
selfSay('So you want to have the demon outfit, hah! Let\'s have a look first if you really deserve it. Tell me: {base}, {shield} or {helmet}? ', cid)
end
end
if(msgcontains(msg, 'base')) then
if getPlayerStorageValue(cid, 66632) == 1 then
doPlayerAddOutfit(cid,32,1)
selfSay('Receive the base outfit.', cid)
else
selfSay('You haven\'t completed the annihilator quest!.', cid)
end
end
if(msgcontains(msg, 'shield')) then
if getPlayerStorageValue(cid, 12900) == 1 then
doPlayerAddOutfit(cid,32,2)
doCreatureSay(cid, "1st Addon added!", TALKTYPE_ORANGE_1)
selfSay('Receive the shield.', cid)
else
selfSay('You haven\'t completed the Demon Oak quest!.', cid)
end
end
if(msgcontains(msg, 'helmet')) then
if getPlayerStorageValue(cid, 13446) == 1 then
doPlayerAddOutfit(cid,32,3)
doCreatureSay(cid, "2nd Addon added!", TALKTYPE_ORANGE_1)
selfSay('Receive the helmet.', cid)
else
selfSay('You haven\'t completed the Demon Helmet quest!.', cid)
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Thanks.
Last edited: