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

Action Ballista [TFS 1.x]

Printer

if Printer then print("LUA") end
Senator
Premium User
Joined
Dec 27, 2009
Messages
5,782
Solutions
31
Reaction score
2,285
Location
Sweden?
Hello, here is a little funny script i made in couple minutes.

uGgu00Udb.gif


Code:
local config = {
    shootRange = 7,
    damage = {50, 100}, -- min/max
    shootEffect = CONST_ANI_HUNTINGSPEAR,
    impactEffect = CONST_ME_HITAREA,
    exhaustOnUse = 300, -- miliseconds
    direction = {
        [5692] = DIRECTION_NORTH,
        [5701] = DIRECTION_EAST,
        [5698] = DIRECTION_WEST,
        [5695] = DIRECTION_SOUTH
    }
}

local exhaust = Condition(CONDITION_EXHAUST_WEAPON)
exhaust:setParameter(CONDITION_PARAM_TICKS, config.exhaustOnUse)

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getCondition(CONDITION_EXHAUST_WEAPON) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        return true
    end

    player:addCondition(exhaust)
    for i = 1, config.shootRange do
        local nextPosition = item:getPosition()
            nextPosition:getNextPosition(config.direction[item.itemid], i)

        local tile = Tile(nextPosition)
        if tile then
            local topCreature = tile:getTopCreature()
            if topCreature then
                toPosition:sendDistanceEffect(topCreature:getPosition(), config.shootEffect)
                doTargetCombatHealth(player, topCreature, COMBAT_PHYSICALDAMAGE, -config.damage[1] * i, -config.damage[2] * i, config.impactEffect)
                return true
            end
        end
    end

    local nextPosition = item:getPosition()
    nextPosition:getNextPosition(config.direction[item.itemid], config.shootRange)

    toPosition:sendDistanceEffect(nextPosition, config.shootEffect)
    return true
end
 
Back
Top