TalkAction [TFS 1.3] simply !fly system

Levi999x

AoT
Joined
Dec 14, 2017
Messages
1,490
Solutions
20
Reaction score
745
Location
Germany
Hi
Today I release a simple !fly system

Note:

  • You must add the actionID to ground for using !fly
  • You need premium to use !fly ( You can remove it )
  • You must be atleast level 100 to use !fly ( You can change the level requird as you want )
  • You need atleast 2x wings to fly ( itemID: 11195 )
1613951005065.png
Theres a 10% chance that the wings will destroy.
The game will broadcast where the player used to fly. ( Can be removed ) if its annonying :D


The script has been tested on TFS 1.3!! Should work without any problem

@Snavy and @Pox thanks for help =D
Add the script to data/scripts/FileName

Lua:
local config = {
    ['temple'] = { pos = Position(1000,1000,7), text = "temple", effect = 1 },
    ['depo'] = { pos = Position(2000,2000,7), text = "depo", effect = 1 },
    ['monks'] = { pos = Position(1000,1000,7), text = "depo", effect = 1 }
}

local fly = TalkAction("!fly")

function fly.onSay(player, words, param)
    
    local tile = player:getTile()
    local ground = tile and tile:getGround()
    if not ground or ground:getActionId() ~= 55555 then
        player:sendCancelMessage("You cannot fly here.")
        return false
    end
    
    local p = config[param:lower()]
    if not p then
        player:sendTextMessage(36, "Unknown destination")
        return false
    end
    
    if not player:isPremium() then
        player:sendCancelMessage("Sorry, you need to have a premium account.")
        return false
    end

    if player:getLevel() < 100 then
        player:sendCancelMessage("You must be atleast level 100 to use !fly.")
        return false
    end
    
    if player:getItemCount(11195) < 2 then
        player:sendCancelMessage("You need 2 wings to fly.")
        return false
    end
    
    local chance = math.random(100)
    if chance <= 10 then
        player:removeItem(11195, 2)
    end
    player:say('Bye', TALKTYPE_MONSTER_SAY)
    player:teleportTo(p.pos)
    player:say('Welcome', TALKTYPE_MONSTER_SAY)
    player:getPosition():sendMagicEffect(p.effect)
    Game.broadcastMessage(''..player:getName()..' has fly to '..p.text..'', MESSAGE_EVENT_ADVANCE)
    return false
end

fly:separator(" ")
fly:register()
 
Last edited:
Top