I put a simple check in that sees if the current target is still the closest spawn, if it is after 3 attempts, it logs it as bad and moves on. works pretty well for me. Also added a tab feature to make sure the right node/mob is targeted.
I am trying to figure out a way to set up a couple of different spots it can run to to ck nodes. like it cks area 1, clears everything, moves to 2, then 3, then back to 1. i dont like the random features...
Keep in mind, all my mobs were to better fit my needs and done by a hobbiest
Code: Select all
'Heart of the Script.
Do while HarvestCounter < MaxHarvests
FindResource
if (SpawnID > 0) then
Sleep 2000
GotoResource
writeLogLine("Targeting Resource")
SendKeys("{TAB}") 'To Target the Resource
TargetID = getTargetID(oServiceObject)
if (TargetID > 0) then
MobName = getMobName(oServiceObject, TargetID)
writeLogLine("Targeted Resource: " & MobName)
end if
ResourceName = ClosestResources(0)(1) '************* MODIFIED iCounter = 0
do while (TargetID <> ClosestSpawnID) and (iCounter < Random(8,12))
iCounter = iCounter + 1
XUScriptPlugin.staStatus.Text = "TargetID:" & TargetID & " <> " & "SpawnID:" & ClosestSpawnID
SendKeys("{TAB}")
Sleep 5
TargetID = getTargetId(oServiceObject)
if (TargetID > 0) then
MobName = getMobName(oServiceObject, TargetIndex)
XUScriptPlugin.staStatus.Text = "Targeted Resource: " & MobName
writeLogLine("Targeted Resource: " & MobName)
end if
ResourceName = ClosestResources(0)(1) '************* MODIFIED
sleep Random(500,1500) 'Wait a random delay of .5 to 1.5 seconds
loop
tCounter = 0 'My Changes----------------------------------
if (TargetID <> ClosestSpawnID) and (tCounter < 8) then 'My Changes----------------------------------
SendKeys("{TAB}") 'My Changes----------------------------------
tCounter = tCounter + 1 'My Changes----------------------------------
end if 'My Changes----------------------------------
if (TargetID <> ClosestSpawnID) then
HandleBadResource
writeLogLine("ARG!!! Could not target the resource!!!")
end if
TargetID = getTargetID(oServiceObject)
if (TargetID = ClosestSpawnID) then HarvestResource
TargetID = getTargetID(oServiceObject)
if (TargetID = ClosestSpawnID) then HarvestResource
TargetID = getTargetID(oServiceObject)
if (TargetID = ClosestSpawnID) then HarvestResource
end if
if (TargetID = ClosestSpawnID) then 'My Changes----------------------------------
HandleBadResource 'My Changes----------------------------------
writeLogLine("ARG!!! Could not target the resource!!!") 'My Changes----------------------------------
end if 'My Changes----------------------------------
sleep 200
loop