Post by nefariis on Mar 15, 2021 19:17:20 GMT
This script runs around the forest, chopping down every tree closest to your toon.
If you would like to do this unattended, you should add a "checkAndDefend()" method - but this works just fine as an attended macro
-- LoA 1.4.0.0
-- LoU 1.2.1.0
FindMobile("Pack Horse")
packHorse = FINDMOBILE[1].ID
function haveAxe()
if RIGHTHANDNAME and string.match(RIGHTHANDNAME, "hatchet") then
return true
else
FindItem ("hatchet", BACKPACKID)
if FINDITEM then
ContextMenu(FINDITEM[1].ID, "Equip")
return true
end
end
print("Hatchet")
return false
end
function moveTo(X, Z)
Move(X, CHARPOSY, Z)
while not distanceTo(X, Z) do
sleep(1000)
end
end
function distanceTo(X, Z)
xmin, xmax = math.min(CHARPOSX, X), math.max(CHARPOSX, X)
zmin, zmax = math.min(CHARPOSZ, Z), math.max(CHARPOSZ, Z)
xtrue = xmax - xmin < 2
ztrue = zmax - zmin < 2
return xtrue and ztrue
end
function moveLogsToHorse()
FindItem("log", BACKPACKID)
if FINDITEM then
for log in FINDITEM do
Drag(log.ID)
Dropc(packHorse)
sleep(1000)
end
end
end
function dropStuff()
for item in {"kindling", "apple"} do
FindItem(item, BACKPACKID)
if FINDITEM then
Drag(FINDITEM[1].ID)
Dropg(CHARPOSX, CHARPOSY, CHARPOSZ)
sleep(1000)
end
end
end
while haveAxe() do
FindPermanent("Tree")
for tree in FINDPERMANENT do
if tree.TREESTATE == 0 then
moveTo(tree.X, tree.Z)
Macro(28)
WaitForTarget()
TargetPermanent(tree.ID)
repeat
sleep(1000)
FindPermanent("Tree")
until FINDPERMANENT[1].TREESTATE == 1
dropStuff()
moveLogsToHorse()
break
end
end
end