• Vote in November Mapping Competition to select a winner!
  • 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!

Flying mount system TFS 1.2

namco

Alienbutserious
Joined
Sep 5, 2010
Messages
144
Solutions
2
Reaction score
36
@WibbenZ @mrianuraa
I've fixed but I'm having some trouble
I can't fly and when I say !up I can only see the teleporting effect over me
No console errors

Lua:
function Position:createFlyFloor()
    for i,deltaPos in ipairs(createFlyFloorHelperData) do
        local pos = Position()
        local currPos = {x = pos.x + deltaPos.x, y = pos.y + deltaPos.y, z = pos.z}
        local toTile = Tile(currPos)
        if (not toTile) or (not toTile:getItems()) or (not toTile:getGround()) then
            doAreaCombatHealth(0, 0, currPos, 0, 0, 0, 0)
            Game.createItem(460, 1, currPos)
        end
    end
end

function Position:removeFlyFloor()
    for i,deltaPos in ipairs(createFlyFloorHelperData) do
        local pos = Position()
        local currPos = {x = pos.x + deltaPos.x, y = pos.y + deltaPos.y, z = pos.z}
        local fromTile = Tile(currPos)
        local fromFlyItem = fromTile:getItemById(460)
        if fromFlyItem then
            fromFlyItem:remove()
        end
    end
end

Lua:
function Player:flyUp()
    if self:isFlying() then
        if self:canFlyUp() then
            local pos = self:getPosition()
            local tile = Tile(pos)
            local itemfloor = tile:getItemById(460)
            if itemfloor then
                pos:removeFlyFloor()
            end
 
            pos.z = pos.z-1
            pos:createFlyFloor()
            self:teleportTo(pos)
            pos:sendMagicEffect(CONST_ME_TELEPORT)
 
            return true
        end
 
        return false
    else
        self:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You are not flying.")
    end
end

Can't fly south + teleport effect on pos.z-1
1605971616770.png1605971749533.png
 
Top