Created: 17 days ago on 05/28/2025, 10:31:41 PMUpdated: 16 days ago on 05/29/2025, 08:21:39 PM
Description: Bug with packhorse but this seems to be working (ore from pack horse goes into container you change - use -info and scroll down to get the serial).
-- Packhorse Example
-- ===============================
-- Last Updated: 5/29/2025
-- ===============================
-- 5/29/2025: Fixed bug with maxrange to rangemax
-- 5/28/2025: We want to move ore from a packhorse to a container
-- ===============================
-- =============
-- KNOWN ISSUES
-- - Cannot drop things onto packhorse - packhorse is not considered a container - THIS IS A BUG
-- - You want to set the dropOffContainer.Serial to the container you want to drop the ore off at.
-- - If you want to use a container inside your packhorse, make sure its open when you drop off the ore.
-- =============
local dropOffContainer = {
Serial = 0x428956F4
}
local packhorseFilter = {
rangemin = 0,
rangemax = 2,
bodies = {0x0123},
}
local oreFilter = {
graphics = 0x19B9,
rangemin = 0,
rangemax = 2
}
local containerFilter = {
onground = true,
container = true,
rangemin = 0,
rangemax = 2,
}
local packhorses = Mobiles.FindByFilter(packhorseFilter)
for _, packhorse in ipairs(packhorses) do
Messages.Overhead("Packhorse found: " .. packhorse.Name, 68, Player.Serial)
--Player.UseObject(packhorse.Serial)
--Pause(650)
local containerDropOffInRange = false
local containers = Items.FindByFilter(containerFilter)
for _, container in ipairs(containers) do
if container.Serial == dropOffContainer.Serial then
Messages.Overhead("Drop off container found: " .. container.Name, 68, Player.Serial)
containerDropOffInRange = true
end
end
local ore = Items.FindByFilter(oreFilter)
if not containerDropOffInRange then
-- oresOnMe = {}
-- oresNotOnMe = {}
-- for _, item in ipairs(ore) do
-- if item.RootContainer == Player.Serial then
-- table.insert(oresOnMe, item)
-- else
-- table.insert(oresNotOnMe, item)
-- end
-- end
-- if #oresOnMe > 0 then
-- for _, item in ipairs(oresOnMe) do
-- Messages.Overhead("I'm looping out of my mind: " .. item.Name, 68, Player.Serial)
-- -- Player.UseObject(item.Serial)
-- -- Targeting.WaitForTarget(10000, false)
-- -- Targeting.Target(oresNotOnMe[1].Serial)
-- Player.PickUp(item.Serial, 60000)
-- Player.DropInContainer(oresNotOnMe[1].Serial)
-- Pause(650)
-- end
-- end
Messages.Overhead("Drop off container not found, skipping", 34, Player.Serial)
Pause(1000)
return
end
for _, item in ipairs(ore) do
Messages.Overhead("Ore found: " .. item.Name, 68, Player.Serial)
local canMove = true
for _, container in ipairs(containers) do
if item.RootContainer == container.Serial then
canMove = false
end
end
if canMove then
Messages.Overhead("Moving ore to container", 68, Player.Serial)
Player.PickUp(item.Serial, 60000)
Player.DropInContainer(dropOffContainer.Serial)
Pause(650)
end
end
end