I am trying to create an npc that will make you move forward in a story using storages, but I cannot get it to start any mission, it is a tfs 1.3
Lua:
local function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local player = Player(cid)
if msgcontains(msg, "holy tible") then
if player:getStorageValue(Storage.Quest.Cipfriedtible.QuestLine) < 1 then
npcHandler:say("Well, to get my tible back you have to show me your worth, are you {sure}?", cid)
npcHandler.topic[cid] = 1
end
elseif msgcontains (msg, "raven herb") then
if player:getStorageValue(Storage.Quest.Cipfriedtible.Mission01) == 1 then
npcHandler:say("Did you find the raven herb??", cid)
npcHandler.topic[cid] = 2
end
elseif msgcontains(msg, "second mission") then
if player:getStorageValue(Storage.Quest.Cipfriedtible.Mission01) == 2 then
npcHandler:say("For your second mission you will have to take the boat to the south of this temple and navigate to the lighthouse and find a valuable {map}.", cid)
player:setStorageValue(Storage.Quest.Cipfriedtible.Mission02, 1)
npcHandler.topic[cid] = 0
end
elseif msgcontains (msg, "map") then
if player:getStorageValue(Storage.Quest.Cipfriedtible.Mission01) == 1 then
npcHandler:say("Did you find the raven herb??", cid)
npcHandler.topic[cid] = 4
end
elseif msgcontains(msg, "third mission") then
if player:getStorageValue (Storage.Quest.Cipfriedtible.Mission02, 2) == 2 then
npcHandler:say("for your third mission you have to go to the juvenile cyclops house and rescue my holy {tible}", cid)
player:setStorageValue(Storage.Quest.Cipfriedtible.Mission03, 1)
npcHandler.topic[cid] = 0
end
elseif msgcontains (msg, "tible") then
if player:getStorageValue(Storage.Quest.Cipfriedtible.Mission03) == 1 then
npcHandler:say("Did you find the tible??", cid)
npcHandler.topic[cid] = 5
end
elseif msgcontains(msg, "finish mission") then
if player:getStorageValue (Storage.Quest.Cipfriedtible.Mission03, 2) == 2 then
npcHandler:say("for your last mission you will have to kill the cyclope and bring me his {toe}, you can go now i can {teleport} you??", cid)
player:setStorageValue(Storage.Quest.Cipfriedtible.finish, 1)
npcHandler.topic[cid] = 6
end
elseif msgcontains (msg, "teleport") then
if npcHandler.topic[cid] == 6 and player:getStorageValue(Storage.Quest.Cipfriedtible.finish) == 1 then
player:teleportTo(Position(1226, 192, 10))
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
npcHandler.topic[cid] = 0
end
elseif msgcontains (msg, "tible") then
if npcHandler.topic[cid] == 6 and player:getStorageValue(Storage.Quest.Cipfriedtible.finish) == 1 then
npcHandler:say("Did you have the cyclops toe?", cid)
npcHandler.topic[cid] = 7
end
elseif msgcontains(msg, "sure") then
if npcHandler.topic[cid] == 1 then
npcHandler:say("Your first mission will be to retrieve a raven herb located on a mountain south of this temple. Be careful, several warriors have died trying to do it.", cid)
player:setStorageValue(Storage.Quest.Cipfriedtible.QuestLine, 1)
player:setStorageValue(Storage.Quest.Cipfriedtible.Mission01, 1)
npcHandler.topic[cid] = 0
end
elseif msgcontains(msg, "yes") then
if npcHandler.topic[cid] == 2 then
if player:getItemCount(5953) >= 1 then
npcHandler:say("Incredible, it must have been hard, but you have finally recovered the raven herb. Thank you |PLAYERNAME|, now you are ready for your {second mission}.", cid)
player:removeItem(5953, 1)
player:setStorageValue(Storage.Quest.Cipfriedtible.Mission01, 2)
player:addExperience(200, true)
npcHandler.topic[cid] = 0
else
npcHandler:say("You don't have the raven herb.", cid)
npcHandler.topic[cid] = 0
end
end
elseif msgcontains(msg, "yes") then
if npcHandler.topic[cid] == 4 then
if player:getItemCount(1957) >= 1 then
npcHandler:say("Incredible, it must have been hard, but you have finally recovered the map. Thank you |PLAYERNAME|, now you are ready for your {third mission}.", cid)
player:removeItem(1957, 1) --id del map
player:setStorageValue(Storage.Quest.Cipfriedtible.Mission02, 2)
player:addExperience(200, true)
npcHandler.topic[cid] = 0
else
npcHandler:say("You don't have the map.", cid)
npcHandler.topic[cid] = 0
end
end
elseif msgcontains(msg, "yes") then
if npcHandler.topic[cid] == 5 then
if player:getItemCount(1957) >= 1 then
npcHandler:say("Incredible, it must have been hard, but you have finally recovered the holy tible. Thank you |PLAYERNAME|, now you are ready for your {finish mission}.", cid)
player:removeItem(1957, 1) --id del map
player:setStorageValue(Storage.Quest.Cipfriedtible.Mission03, 2)
player:addExperience(200, true)
npcHandler.topic[cid] = 0
else
npcHandler:say("You don't have the holy tible.", cid)
npcHandler.topic[cid] = 0
end
end
elseif msgcontains(msg, "yes") then
if npcHandler.topic[cid] == 7 then
if player:getItemCount(10574) >= 1 then
npcHandler:say("Incredible, it must have been hard, but you have finally recovered the holy tible. Thank you |PLAYERNAME|, now you are ready for your {finish mission}.", cid)
player:removeItem(10574, 1) --id del map
player:setStorageValue(Storage.Quest.Cipfriedtible.finish, 2)
player:teleportTo(Position(1159, 216, 8))
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
npcHandler.topic[cid] = 0
else
npcHandler:say("You don't have the holy tible.", cid)
npcHandler.topic[cid] = 0
end
end
end
return true
end