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

TFS 1.3 How do i solve (a nill value)?

Joriku

Working in the mines, need something?
Premium User
Joined
Jul 16, 2016
Messages
1,140
Solutions
15
Reaction score
431
Location
Sweden
How do you do when things like this comes up?
300c3a774ccfb128e2110927dd580e24.png

LUA:
local config = {
    {fromPos = Position(994, 994, 7), toPos = Position(1007, 1009, 7), townId = 1},
    {fromPos = Position(32364, 32231, 7), toPos = Position(32374, 32243, 7), townId = 2}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local playerPos, isInTemple, temple, townId = player:getPosition(), false
    for i = 1, #config do
        temple = config[i]
        if isInRange(playerPos, temple.fromPos, temple.toPos) then
            if Tile(playerPos):hasFlag(TILESTATE_PROTECTIONZONE) then
                isInTemple, townId = true, temple.townId
                break
            end
        end
    end

    if not isInTemple then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Try to move more to the center of a temple to use the spiritual energy for a teleport.')
        return true
    end

    player:setStorageValue(Storage.AdventurersGuild.Stone, townId)
    playerPos:sendMagicEffect(CONST_ME_TELEPORT)

    local destination = Position(784, 1197, 6)
    player:teleportTo(destination)
    destination:sendMagicEffect(CONST_ME_TELEPORT)
    return true
end
 
You either ripped this from someone else project, or you are missing files.

Anyhow.. storage.AdventurersGuild.Stone.. just searchs for a table.

LUA:
storage = {AdventurersGuild = {stone = ???, xxx = ???}}
So you either create a table or set manually a storage value.
 

Similar threads

Replies
1
Views
169
Back
Top