So to fix this issue I thought about having the bot wait in one spot between two of the locations where the item appears, and once an item appears, i clcik it (gather it) then go back to my waiting spot. I keep doing this until the quest is complete.
Another problem I'm faced with is that if I pick the first 2 and they are not available, it will see a third one and if it goes to pick it and the quest is complete, it will try to run through an obstacle and look too much like a bot. With that, I want to put a distance limit on the objects I'm watching for. and only click the ones that are within 200 units (Feet?) from me.
Here's the code I came up with:
Code: Select all
<!-- # 9 --><waypoint x="11111" z="2222" y="33" tag="finditem">
local myitem = player:findNearestNameOrId(123456)
if not myitem then -- if it doesn't find one at all, then wait for one
repeat
yrest(500)
local myitem = player:findNearestNameOrId(118052)
until 200 > distance(player.X, player.Z, myitem.X, myitem.Z) -- resting until there's one within range
player:target_Object(myitem)
mycheckQuest(987654) -- my custom function to check my quest status and return the done variable
if done == "true" then
__WPL:setWaypointIndex(__WPL:findWaypointTag("continue")) --quest done, continue to turn in quest
end
else -- this is run if it did find one
if distance(player.X, player.Z, myitem.X, myitem.Z) > 200 then -- if not within range:
repeat
yrest(500)
local myitem = player:findNearestNameOrId(118052)
until 200 > distance(player.X, player.Z, myitem.X, myitem.Z) -- wait for one in range
player:target_Object(myitem)
mycheckQuest(987654) -- check quest
if done == "true" then
__WPL:setWaypointIndex(__WPL:findWaypointTag("continue")) --quest done, continue to turn in quest
end
else -- if it is in range:
player:target_Object(myitem)
mycheckQuest(987654) -- check quest
if done == "true" then
__WPL:setWaypointIndex(__WPL:findWaypointTag("continue")) --quest done, continue to turn in quest
end
end
end
__WPL:setWaypointIndex(__WPL:findWaypointTag("finditem")) -- at this point it gathered an item but quest isn't done so return to spot to wait for another
</waypoint>