demon088
#088 in the Horde
Hello I'm using TFS 1.2 and I need help to solve this issue:
This is my script:
I'm trying this scripts that were working in older tibia version, I need to fix them to add those NPC to my new version, but I couldn't figure out how to solve it...
Thanks!
This is my script:
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
local player = Player(cid)
if msgcontains(msg, "nightmare outfit") then
if player:getStorageValue(Storage.OutfitQuest.NightmareOutfit) >= 2 then
npcHandler:say("You already have the nightmare outfit. But I can bring you {first addon nightmare} and {second addon nightmare}.", cid)
npcHandler.topic[cid] = 0
elseif player:getStorageValue(Storage.OutfitQuest.NightmareOutfit) <= 1 then
npcHandler:say("If you want this outfit, I need {150 demonic essences}. Can you bring me such items?", cid)
npcHandler.topic[cid] = 1
end
elseif msgcontains(msg, "brotherhood outfit") then
if player:getStorageValue(Storage.OutfitQuest.BrotherhoodOutfit) >= 2 then
npcHandler:say("You already have the brotherhood outfit. But I can bring you {first addon brotherhood} and {second addon brotherhood}.", cid)
npcHandler.topic[cid] = 0
elseif player:getStorageValue(Storage.OutfitQuest.BrotherhoodOutfit) <= 1 then
npcHandler:say("If you want this outfit, I need {150 demonic essences}. Can you bring me such items?", cid)
npcHandler.topic[cid] = 4
end
elseif msgcontains(msg, "first addon nightmare") then
if player:getStorageValue(Storage.OutfitQuest.NightmareOutfit) >= 3 then
npcHandler:say("You already have that addon.", cid)
npcHandler.topic[cid] = 0
elseif player:getStorageValue(Storage.OutfitQuest.NightmareOutfit) == 2 then
npcHandler:say("I need {300 demonic essences} to give you this outfit. Do you have'em?", cid)
npcHandler.topic[cid] = 2
elseif player:getStorageValue(Storage.OutfitQuest.NightmareOutfit) <= 1 then
npcHandler:say("You need the {nightmare outfit} to ask for the addons. Give me a little help with the first task!", cid)
npcHandler.topic[cid] = 0
end
elseif msgcontains(msg, "second addon nightmare") then
if player:getStorageValue(Storage.OutfitQuest.NightmareOutfit) >= 4 then
npcHandler:say("You already have that addon.", cid)
npcHandler.topic[cid] = 0
elseif player:getStorageValue(Storage.OutfitQuest.NightmareOutfit) == 3 then
npcHandler:say("I need {500 demonic essences} to give you this outfit. Do you have'em?", cid)
npcHandler.topic[cid] = 3
elseif player:getStorageValue(Storage.OutfitQuest.NightmareOutfit) <= 2 then
npcHandler:say("You need the {first addon} to ask for the second. Give me a little help with the second task!", cid)
npcHandler.topic[cid] = 0
end
elseif msgcontains(msg, "first addon brotherhood") then
if player:getStorageValue(Storage.OutfitQuest.BrotherhoodOutfit) >= 3 then
npcHandler:say("You already have that addon.", cid)
npcHandler.topic[cid] = 0
elseif player:getStorageValue(Storage.OutfitQuest.BrotherhoodOutfit) == 2 then
npcHandler:say("I need {300 demonic essences} to give you this outfit. Do you have'em?", cid)
npcHandler.topic[cid] = 5
elseif player:getStorageValue(Storage.OutfitQuest.BrotherhoodOutfit) <= 1 then
npcHandler:say("You need the {nightmare outfit} to ask for the addons. Give me a little help with the first task!", cid)
npcHandler.topic[cid] = 0
end
elseif msgcontains(msg, "second addon brotherhood") then
if player:getStorageValue(Storage.OutfitQuest.BrotherhoodOutfit) >= 4 then
npcHandler:say("You already have that addon.", cid)
npcHandler.topic[cid] = 0
elseif player:getStorageValue(Storage.OutfitQuest.BrotherhoodOutfit) == 3 then
npcHandler:say("I need {500 demonic essences} to give you this outfit. Do you have'em?", cid)
npcHandler.topic[cid] = 6
elseif player:getStorageValue(Storage.OutfitQuest.BrotherhoodOutfit) <= 2 then
npcHandler:say("You need the {first addon} to ask for the second. Give me a little help with the second task!", cid)
npcHandler.topic[cid] = 0
end
elseif msgcontains(msg, "addons") then
npcHandler:say("I can bring you {first addon} and {second addon} of the {nightmare outfit} or even the {brotherhood outfit}.", cid)
npcHandler.topic[cid] = 0
elseif msgcontains(msg, "yes") then
if npcHandler.topic[cid] == 1 then
if player:getItemCount(6500) >= 150 then
npcHandler:say("Thanks! Now here you are! Ask me for {first addon nightmare}.", cid)
player:removeItem(6500, 150)
player:setStorageValue(Storage.OutfitQuest.NightmareOutfit, 2)
player:addOutfit(269)
player:addOutfit(268)
npcHandler.topic[cid] = 0
else
npcHandler:say("You have not the item I asked for...", cid)
end
elseif npcHandler.topic[cid] == 2 then
if player:getItemCount(6500) >= 300 then
npcHandler:say("Thanks! Now here you are! Ask me for {second addon nightmare}.", cid)
player:removeItem(6500, 300)
player:setStorageValue(Storage.OutfitQuest.NightmareOutfit, 3)
player:addOutfitAddon(269, 1)
player:addOutfitAddon(268, 1)
npcHandler.topic[cid] = 0
else
npcHandler:say("You have not every item I asked to you!", cid)
end
elseif npcHandler.topic[cid] == 3 then
if player:getItemCount(6500) >= 500 then
npcHandler:say("Thanks! Now here you are! Your help is enough for now!", cid)
player:removeItem(6500, 500)
player:setStorageValue(Storage.OutfitQuest.NightmareOutfit, 4)
player:addOutfitAddon(269, 2)
player:addOutfitAddon(268, 2)
npcHandler.topic[cid] = 0
else
npcHandler:say("You have not every item I asked to you!", cid)
end
elseif npcHandler.topic[cid] == 4 then
if player:getItemCount(6500) >= 150 then
npcHandler:say("Thanks! Now here you are! Ask me for {first addon brotherhood}.", cid)
player:removeItem(6500, 150)
player:setStorageValue(Storage.OutfitQuest.BrotherhoodOutfit, 2)
player:addOutfit(279)
player:addOutfit(278)
npcHandler.topic[cid] = 0
else
npcHandler:say("You have not the item I asked for...", cid)
end
elseif npcHandler.topic[cid] == 5 then
if player:getItemCount(6500) >= 300 then
npcHandler:say("Thanks! Now here you are! Ask me for {second addon brotherhood}.", cid)
player:removeItem(6500, 300)
player:setStorageValue(Storage.OutfitQuest.BrotherhoodOutfit, 3)
player:addOutfitAddon(279, 1)
player:addOutfitAddon(278, 1)
npcHandler.topic[cid] = 0
else
npcHandler:say("You have not every item I asked to you!", cid)
end
elseif npcHandler.topic[cid] == 6 then
if player:getItemCount(6500) >= 500 then
npcHandler:say("Thanks! Now here you are! Your help is enough for now!", cid)
player:removeItem(6500, 500)
player:setStorageValue(Storage.OutfitQuest.BrotherhoodOutfit, 4)
player:addOutfitAddon(279, 2)
player:addOutfitAddon(278, 2)
npcHandler.topic[cid] = 0
else
npcHandler:say("You have not every item I asked to you!", cid)
end
end
return true
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Thanks!