• 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!

Add quest requirements (Wrath and Warzones/GCTS)

GodZeus

New Member
Joined
Mar 13, 2017
Messages
2
Reaction score
0
Hi All,

Long time reader first time poster :).

TFS 1.3

Just wonder how I edit the these scripts so you have to do the required quests to enter the teleports?

Wrath of the Emperor (So you have do first 2 missions to enter Rebel Camp and Mission 5 to enter Lizard City)

Code:
local config = {
    [12382] = {storageKey = Storage.WrathoftheEmperor.Questline, toPosition = {Position(33078, 31219, 8), Position(33216, 31069, 9)}},
    [12383] = {storageKey = Storage.WrathoftheEmperor.Questline, toPosition = {Position(33216, 31069, 9), Position(33078, 31219, 8)}}
}

function onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return true
    end

    local targetTile = config[item.actionid]
    if not targetTile then
        return true
    end

    local hasStorageValue = player:getStorageValue(targetTile.storageKey) >= 23
    player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    player:teleportTo(targetTile.toPosition[hasStorageValue and 1 or 2])
    player:teleportTo(targetTile.toPosition[1])
    player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    if not hasStorageValue then
        player:say('This portal is not activated', TALKTYPE_MONSTER_SAY)
    end
    return true
end

And warzone teleport (GCTS - Need teleport crystals and complete Bigfoot's Burden Quest by gaining reputation points)

Code:
local destination = {
    [4121] = {position = Position(32801, 31766, 9), storageValue = 1, needCrystal = true},
    [3220] = {position = Position(32627, 31863, 11), storageValue = 1, needCrystal = true},
    [3128] = {position = Position(33000, 31870, 13), storageValue = 14},
    [3129] = {position = Position(32795, 31762, 10), storageValue = 14},
    [3130] = {position = Position(32864, 31844, 11), storageValue = 15},
    [3131] = {position = Position(32803, 31746, 10), storageValue = 15},
    [3132] = {position = Position(32986, 31862, 9), storageValue = 1}, -- Gnomebase Alpha
    [3133] = {position = Position(32796, 31781, 10), storageValue = 1}, -- City
    [3134] = {position = Position(32959, 31953, 9), storageValue = 16}, -- Golems
    [3135] = {position = Position(33001, 31915, 9), storageValue = 16}, -- Gnomebase Alpha
    [3136] = {position = Position(32904, 31894, 13), storageValue = 16},
    [3137] = {position = Position(32979, 31907, 9), storageValue = 16},
    [35669] = {position = Position(32986, 31864, 9), storageValue = 1}, -- leave warzone 3
    [3215] = {position = Position(32369, 32241, 7), storageValue = 1, needCrystal = true},
    [3216] = {position = Position(32212, 31133, 7), storageValue = 1, needCrystal = true},
    [3217] = {position = Position(32317, 32825, 7), storageValue = 1, needCrystal = true},
    [3218] = {position = Position(33213, 32454, 1), storageValue = 1, needCrystal = true},
    [3219] = {position = Position(33217, 31814, 8), storageValue = 1, needCrystal = true}
}

function onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return
    end

    local teleportCrystal = destination[item.actionid]
    if not teleportCrystal then
        return
    end

    if player:getStorageValue(Storage.BigfootBurden.QuestLine) < 1 then -- add by luanluciano
        player:setStorageValue(Storage.BigfootBurden.QuestLine, 1) -- add by luanluciano
    end -- add by luanluciano


    if player:getStorageValue(Storage.BigfootBurden.QuestLine) >= teleportCrystal.storageValue then
        if not teleportCrystal.needCrystal or player:removeItem(18457, 1) then
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            player:teleportTo(teleportCrystal.position)
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        else
            player:teleportTo(fromPosition)
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You need a teleport crystal to use this device.')
        end
        return true
    end

    -- There is no destination with storageValue == 2, should this check for storage?
    if teleportCrystal.storageValue == 2 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have no idea on how to use this device. Xelvar in Kazordoon might tell you more about it.')
    else
        player:teleportTo(fromPosition)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Sorry, you don\'t have access to use this teleport!')
    end
    return true
end

