Created: 12 days ago on 06/25/2025, 09:02:40 AM
Description: V1 Tamer Utility Script by MunKy (Learning to LUA)
- Healing 2 pets, prioritising the pet with least health.
- Loop pause when casting spells or targeting.
- Distance checking.
- Stability fix for client crashing using FindByFilter.
- Pet resurrection.
- Bandage checker.
Credit to JaseOwns Bandage Loop as the foundation:
https://uoaddicts.com/script/jase-owns-bandage-loop-cm6micvh
--[[ V1 Tamer Utility Script by MunKy (Learning to LUA)
Healing 2 pets, prioritising the pet with least health. Loop pause when casting spells or targeting. Distance checking. Stability fix for client crashing using FindByFilter. Pet resurrection. Bandage checker.
Credit to JaseOwns Bandage Loop.
]]--
-- ADD YOUR PET NAMES BELOW. For a single pet leave petTwo blank. Do not remove either of these lines.
local petOne = "PETNAME1"
local petTwo = "PETNAME2"
-- Utility Functions
local healRange = 1
function GetBackpackItem(graphic)
local items = Items.FindByFilter({ graphics = { graphic } })
for _, item in ipairs(items) do
if item ~= nil and item.RootContainer == Player.Backpack.RootContainer then
return item
end
end
return nil
end
function GetBandage()
return GetBackpackItem(0x0E21)
end
function IsValidBandage(item)
return item and item.Name and item.Serial and Items.FindBySerial(item.Serial)
end
function Bandaging(applying)
if applying ~= nil then
applyingBandage = applying
if applying then ticks = 0 end
end
return applyingBandage
end
function GetDistance(mob)
if not mob or not mob.X or not mob.Y then return 999 end
local dx = math.abs(Player.X - mob.X)
local dy = math.abs(Player.Y - mob.Y)
return math.max(dx, dy)
end
function TryBandageTarget(mobile)
if not mobile or mobile.Hits >= mobile.HitsMax then return false end
while GetDistance(mobile) > healRange do
Messages.Overhead("Too far away from " .. (mobile.Name or "pet"), 89, Player.Serial)
Pause(2000)
if Player.IsDead then return false end
end
Player.UseObject(bandage.Serial)
if Targeting.WaitForTarget(500) then
Targeting.Target(mobile.Serial)
Pause(200)
if Journal.Contains("you begin applying") then
Messages.Overhead("Healing " .. (mobile.Name or "pet"), 89, Player.Serial)
Bandaging(true)
return true
end
end
return false
end
function SafeFindMobileByName(name)
local mobiles = Mobiles.FindByFilter({ names = { name } })
if mobiles and #mobiles > 0 then
return mobiles[1]
end
return nil
end
function ApplyBandage()
local pet1 = SafeFindMobileByName(petOne)
local pet2 = SafeFindMobileByName(petTwo)
if not Bandaging() and Journal.Contains("you begin applying") then
Messages.Overhead("Bandage started", 89, Player.Serial)
Bandaging(true)
end
if Bandaging() then return end
if Targeting.WaitForTarget(100) then
Pause(2000)
return
end
if not IsValidBandage(bandage) then
bandage = GetBandage()
if not IsValidBandage(bandage) then return end
end
if TryBandageTarget(pet1) then return end
if TryBandageTarget(pet2) then return end
end
-- Initial Setup
local bandage = GetBandage()
if not IsValidBandage(bandage) then
Messages.Overhead("No bandages found", 34, Player.Serial)
else
Messages.Overhead("Vet Loop Starting", 89, Player.Serial)
end
-- Bandage Monitoring Loop
Journal.Clear()
while not Player.IsDead do
if Journal.Contains("Error in script") then
Messages.Overhead("Script error detected - resetting", 34, Player.Serial)
Journal.Clear()
bandage = nil
Bandaging(false)
end
if Journal.Contains("you finish applying")
or Journal.Contains("You apply the bandages, but they barely help.")
or Journal.Contains("You did not stay close enough to heal your patient!")
or Journal.Contains("You heal what little damage your patient had.")
or Journal.Contains("You fail to resurrect")
or Journal.Contains("You are able to resurrect") then
Journal.Clear()
Messages.Overhead("Bandage complete.", 89, Player.Serial)
Bandaging(false)
end
if not Bandaging() and Journal.Contains("you begin applying") then
Messages.Overhead("Bandage started", 89, Player.Serial)
Bandaging(true)
end
if not IsValidBandage(bandage) then
bandage = GetBandage()
end
if IsValidBandage(bandage) then
ApplyBandage()
else
Messages.Overhead("Out of bandages", 34, Player.Serial)
end
Pause(200)
end
Original Version Saved - 6/25/2025, 9:02:40 AM - 12 days ago
Tamer Utility Healing Script
No changes to display