Paladin Bow/X-Bow Spell Caster
This script replaces the built in magic shooter.
It casts spells after a Bow/Crossbow hit to avoid exhaust.
It only works with bow and XBow.
It does not support area spells.
It supports range limited spells.
lua code:
-- Paladin single target spell shooter
-- THIS ONLY WORKS WITH ARROWS AND BOLTS
--Version 1.0
--[[ Made by
___ .__ __. ______ ____ ____ .__ __.
/ \ | \ | | / __ \ \ \ / / | \ | |
/ ^ \ | \| | | | | | \ \/ / | \| |
/ /_\ \ | . ` | | | | | \_ _/ | . ` |
/ _____ \ | |\ | | `--' | | | | |\ |
/__/ \__\ |__| \__| \______/ |__| |__| \__|
]]
--------------------------------------------
--[[ ------------ CONFIG -------------- ]]--
--------------------------------------------
--if the spell does not have a range, dont give the spell a range
--spells you want to cast first should be at the top
spells = {
--{ words = "exori san", range = 4 },
{ words = "exori gran con" },
{ words = "exori con" }
}
--How long do you want to wait between your arrow and casting spell? (If OT, set to 0)
delayToCastMin = 30 -- 30ms
delayToCastMax = 300 -- 300ms
--------------------------------------------
--[[ ----- Script -- No need to edit ---- ]]
--------------------------------------------
lastAmmoCount = Self.Ammo().count
function checkIfCanCastSpell(targetID)
--Check if spell has limited range
for i = 1, #spells do
if spells[i]['range'] ~= nil then
local creature = Creature.New(targetID)
if( creature ~= nil and Self.DistanceFromPosition(creature:Position().x, creature:Position().y, creature:Position().z) <= spells[i]['range'] ) then
if Self.CanCastSpell(spells[i]['words']) then
castSpell(spells[i]['words'])
break
end
end
else
if Self.CanCastSpell(spells[i].words) then
castSpell(spells[i]['words'])
break
end
end
end
end
function castSpell(words)
lastAmmoCount = ammo.count
wait(delayToCastMin,delayToCastMax)
Self.Cast(words)
end
Module.New('boltChecker', function(boltChecker)
ammo = Self.Ammo()
local targetID = Self.TargetID()
if targetID ~= 0 and ammo.id ~= 0 and ammo.count < lastAmmoCount then
checkIfCanCastSpell(targetID)
end
end)