• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

help with story npc

risy

Member
Joined
Aug 25, 2007
Messages
51
Solutions
1
Reaction score
6
Location
Spain
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
 
Solution
Ok than,
change location of storage

Lua:
Storage = {

        Cipfriedtible = {
            QuestLine = 30020,
            Mission01 = 30021,
            Mission02 = 30022,
            Mission03 = 30023,
            finish = 30024
    },
[...]

change in lua 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()...
Lua:
 if player:getStorageValue(Storage.Quest.Cipfriedtible.QuestLine)
Do you have set storages in lib\miscellaneous\051-storages.lua?
 
Lua:
 if player:getStorageValue(Storage.Quest.Cipfriedtible.QuestLine)
Do you have set storages in lib\miscellaneous\051-storages.lua?
not exatly but yes, im using other lib only for storages here are there:

Lua:
-- STORAGES --
-- (HIGHLY RECOMMENDED -> ONE mission per STORAGE) --
-- Sort it in Values -

Storage = {
      -- News quest development
      -- New storages
    Quest = {
        -- update pre-6.0
        DeeperFibula = {},
        OrnamentedShield = {},
        ShortSword = {},
        ThaisLighthouse = {},
        -- update 6.0
        StuddedShield = {},
        -- update 6.1
        EmperorsCookies = {},
        ExplorerBrooch = {},
        OrcFortress = {},
        Panpipe = {
            Key4055Reward = 20021
        },
        -- update 6.2
        Draconia = {},
        -- update 6.4
        AdornedUHRune = {},
        BarbarianAxe = {},
        BerserkerTreasure = {},
        DarkArmor = {},
        DemonHelmet = {},
        DoubleHero = {},
        EdronGoblin = {},
        FireAxe = {},
        PoisonDaggers = {},
        Ring = {},
        ShamanTreasure = {},
        StrongPotions = {},
        TrollCave = {},
        VampireShield = {},
        WeddingRing = {},
        -- update 6.5
        AlawarsVault = {},
        -- update 7.1
        BlackKnight = {},
        DragonTower = {},
        TimeRing = {},
        -- update 7.2
        Behemoth = {},
        ParchmentRoom = {},
        TheQueenOfTheBanshees = {},
        -- update 7.24
        GiantSmithhammer = {},
        MadMageRoom = {},
        SkullOfRatha = {},
        TheAnnihilator = {},
        TheParadoxTower = {},
        ThePostmanMissions = {},
        TheWhiteRavenMonastery = {},
        VoodooDoll = {},
        -- update 7.3
        MedusaShield = {},
        SerpentineTower = {},
        WhitePearl = {},
        -- update 7.4
        TheAncientTombs = {},
        TheDjinnWarEfreetFaction = {},
        TheDjinnWarMaridFaction = {},
        -- update 7.5
        ElephantTusk = {},
        Waterfall = {},
        -- update 7.6
        HydraEgg = {},
        TheApeCity = {},
        TheExplorerSociety = {},
        -- update 7.8
        AssassinOutfits = {},
        BarbarianOutfits = {},
        BeggarOutfits = {},
        CitizenOutfits = {},
        CitizenOutfitsRook = {},
        DruidOutfits = {},
        DruidOutfitsRook = {},
        HunterOutfits = {},
        KnightOutfits = {},
        MageOutfits = {},
        MarlinTrophy = {},
        Meriana = {},
        NoblemanOutfits = {},
        ObsidianKnife = {},
        OrientalOutfits = {},
        PirateOutfits = {},
        ShamanOutfits = {},
        SummonerOutfits = {},
        TheBlessedStake = {},
        TheMermaidMarina = {},
        TheShatteredIsles = {},
        TheSweatyCyclops = {},
        TreasureIsland = {},
        WarriorOutfits = {},
        WizardOutfits = {},
        -- update 7.9
        DreamersChallenge = {},
        ThePitsOfInferno = {},
        -- update 8.0
        BarbarianArena = {},
        BarbarianTest = {},
        BerserkPotion = {},
        FishingBox = {},
        FormorgarMinesHoist = {},
        FormorgarMines = {},
        FrostDragon = {},
        Inukaya = {},
        LionTrophy = {},
        MastermindPotion = {},
        NorsemanOutfits = {},
        Sinatuki = {},
        SkeletonDecoration = {},
        TheIceIslands = {},
        WaterskinOfMead = {},
        -- update 8.1
        AgainstTheSpiderCult = {},
        AritosTask = {},
        BrotherhoodOutfits = {},
        OutfitBrotherhoodMaleAddon = {},
        IntoTheBonePit = {},
        KissingAPig = {},
        KosheiTheDeathless = {},
        NightmareOutfits = {},
        OutfitNightmareMaleAddon = {},
        NomadsLand = {},
        RestInHallowedGround = {},
        SecretService = {},
        StealFromThieves = {},
        TheExterminator = {},
        TheTravellingTrader = {},
        TheUltimateBooze = {},
        ToAppeaseTheMighty = {},
        ToBlindTheEnemy = {},
        ToOutfoxAFox = {},
        TowerDefence = {},
        WhatAFoolish = {},
        -- update 8.2
        ElementalSpheres = {},
        MachineryOfWar = {},
        TheBeginning = {},
        TheDemonOak = {},
        TheHuntForTheSeaSerpent = {},
        TheInquisition = {},
        TheThievesGuild = {},
        TrollSabotage = {},
        VampireHunter = {},
        -- update 8.4
        BloodBrothers = {},
        InServiceOfYalahar = {},
        TheHiddenCityOfBeregar = {},
        TopOfTheCity = {},
        YalaharianOutfits = {},
        -- update 8.5
        Braindeath = {},
        DarashiaDragon = {},
        HotCuisine = {},
        KillingInTheNameOf = {},
        LoneMedusa = {},
        PilgrimageOfAshes = {},
        ShadowsOfYalahar = {},
        TheIsleOfEvil = {},
        TheLightbearer = {},
        TheScatterbrainedSorcerer = {},
        TreasureHunt = {},
        -- update 8.54
        AnUneasyAlliance = {},
        ChildrenOfTheRevolution = {},
        SeaOfLight = {},
        TheNewFrontier = {},
        TomesOfKnowledge = {},
        UnnaturalSelection = {},
        WarmasterOutfits = {},
        -- update 8.6
        AFathersBurden = {},
        AnInterestInBotany = {},
        TheSpiritWillGetYou = {},
        WayfarerOutfits = {},
        WrathOfTheEmperor = {},
        -- update 8.61
        RiseOfDevovorga = {},
        -- update 8.7
        APieceOfCake = {},
        APiratesDeathToMe = {},
        AnnualAutumnVintage = {},
        Bewitched = {},
        DemonsLullaby = {},
        JackToTheFuture = {},
        LastCreepStanding = {},
        ResearchAndDevelopment = {},
        RottinWoodAndTheMarriedMen = {},
        Spirithunters = {},
        TheColoursOfMagic = {},
        --update 9.1
        AfflictedOutfits = {},
        AwashWorldChange = {},
        DemonWarsWorldChange = {},
        ElementalistOutfits = {},
        HorseStationWorldChange = {},
        InsectoidInvasionWorldChange = {},
        LooseEnds = {},
        OverhuntingWorldChange = {},
        SteamshipWorldChange = {},
        SwampFeverWorldChange = {},
        TheMagesTowerWorldChange = {},
        TheMummysCurseWorldChange = {},
        TheRookieGuard = {},
        TheirMastersVoiceWorldChange = {},
        ThornfireWorldChange = {},
        TwistedWatersWorldChange = {},
        -- update 9.4
        BankRobberyMiniWorldChange = {},
        BoredMiniWorldChange = {},
        DeeplingsWorldChange = {},
        DownTheDrainMiniWorldChange = {},
        FireFromTheEarthMiniWorldChange = {},
        HiveBornWorldChange = {},
        InsectoidOutfits = {},
        KingsdayMiniWorldChange = {},
        LiquidBlack = {},
        LumberjackMiniWorldChange = {},
        NomadsMiniWorldChange = {},
        NoodlesIsGoneMiniWorldChange = {},
        OrientalTraderMiniWorldChange = {},
        RiverRunsDeepMiniWorldChange = {},
        StampedeMiniWorldChange = {},
        ThawingMiniWorldChange = {},
        WarAgainstTheHive = {},
        -- update 9.5
        SpringIntoLife = {},
        -- update 9.80
        BigfootsBurden = {},
        CrystalWarlordOutfits = {},
        DevovorgasEssenceMiniWorldChange = {},
        SoilGuardianOutfits = {},
        SpiderNestMiniWorldChange = {},
        WarpathMiniWorldChange = {},
        -- update 9.80
        ChildOfDestiny = {},
        DemonOutfits = {},
        GoblinMerchant = {},
        VenoreDailyTasks = {},
        -- update 10.10
        FuryGatesMiniWorldChange = {},
        HuntingForTokens = {},
        OpticordingSphere = {},
        SmallSapphire = {},
        TheGravediggerOfDrefia = {},
        TheRepenters = {},
        -- update 10.20
        CaveExplorerOutfits = {},
        SpikeTasks = {},
        SpiritGroundsMiniWorldChange = {},
        -- update 10.30
        DreamWardenOutfits = {},
        Roshamuul = {},
        -- update 10.37
        TinderBox = {},
        ChyllfroestMiniWorldChange = {},
        -- update 10.50
        DarkTrails = {},
        GloothEngineerOutfits = {},
        Oramond = {},
        Rathleton = {},
        -- update 10.55
        Dawnport = {
            VocationReward = 30001,
            Questline = 30002,
            GoMain = 30003,
            TheLostAmulet = 30004,
            TheStolenLogBook = 30005,
            TheRareHerb = 30006,
            TheDormKey = 30007,
            StrangeAmulet = 30008,
            TornLogBook = 30009,
            HerbFlower = 30010,
            MorriskTroll = 30011,
            MorrisTrollCount = 30012,
            MorrisGoblin = 30013,
            MorrisGoblinCount = 30014,
            MorrisMinos = 30015,
            MorrisMinosCount = 30016,
            Key0010 = 30017
        },
      CipfriedTible = {
            QuestLine = 30020,
            Mission01 = 30021,
            Mission02 = 30022,
            Mission03 = 30023,
            finish = 30024
},
      
        Bosses = {
            theCountOfTheCore = 871,
            theDukeOfTheDepths = 872,
            theBaronFromBelow = 873,
            theCountOfTheCoreAchiev = 874,
            theDukeOfTheDepthsAchiev = 875,
            theBaronFromBelowAchiev = 876,
            lastAchievement = 877
        }
    },
    CultsOfTibia = {
        Questline = 17950,
        Minotaurs = {
            EntranceAcess = 17999,
            JamesFrancisTask = 18000,
            Mission = 18001,
            BossTimer = 18500,
            AcessDoor = 18507
        },
        MotA = {
            Mission = 18002,
            Stone1 = 18510,
            Stone2 = 18511,
            Stone3 = 18512,
            Answer = 18513,
            QuestionId = 18514,
            AcessDoorInvestigation = 18508,
            AcessDoorEntrance = 18509,
            AcessDoorExit = 18510
        },
        Barkless = {
            Mission = 18003,
            sulphur = 18520,
            Tar = 18521,
            Ice = 18522,
            Death = 18523,
            Objects = 18524,
            Temp = 18525,
            BossTimer = 18501,
            TrialAcessDoor = 18511,
            TarAcessDoor = 18512,
            AcessDoor = 18513,
            BossAcessDoor = 18514
        },
        Orcs = {
            Mission = 18004,
            LookType = 18530,
            BossTimer = 18502
        },
        Life = {
            Mission = 18005,
            BossTimer = 18503,
            AcessDoor = 18515
        },
        Humans = {
            Mission = 18006,
            Vaporized = 18550,
            Decaying = 18551,
            BossTimer = 18504
        },
        Misguided = {
            Mission = 18007,
            Monsters = 18540,
            Exorcisms = 18541,
            Time = 18542,
            BossTimer = 18505,
            AcessDoor = 18516
        },
        FinalBoss = {
            Mission = 18008,
            BossTimer = 18506,
            AcessDoor = 18517
        }
    },
    ThreatenedDreams = {
        -- WIP
        -- Reserved storage from 34999 - 35100
        Start = 35000,
        TroubledMission01 = 35001,
        TroubledMission02 = 35002,
        TroubledMission03 = 35003,
        FairyMission01 = 35004,
        FairyMission02 = 35005,
        FairyMission03 = 35006,
        FairyMission04 = 35007,
        DreamMission01 = 35008,
        DreamCounter = 35009,
        KroazurTimer = 35010,
        CoupleMission01 = 35011,
        CoupleMission02 = 35012,
        Reward01 = 35050,
        Reward02 = 35051,
        Reward03 = 35052
    },
    Grimvale = {
        SilverVein = 10094
    },
    RathletonQuest = {
        QuestLine = 10068,
        VotesCasted = 10069,
        Rank = 10070
    },
    FerumbrasAscension = {
        RiftRunner = 10076, -- do scroll
        TheShattererTimer = 10128,
        TheLordOfTheLiceTimer = 10129,
        TarbazTimer = 10078,
        RazzagornTimer = 10079,
        RagiazTimer = 10080,
        ZamuloshTimer = 10081,
        ShulgraxTimer = 10082,
        MazoranTimer = 10083,
        PlagirathTimer = 10084,
        FerumbrasTimer = 10085,
        Tarbaz = 10086,
        Razzagorn = 10087,
        Ragiaz = 10088,
        Zamulosh = 10089,
        Shulgrax = 10090,
        Mazoran = 10091,
        Plagirath = 10092,
        Access = 10111,
        TheShatterer = 10112,
        ZamuloshTeleports = 10113,
        BasinCounter = 10114,
        TheLordOfTheLiceAccess = 10115,
        FirstDoor = 54391,
        MonsterDoor = 54392,
        TarbazDoor = 54393,
        HabitatsAcess = 54394,
        HabitatsTimer = 54395,
        TarbazNotes = 10117,
        ColorLever = 10118,
        BoneFluteWall = 10119,
        BoneFlute = 10120,
        Ring = 10121,
        Statue = 10122,
        Fount = 10123,
        Vampire = 10124,
        Flower = 10125,
        Ring2 = 10126,
        Bone = 10127,
        Reward = 10116
    },
 
    SweetyCyclops = {
        AmuletTimer = 48,
        AmuletStatus = 49
    },
     OutfitQuest = {
        DefaultStart = 12010, -- until all outfit quests are completed
        Ref = 12010,
        Afflicted = {
            Outfit = 12005,
            AddonPlagueMask = 12006,
            AddonPlagueBell = 12007
        },
        Citizen = {
            -- Mission storages for temporary questlog entries
            MissionHat = 12009,
            AddonHat = 12011,
            MissionBackpack = 12008,
            AddonBackpack = 12012,
            AddonBackpackTimer = 12017
        },
        -- Begger Outfit Quest
        BeggarFirstAddon = 22029,
        BeggarSecondAddon = 22030,
        -- Druid-outfit Quest
        DruidHatAddon = 12013,
        CaveExplorerAddon = 12014,
        DruidAmuletDoor = 12020,
        -- Barbarian-outfit Quest
        BarbarianAddon = 12015,
        BarbarianAddonWaitTimer = 12016,
        -- Beggar
        BeggarOutfit = 12018,
        BeggarOutfitTimer = 12019,
        -- Hunter-outfit Quest
        HunterMusicSheet01 = 12050,
        HunterMusicSheet02 = 12051,
        HunterMusicSheet03 = 12052,
        HunterMusicSheet04 = 12053,
        HunterBodyAddon = 12054,
        HunterHatAddon = 12055,
        Hunter = {
            AddonGlove = 12054,
            AddonHat = 12055
        },
        Knight = {
            AddonSword = 12153,
            MissionHelmet = 12154,
            AddonHelmet = 12155,
            AddonHelmetTimer = 12156,
            RamsaysHelmetDoor = 12160
        },
        MageSummoner = {
            AddonWand = 12061,
            AddonBelt = 12062,
            MissionHatCloak = 12063,
            AddonHatCloak = 12064,
            AddonWandTimer = 12072
        },
        -- Nobleman Outfit
        NoblemanFirstAddon = 12069,
        NoblemanSecondAddon = 12070,
        -- Norseman-outfit Quest
        NorsemanAddon = 12065,
        -- Warrior-outfit Quest
        WarriorShoulderAddon = 12067,
        WarriorSwordAddon = 12068,
        WarriorShoulderTimer = 12071,
        -- Wizard-outfit Quest
        WizardAddon = 12066,
        -- Pirate-outfit Quest
        PirateBaseOutfit = 50003,
        PirateSabreAddon = 50002,
        PirateHatAddon = 22034,
        -- Assassin Outfit
        AssassinBaseOutfit = 50080,
        AssassinFirstAddon = 50081,
        AssassinSecondAddon = 50082,
        -- Golden Outfit
        GoldenOutfit = 52000,
        NightmareOutfit = 50083,
        NightmareDoor = 3040,
        BrotherhoodOutfit = 50084,
        BrotherhoodDoor = 3044,
        Shaman = {
            AddonStaffMask = 15000,
            MissionStaff = 15001,
            MissionMask = 15002
        },
        firstOrientalAddon = 50137,
        secondOrientalAddon = 50138
    },
    TheAncientTombs = {
        DefaultStart = 12100,
        VashresamunInstruments = 12109,
        MorguthisBlueFlameStorage1 = 50214,
        MorguthisBlueFlameStorage2 = 50215,
        MorguthisBlueFlameStorage3 = 50216,
        MorguthisBlueFlameStorage4 = 50217,
        MorguthisBlueFlameStorage5 = 50218,
        MorguthisBlueFlameStorage6 = 50219,
        MorguthisBlueFlameStorage7 = 50220
    },
    TheApeCity = {
        Started = 12120,
        Questline = 12121, -- Storage through the Quest
        DworcDoor = 12128,
        ChorDoor = 12119,
        ParchmentDecyphering = 12124,
        FibulaDoor = 12125,
        WitchesCapSpot = 12126,
        CasksDoor = 12127,
        Casks = 12128,
        HolyApeHair = 12129,
        SnakeDestroyer = 12151,
        ShamanOufit = 12152
    },

the code isn`t complete because the limit of post its low....
 
Last edited:
Ok than,
change location of storage

Lua:
Storage = {

        Cipfriedtible = {
            QuestLine = 30020,
            Mission01 = 30021,
            Mission02 = 30022,
            Mission03 = 30023,
            finish = 30024
    },
[...]

change in lua 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


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.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.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.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.Cipfriedtible.Mission02, 1)
            npcHandler.topic[cid] = 0
        end
    elseif msgcontains (msg, "map") then
        if player:getStorageValue(Storage.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.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.Cipfriedtible.Mission03, 1)
            npcHandler.topic[cid] = 0
        end
    elseif msgcontains (msg, "tible") then
        if player:getStorageValue(Storage.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.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.Cipfriedtible.finish, 1)
            npcHandler.topic[cid] = 6
        end
    elseif msgcontains (msg, "teleport") then
        if npcHandler.topic[cid] == 6 and player:getStorageValue(Storage.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.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.Cipfriedtible.QuestLine, 1)
            player:setStorageValue(Storage.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.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.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.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.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

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

work.jpg
 
Solution
Back
Top