Code:
local teleGnome = {
    {posCrystal = {x=32803,y=31798,z=9}, posGo = {x=32626,y=31863,z=11}, needItem = true, idItem = 18457}, -- do crystal de gnome base para kazordon
    {posCrystal = {x=32628,y=31863,z=11}, posGo = {x=32804,y=31797,z=9}, needItem = true, idItem = 18457}, -- do crystal de kazordon para gnome base
    {posCrystal = {x=32772,y=31776,z=9}, posGo = {x=32402,y=32817,z=6}, needItem = true, idItem = 18457}, -- do crystal de gnome base para liberty bay
    {posCrystal = {x=32403,y=32818,z=6}, posGo = {x=32774,y=31775,z=9}, needItem = true, idItem = 18457}, -- do crystal de liberty bay para gnome base
    {posCrystal = {x=32786,y=31754,z=9}, posGo = {x = 32194, y = 31183, z = 8}, needItem = true, idItem = 18457}, -- do crystal de gnome base para svargrond
    {posCrystal = {x = 32196, y = 31183, z = 8}, posGo = {x=32787,y=31755,z=9}, needItem = true, idItem = 18457}, -- do crystal de svargrond para gnome base
    {posCrystal = {x=32827,y=31757,z=9}, posGo = {x=33185,y=32384,z=8}, needItem = true, idItem = 18457}, -- do crystal de gnome base para darashia
    {posCrystal = {x=33187,y=32384,z=8}, posGo = {x=32826,y=31759,z=9}, needItem = true, idItem = 18457}, -- do crystal de darashia para gnome base
    {posCrystal = {x=32831,y=31797,z=9}, posGo = {x=33153,y=31832,z=10}, needItem = true, idItem = 18457}, -- do crystal de gnome base para edron
    {posCrystal = {x=33154,y=31834,z=10}, posGo = {x=32830,y=31796,z=9}, needItem = true, idItem = 18457}, -- do crystal de edron para gnome base
    {posCrystal = {x=32805,y=31743,z=9}, posGo = {x=32331,y=32173,z=9}, needItem = true, idItem = 18457}, -- do crystal de gnome base para thais
    {posCrystal = {x=32330,y=32173,z=9}, posGo = {x=32806,y=31745,z=9}, needItem = true, idItem = 18457}, -- do crystal de thais para gnome base
    {posCrystal = {x=32796,y=31780,z=10}, posGo = {x=32985,y=31862,z=9}, needItem = true, idItem = 18457}, -- do crystal de gnome base para gnome alpha
    {posCrystal = {x=32986,y=31861,z=9}, posGo = {x=32796,y=31779,z=10}, needItem = true, idItem = 18457}, -- do crystal de gnome alpha para gnome base
    {posCrystal = {x=32795,y=31761,z=10}, posGo = {x=33000,y=31870,z=13}, needItem = true, idItem = 18457}, -- do crystal de gnome base para crystal ground
    {posCrystal = {x=33000,y=31871,z=13}, posGo = {x=32795,y=31762,z=10}, needItem = true, idItem = 18457}, -- do crystal de crystal ground para gnome base
    {posCrystal = {x=32803,y=31745,z=10}, posGo = {x=32864,y=31844,z=11}, needItem = true, idItem = 18457}, -- do crystal de gnome base para truffels garden
    {posCrystal = {x=32864,y=31845,z=11}, posGo = {x=32803,y=31746,z=10}, needItem = true, idItem = 18457}, -- do crystal de truffels garden para gnome base
    {posCrystal = {x=33013,y=31880,z=9}, posGo = {x=32996,y=31922,z=10}, needItem = true, idItem = 18457}, -- do crystal de Gnome alpha para WARZONE 1
    {posCrystal = {x=32996,y=31923,z=10}, posGo = {x=33013,y=31881,z=9}, needItem = true, idItem = 18457}, -- do crystal de WARZONE 1 para Gnome alpha
    {posCrystal = {x=33003,y=31918,z=10}, posGo = {x=33008,y=31922,z=10}, needItem = true, idItem = 18457}, -- do crystal de WARZONE 1 DENTRO para WARZONE 1 FORA
    {posCrystal = {x=33007,y=31921,z=10}, posGo = {x=33002,y=31918,z=10}, needItem = true, idItem = 18457}, -- do crystal de WARZONE 1 FORA para WARZONE 1 DENTRO
    {posCrystal = {x=33019,y=31886,z=9}, posGo = {x=33011,y=31943,z=11}, needItem = true, idItem = 18457}, -- do crystal de Gnome alpha para WARZONE 2
    {posCrystal = {x=33011,y=31944,z=11}, posGo = {x=33019,y=31887,z=9}, needItem = true, idItem = 18457}, -- do crystal de WARZONE 2 para Gnome alpha
    {posCrystal = {x=33011,y=31936,z=11}, posGo = {x=33014,y=31934,z=11}, needItem = true, idItem = 18457}, -- do crystal de WARZONE 2 DENTRO para WARZONE 2 FORA
    {posCrystal = {x=33013,y=31934,z=11}, posGo = {x=33010,y=31937,z=11}, needItem = true, idItem = 18457}, -- do crystal de WARZONE 2 FORA para WARZONE 2 DENTRO
    {posCrystal = {x=33022,y=31902,z=9}, posGo = {x=32989,y=31909,z=12}, needItem = true, idItem = 18457}, -- do crystal de Gnome alpha para WARZONE 3
    {posCrystal = {x=32989,y=31908,z=12}, posGo = {x=33021,y=31902,z=9}, needItem = true, idItem = 18457}, -- do crystal de WARZONE 3 para Gnome alpha
    {posCrystal = {x=32993,y=31913,z=12}, posGo = {x=32996,y=31917,z=12}, needItem = true, idItem = 18457}, -- do crystal de WARZONE 3 DENTRO para WARZONE 3 FORA
    {posCrystal = {x=32995,y=31916,z=12}, posGo = {x=32992,y=31912,z=12}, needItem = true, idItem = 18457}, -- do crystal de WARZONE 3 FORA para WARZONE 3 DENTRO
    {posCrystal = {x=32980,y=31907,z=9}, posGo = {x=32905,y=31893,z=13}, needItem = true, idItem = 18457}, -- do crystal de gnome alpha para hot spot
    {posCrystal = {x=32904,y=31893,z=13}, posGo = {x=32979,y=31906,z=9}, needItem = true, idItem = 18457}, -- do crystal de hot spot para gnome alpha
    {posCrystal = {x=33104,y=31909,z=10}, posGo = {x=33103,y=31959,z=10}, needItem = true, idItem = 18457}, -- do crystal de WARZONE 1 FORA BOSS para WARZONE 1 DENTRO BOSS
    {posCrystal = {x=33122,y=31976,z=10}, posGo = {x=33000,y=31899,z=9}, needItem = true, idItem = 18457}, -- do crystal de WARZONE 1 DENTRO BOSS para GNOME ALPHA
    {posCrystal = {x=33097,y=31977,z=11}, posGo = {x=33110,y=31949,z=11}, needItem = true, idItem = 18457}, -- do crystal de WARZONE 2 FORA BOSS para WARZONE 2 DENTRO BOSS
    {posCrystal = {x=33128,y=31964,z=11}, posGo = {x=33000,y=31899,z=9}, needItem = true, idItem = 18457}, -- do crystal de WARZONE 2 DENTRO BOSS para GNOME ALPHA
    {posCrystal = {x=33073,y=31880,z=12}, posGo = {x=33083,y=31905,z=12}, needItem = true, idItem = 18457}, -- do crystal de WARZONE 3 FORA BOSS para WARZONE 3 DENTRO BOSS
    {posCrystal = {x=33098,y=31911,z=12}, posGo = {x=33000,y=31899,z=9}, needItem = true, idItem = 18457} -- do crystal de WARZONE 3 DENTRO BOSS para GNOME ALPHA
}

function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) then
    local posPlayer = position
    for i=1, #teleGnome do
        if teleGnome[i].posCrystal.x == posPlayer.x and teleGnome[i].posCrystal.y == posPlayer.y and teleGnome[i].posCrystal.z == posPlayer.z then
            if teleGnome[i].needItem then
                if doPlayerRemoveItem(cid, teleGnome[i].idItem, 1) then
                    doTeleportThing(cid, teleGnome[i].posGo)
                    doSendMagicEffect(teleGnome[i].posGo, 10)
                else    
                    doTeleportThing(cid, fromPosition, true)
                    doPlayerSendCancel(cid, "You don't have one teleport crystal.")
                end
            else
                doTeleportThing(cid, teleGnome[i].posGo)
                doSendMagicEffect(teleGnome[i].posGo, 10)
            end
        end    
    end
end
return true
end

Both these quest you can still go through the teleports so I just want to know how I can make it so you need to do the quest before you have access?

I hope that makes sense. Any help would be much appreciated. Basically so its the same as real tibia

Cheers :)
 
Last edited:
Bump

I think this line is my issue? Or can someone explain to me what this actually means?

Code:
local hasStorageValue = player:getStorageValue(targetTile.storageKey) >= 23
 
Back
Top