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

Lua Many errors of Storages in quests in TFS 1.3

TheSadOnion

New Member
Joined
Mar 5, 2017
Messages
5
Reaction score
0
Hi, I had many errors in quests that uses Storages, etc. Like getMonster (nil value), etc. But i solved those problems like using isMonster, etc.

Now i'm having these errors in WotE quest, that i can't solve, idk if TFS 1.3 is using a different syntaxis than TFS 1.2, coz these script is from TFS 1.2:

oXe0bBC.png

pyAt3pB.png


And these are the scripts:

Mission10Message....lua:
Lua:
local boss = {
    [3193] = "fury of the emperor",
    [3194] = "wrath of the emperor",
    [3195] = "scorn of the emperor",
    [3196] = "spite of the emperor",
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if boss[target.uid] and target.itemid == 12383 then
        target:transform(11753)
        Game.createMonster(boss[target.uid], {x = toPosition.x + 4, y = toPosition.y, z = toPosition.z})
        Game.setStorageValue(target.uid - 4, 1)
    elseif target.itemid == 12317 then
        if toPosition.x > 1013 and toPosition.x < 1050 and
            toPosition.y > 883 and toPosition.y < 908 then
            if player:getStorageValue(Storage.WrathoftheEmperor.BossStatus) == 1 then
                player:setStorageValue(Storage.WrathoftheEmperor.BossStatus, 2)
                player:setStorageValue(Storage.WrathoftheEmperor.Mission10, 3) --Questlog, Wrath of the Emperor "Mission 10: A Message of Freedom"
                player:say("The sceptre is almost torn from your hand as you banish the presence of the emperor.", TALKTYPE_MONSTER_SAY)
            end
        elseif toPosition.x > 1058 and toPosition.x < 1090 and
            toPosition.y > 888 and toPosition.y < 906 then
            if player:getStorageValue(Storage.WrathoftheEmperor.BossStatus) == 2 then
                player:setStorageValue(Storage.WrathoftheEmperor.BossStatus, 3)
                player:setStorageValue(Storage.WrathoftheEmperor.Mission10, 4) --Questlog, Wrath of the Emperor "Mission 10: A Message of Freedom"
                player:say("The sceptre is almost torn from your hand as you banish the presence of the emperor.", TALKTYPE_MONSTER_SAY)
            end
        elseif toPosition.x > 1060 and toPosition.x < 1090 and
            toPosition.y > 913 and toPosition.y < 931 then
            if player:getStorageValue(Storage.WrathoftheEmperor.BossStatus) == 3 then
                player:setStorageValue(Storage.WrathoftheEmperor.BossStatus, 4)
                player:setStorageValue(Storage.WrathoftheEmperor.Mission10, 5) --Questlog, Wrath of the Emperor "Mission 10: A Message of Freedom"
                player:say("The sceptre is almost torn from your hand as you banish the presence of the emperor.", TALKTYPE_MONSTER_SAY)
            end
        elseif toPosition.x > 1014 and toPosition.x < 1046 and
            toPosition.y > 914 and toPosition.y < 932 then
            if player:getStorageValue(Storage.WrathoftheEmperor.BossStatus) == 4 then
                player:setStorageValue(Storage.WrathoftheEmperor.BossStatus, 5)
                player:setStorageValue(Storage.WrathoftheEmperor.Mission10, 6) --Questlog, Wrath of the Emperor "Mission 10: A Message of Freedom"
                player:say("The sceptre is almost torn from your hand as you banish the presence of the emperor.", TALKTYPE_MONSTER_SAY)
                local destination = Position(1060, 965, 15)
                player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
                player:teleportTo(destination)
                destination:sendMagicEffect(CONST_ME_TELEPORT)
            end
        end
    elseif target.itemid == 12385 then
        if player:getStorageValue(Storage.WrathoftheEmperor.Questline) == 31 then
            player:setStorageValue(Storage.WrathoftheEmperor.Questline, 32)
            player:setStorageValue(Storage.WrathoftheEmperor.Mission11, 2) --Questlog, Wrath of the Emperor "Mission 11: Payback Time"
        end
            player:say("NOOOoooooooo...!", TALKTYPE_MONSTER_SAY, false, player, toPosition)
            player:say("This should have dealt the deathblow to the snake things' ambitions.", TALKTYPE_MONSTER_SAY)
    end
    return true
end

Bossesteleport.lua:
Lua:
local teleports = {
    [3189] = {destination = Position(1022, 896, 15), storage = GlobalStorage.WrathOfTheEmperor.Bosses.Fury},--{x = 1022, y = 896, z = 15}
    [3190] = {destination = Position(1072, 893, 15), storage = GlobalStorage.WrathOfTheEmperor.Bosses.Wrath},--{x = 1072, y = 893, z = 15}
    [3191] = {destination = Position(1075, 928, 15), storage = GlobalStorage.WrathOfTheEmperor.Bosses.Scorn},--{x = 1075, y = 928, z = 15}
    [3192] = {destination = Position(1019, 928, 15), storage = GlobalStorage.WrathOfTheEmperor.Bosses.Spite}--{x = 1019, y = 928, z = 15}
}

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

    local teleport = teleports[item.uid]
    if not teleport then
        return true
    end

    if player:getStorageValue(Storage.WrathoftheEmperor.BossStatus) == 5 then
        local destination = Position(1060, 965, 15)--{x = 1060, y = 965, z = 15}
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:teleportTo(destination)
        destination:sendMagicEffect(CONST_ME_TELEPORT)
        return true
    end

    if player:getStorageValue(Storage.WrathoftheEmperor.BossStatus) ~= item.uid - 3188 then
        player:teleportTo(fromPosition)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Go to another Teleport.')
        return true
    end

    if Game.getStorageValue(teleport.storage) ~= 1 then
        player:teleportTo(teleport.destination)
        teleport.destination:sendMagicEffect(CONST_ME_TELEPORT)
    else
        player:teleportTo(teleport.destination)
            --player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Go to another Teleport or take mission with Zizzle.')
    end
    return true
end

Even I have added the storages here on data/lib/miscelaneous/051-storages.lua:
Lua:
Storages = {
    WrathoftheEmperor = {
        Questline = 12350, -- Storage through the Quest
        Mission10 = 12360,
        Mission11 = 12361,
        BossStatus = 12371, --1090
    }
}

GlobalStorage = {
    WrathOfTheEmperor = {
        Light01 = 8018,
        Light02 = 8019,
        Light03 = 8020,
        Light04 = 8021,

        Bosses = {
            Fury = 3189,
            Wrath = 3190,
            Scorn = 3191,
            Spite = 3192
        }
    },
    InServiceOfYalahar = {
        LastFight = 982,
        WarGolemsMachine1 = 23700,
        WarGolemsMachine2 = 23701
    }
}

miscelaneous.lua
Lua:
-- load storages first
dofile('data/lib/miscellaneous/051-storages.lua')

lib.lua
Lua:
-- Miscellaneous library
dofile('data/lib/miscellaneous/miscellaneous.lua')

-- Core API functions implemented in Lua
dofile('data/lib/core/core.lua')

-- Compatibility library for our old Lua API
dofile('data/lib/compat/compat.lua')
 
Solution
you have it named Storages not Storage
Lua:
Storage = {
    WrathoftheEmperor = {
        Questline = 12350, -- Storage through the Quest
        Mission10 = 12360,
        Mission11 = 12361,
        BossStatus = 12371, --1090
    }
}
you have it named Storages not Storage
Lua:
Storage = {
    WrathoftheEmperor = {
        Questline = 12350, -- Storage through the Quest
        Mission10 = 12360,
        Mission11 = 12361,
        BossStatus = 12371, --1090
    }
}
 
Solution
Back
Top