O script consiste em, ao clicar, lançar uma flecha que, ao chegar no target, dará certo dano. Sendo assim, um bom script para Paladino.
SS:
ballista.lua (data/actions/scripts)
local config = {
shootRange = 7,
damage = {50, 100}, -- dano minimo/maximo
shootEffect = CONST_ANI_HUNTINGSPEAR,
impactEffect = CONST_ME_HITAREA,
exhaustOnUse = 300, -- tempo de recarga em segundos
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
actions.xml (data/actions)
<action itemid="id" event="script" value="ballista.lua"/>
Créditos: Printer