Created: 20 days ago on 05/25/2025, 02:16:36 PMUpdated: 20 days ago on 05/25/2025, 02:17:02 PM
Description: Bard:,
Supports simple Musicianship by using the instrumt,
Supports Song of Peacemaking,
Supports Song of Discordance,
Supports Song of Provocation,
Healing:,
Auto Bandages,
Auto Potions ( Unequips Weapon if under 80 Alchemy , make sure to set the var correctly) (Only Lesser Heal Potion so far since im missing the Type Ids of the other Pots),
-- Bard Aio
-- Elly
-- Elly Strikehurst Ingame
-- 25/05/25
-------
-- Change me
-------
--heal
local useBandages = true
local usePotions = false
local bandageHP = 90
local potionHP = 20
-- !NEEDED1 to equip your weapon back if you are under level 80 Alchemy with usePotions enabled.
-- Find the serial by typing -info and clicking your weapon
local currWeapon = 0x41DC22CF
--bard make sure only one option is enabled
local trainMusic = false
local usePeacemaking = false
local useDiscordance = false
local useProvocation = true
local provocationRange = 12
local discordanceRange = 12
-------
-- Dont change
-------
local musicTimer = 0
local bandageTimer = 0
local musicInstruments = { "Drum", "Lute", "Tambourine", "Lap Harp" }
local hpPotions = { 0x0F0C }
local lastOverheadTime = 0
local peacemakingTimer = 0
local alchemyLevel = Skills.GetValue("Alchemy")
local weaponUnequipped = false
local unequipTime = 0
local discordanceTimer = 0
local potionTimer = 0
local provocationTimer = 0
--------
-- Helper Funcs
--------
local function getDistance(x1, y1, x2, y2)
return math.sqrt((x2 - x1) ^ 2 + (y2 - y1) ^ 2)
end
local function sortByDistance(enemies)
local playerX = Player.X
local playerY = Player.Y
table.sort(enemies, function(a, b)
local distA = getDistance(playerX, playerY, a.X, a.Y)
local distB = getDistance(playerX, playerY, b.X, b.Y)
return distA < distB
end)
return enemies
end
local function hp()
local hits = Player.Hits
local hitsMax = Player.HitsMax
return (hits / hitsMax) * 100
end
local function findInstrument()
for i, instrument in ipairs(musicInstruments) do
local foundInstrument = Items.FindByName(instrument)
if foundInstrument then
return foundInstrument
end
end
return nil
end
local function findPotion()
for i, potion in ipairs(hpPotions) do
local foundPotion = Items.FindByType(potion)
if foundPotion then
return foundPotion
end
end
return nil
end
--------
-- Funcs
--------
local function trainMusicianship()
if not trainMusic then return end
local currentTime = os.time()
if currentTime < musicTimer then return end
local instrument = findInstrument()
if instrument then
Player.UseObject(instrument.Serial)
musicTimer = currentTime + 7
else
if currentTime > lastOverheadTime then
Messages.Overhead("No Instrument", 32, Player.Serial)
lastOverheadTime = currentTime + 0.5
end
end
end
local function songPeacemaking()
if not usePeacemaking then return end
local currentTime = os.time()
if currentTime < peacemakingTimer then return end
local instrument = findInstrument()
if instrument then
if Spells.Cast("SongOfPeacemaking") then
if Targeting.WaitForTarget(1000) then
if Journal.Contains("What instrument shall you play") then
Player.UseObject(instrument.Serial)
elseif Journal.Contains("Whom do you wish to calm") then
Targeting.TargetSelf()
peacemakingTimer = currentTime + 7
Messages.Overhead("Peacemaking Cast", 70, Player.Serial)
end
end
end
end
end
local function songDiscordance()
if not useDiscordance then return end
local currentTime = os.time()
if currentTime < discordanceTimer then return end
local filter = {
human = false,
notoriety = { 5 },
rangemax = discordanceRange
}
local enemies = Mobiles.FindByFilter(filter)
enemies = sortByDistance(enemies)
if #enemies > 0 then
local instrument = findInstrument()
if instrument then
if Spells.Cast("SongOfDiscordance") then
if Targeting.WaitForTarget(1000) then
if Journal.Contains("What instrument shall you play") then
Player.UseObject(instrument.Serial)
elseif Journal.Contains("Choose the target for your song of discordance") then
Targeting.Target(enemies[1].Serial)
discordanceTimer = currentTime + 7
Messages.Overhead("Discordance Cast: " .. (enemies[1].Name or "Unknown"), 70, Player.Serial)
end
end
end
end
else
if currentTime > lastOverheadTime then
Messages.Overhead("No enemies found!", 32, Player.Serial)
lastOverheadTime = currentTime + 1
end
end
end
local function songProvocation()
if not useProvocation then return end
local currentTime = os.time()
if currentTime < provocationTimer then return end
local filter = {
human = false,
notoriety = { 5 },
rangemax = provocationRange
}
local enemies = Mobiles.FindByFilter(filter)
enemies = sortByDistance(enemies)
if #enemies < 2 then
if currentTime > lastOverheadTime then
Messages.Overhead("Not enough enemies for provocation!", 32, Player.Serial)
lastOverheadTime = currentTime + 1
end
return
end
local instrument = findInstrument()
if instrument then
if Spells.Cast("SongOfProvocation") then
if Targeting.WaitForTarget(1000) then
if Journal.Contains("What instrument shall you play") then
Player.UseObject(instrument.Serial)
elseif Journal.Contains("Whom do you wish to incite") then
local target1 = enemies[1]
local target2 = enemies[2]
Targeting.Target(target1.Serial)
if Targeting.WaitForTarget(1000) then
if Journal.Contains("Whom do you wish them to attack") then
Targeting.Target(target2.Serial)
provocationTimer = currentTime + 7
Messages.Overhead(
"Provocation: " .. (target1.Name or "Unknown") .. " vs " .. (target2.Name or "Unknown"), 70,
Player.Serial)
end
end
end
end
end
end
end
------------
-- Heal
------------
local function bandageSelf()
if not useBandages then return end
local healTime = math.floor((9.0 + 0.85 * ((130 - Player.Dex) / 20)))
local currentTime = os.time()
if currentTime < bandageTimer then
if currentTime > lastOverheadTime then
local remaining = bandageTimer - currentTime
Messages.Overhead(remaining .. "s", 70, Player.Serial)
lastOverheadTime = currentTime + 0.5
end
return
end
local bandage = Items.FindByType(0x0E21)
if bandage then
if hp() <= bandageHP then
if Player.UseObject(bandage.Serial) then
if Targeting.WaitForTarget(500) then
Targeting.TargetSelf()
bandageTimer = currentTime + healTime
Messages.Overhead("Bandaging: " .. healTime .. "s", 70, Player.Serial)
lastOverheadTime = currentTime + 1
end
end
end
else
if currentTime > lastOverheadTime then
Messages.Overhead("Out of bandages!", 32, Player.Serial)
lastOverheadTime = currentTime + 1
end
end
end
local function potionSelf()
if not usePotions then return end
local currentTime = os.time()
if weaponUnequipped and currentTime > unequipTime then
local weapon = Items.FindBySerial(currWeapon)
Pause(1000)
Messages.Print("EQUIP!")
Player.Equip(weapon.Serial)
weaponUnequipped = false
return
end
if currentTime < potionTimer then return end
if hp() <= potionHP then
local potion = findPotion()
if potion then
if alchemyLevel < 80 then
if Player.ClearHands("left") then
Messages.Overhead("Used Healing Potion", 70, Player.Serial)
Pause(1000)
Player.UseObject(potion.Serial)
weaponUnequipped = true
unequipTime = currentTime + 1
potionTimer = currentTime + 8
end
else
Messages.Overhead("Used Healing Potion", 70, Player.Serial)
Player.UseObject(potion.Serial)
potionTimer = currentTime + 8
end
end
end
end
Messages.Overhead("Ellys Aio Bard loaded", 70, Player.Serial)
repeat
if Player.IsDead then
goto continue
end
potionSelf()
bandageSelf()
songPeacemaking()
songDiscordance()
songProvocation()
trainMusicianship()
::continue::
until false