Safe AOE spellcaster

Description

Cast AOE spells in a save way and also decided on what spell to cast by the amount of monsters.

Requirements

OTCv8 version: 1.6 (possibly lower, cannot guarantee compatibility with lower versions)
Tibia version: 8.00-11.00

Usage

Copy script to your config. In the script you can set 2 values as instructed in the file:


local distance = 1 -- 2 is good for divine caldera
local amountOfMonsters = 2 	-- turnpoint to switch between spells
							-- (First spell when less, second spell when equal and third spell when more)
macro(1000, "multi target spell",  function()
    local specAmount = 0
  local isSafe = true;
    if not g_game.isAttacking() then
        return
    end
    for i,mob in ipairs(getSpectators()) do
        if (getDistanceBetween(player:getPosition(), mob:getPosition())  <= distance and mob:isMonster())  then
            specAmount = specAmount + 1
        end
    if (mob:isPlayer() and player:getName() ~= mob:getName()) then
            isSafe = false;
        end
    end
    if (specAmount == amountOfMonsters and isSafe==true) then 
        say(storage.Spell2, 250)
  elseif (specAmount > amountOfMonsters and isSafe==true) then 
        say(storage.Spell3, 250)
    else
        say(storage.Spell1, 250)
    end
end)
addTextEdit("Spell1", storage.Spell1 or "Single target", function(widget, text) 
storage.Spell1 = text
end)
addTextEdit("Spell2", storage.Spell2 or "Multi target", function(widget, text) 
storage.Spell2 = text
end)
addTextEdit("Spell3", storage.Spell3 or "Multi target", function(widget, text) 
storage.Spell3 = text
end)

Author

DiscordSyndru#4623