XenoBot Forums - Powered by vBulletin

User Tag List

Results 1 to 10 of 32

Thread: Anoyn's Scripts

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2

    Join Date
    May 2014
    Location
    Canada
    Posts
    320
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    Paladin/Mage Bow/X-Bow/Wand Spell Caster
    This script replaces the built in magic shooter.
    It casts spells after a Bow/Crossbow/wand hit to avoid exhaust.
    It only works with bow, XBow and wands.
    It does not support area spells.
    It supports range limited spells.
    It supports spells for specific creatures.


    lua code:

    -- Paladin/Mage single target spell shooter
    -- THIS ONLY WORKS WITH ARROWS, BOLTS and WANDS/RODS
    --Version 2.1
    --[[ Made by
    ___ .__ __. ______ ____ ____ .__ __.
    / \ | \ | | / __ \ \ \ / / | \ | |
    / ^ \ | \| | | | | | \ \/ / | \| |
    / /_\ \ | . ` | | | | | \_ _/ | . ` |
    / _____ \ | |\ | | `--' | | | | |\ |
    /__/ \__\ |__| \__| \______/ |__| |__| \__|

    ]]


    --------------------------------------------
    --[[ ------------ CONFIG -------------- ]]--
    --------------------------------------------
    --if the spell does not have a range, dont give the spell a range
    --if you want to use a spell on any creature, dont give the spell onCreatures
    --attack can be either a spell or rune ID
    --spells you want to cast first should be at the top
    spells = {
    --{ attack = "exori san", range = 4 },
    { attack = "exori flam", range = 3, onCreatures = { "Kongra", "Rat" } }, -- This will cast exori flam on a Kongra or Rat if they are within a range of 3
    { attack = 3155, range = 3, onCreatures = { "Sibang" } },
    -- { attack = "exori gran con" },
    -- { attack = "exori con" },
    { attack = "exori vis", range = 3 }
    }

    --How long do you want to wait between your arrow and casting spell? (If OT, set to 0)
    delayToCastMin = 150 -- 150ms
    delayToCastMax = 300 -- 300ms

    --IF you are playing a wierd OT that messes with player HP, you can override what vocation you are here
    overrideVocation = nil -- "Paladin", "Mage"

    --------------------------------------------
    --[[ ----- Script -- No need to edit ---- ]]
    --------------------------------------------

    function VocationDetection() --Aristeus
    if overrideVocation ~= nil and (overrideVocation ~= "Knight" or overrideVocation ~= "Paladin" or overrideVocation ~= "Mage") then
    print("Overiding Vocation to " .. overrideVocation)
    Vocation = overrideVocation
    else
    local HealthLevel = (Self.MaxHealth() - 185) / (Self.Level() - 8)
    if (HealthLevel == 15) then
    Vocation = "Knight"
    print('Vocation: Knight')
    end
    if (HealthLevel == 10) then
    Vocation = "Paladin"
    print('Vocation: Paladin')
    end
    if (HealthLevel == 5) then
    Vocation = "Mage"
    print('Vocation: Mage')
    end
    print("Vocation " .. Vocation .. " detected.")
    end
    end
    VocationDetection()

    lastAmmoCount = Self.Ammo().count
    function checkIfCanCastSpell(targetID)
    --Check if spell has limited range
    for i = 1, #spells do
    local castThisSpell = true
    local creature = Creature.New(targetID)
    if creature ~= nil then
    if spells[i]['range'] ~= nil then
    if not( Self.DistanceFromPosition(creature:Position().x, creature:Position().y, creature:Position().z) <= spells[i]['range'] ) then
    castThisSpell = false
    end
    end
    --Check current target
    if castThisSpell and spells[i]['onCreatures'] ~= nil then
    if not table.contains( spells[i]['onCreatures'], creature:Name() ) then
    castThisSpell = false
    end
    end

    if castThisSpell then
    attack(spells[i]['attack'], targetID)
    break
    end
    end
    end
    end

    function attack(attackValue, targetID)
    wait(delayToCastMin,delayToCastMax)
    if tonumber(attackValue) then
    Self.UseItemWithCreature(attackValue, targetID)
    else
    Self.Cast(attackValue)
    end
    end

    if Vocation == "Paladin" then
    Module.New('boltChecker', function(boltChecker)
    ammo = Self.Ammo()
    local targetID = Self.TargetID()
    if ammo.count > lastAmmoCount then
    lastAmmoCount = ammo.count
    elseif targetID ~= 0 and ammo.id ~= 0 and ammo.count < lastAmmoCount then
    lastAmmoCount = ammo.count
    checkIfCanCastSpell(targetID)
    end
    end)
    elseif Vocation == "Mage" then
    BattleMessageProxy.OnReceive("BattleProxy", function(proxy, text)
    if( string.find(text, " due to your")) then
    local targetID = Self.TargetID()
    if targetID ~= 0 then
    checkIfCanCastSpell(targetID)
    end
    end
    end)
    else
    print("Vocation " .. Vocation .. " not supported")
    end
    Last edited by anoyn; 01-23-2016 at 05:48 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •