Page 1 of 1

waypoint wait problem

Posted: Sun Apr 17, 2011 7:51 pm
by kanta
I have a waypoint setup that's been working for the most part. Occasionally it fails and I need to somehow put a timer into the following function:

Code: Select all

	<!-- #133 --><waypoint x="3526" z="2693" y="47">
			while (true) do
   settings.options.MAX_TARGET_DIST = 300;
   player:findTarget("Boddosh");
   local target = player:getTarget();
   if(target.Name == "Boddosh") then
   player:restrnd(101, 8, 10);
   break;
   end;
yrest(300)
end;		
  </waypoint> <!-- Boddosh room -->
	<!-- #134 --><waypoint x="3621" z="2771" y="49">	</waypoint>
	<!-- #135 --><waypoint x="3697" z="2599" y="47">	</waypoint>
	<!-- #136 --><waypoint x="3905" z="2626" y="47">	</waypoint>
	<!-- #137 --><waypoint x="4037" z="2648" y="47">	</waypoint>
	<!-- #138 --><waypoint x="3905" z="2626" y="47">	</waypoint>
	<!-- #139 --><waypoint x="3697" z="2599" y="47">	</waypoint>
	<!-- #140 --><waypoint x="3621" z="2771" y="49">	</waypoint>
	<!-- #141 --><waypoint x="3526" z="2693" y="47"> </waypoint>
	<!-- #142 --><waypoint x="3566" z="2692" y="49">
			while (true) do
   settings.options.MAX_TARGET_DIST = 300;
   player:findTarget("Boddosh");
   local target = player:getTarget();
   if(target.Name == "Boddosh") then
   player:restrnd(101, 12, 15);
   break;
   end;
yrest(300)
end;		
  	</waypoint>
I've been looking around for a way to do it on my own but I haven't been able to find anything yet. The first occurrence is fine. My character gets to the entrance of the Boddosh room, waits till it detects Boddosh then waits 8 - 10 seconds for him to move back out of the room so I can clear 1/2 the room safely. It then goes back towards the entrance to wait a second time so I can clear the remaining mobs. On occasion Boddosh catches my character before it makes it to safety and it somehow lives through the fight before the second wait occurrence happens. Because of this it will wait indefinitely at the second wait. Is there some way to get a timer in there so it will continue after approximately 2 minutes?

Re: waypoint wait problem

Posted: Mon Apr 18, 2011 1:08 am
by rock5
First, if you are only going to set MAX_TARGET_DIST = 300 then you only need to do it once, either where you first need to change it or in an 'onLoad' section at the top of your waypoint file. If you only need it at 300 for the boddosh fight then you should be changing it back after the fight or room.

To add a timer just change the while loop to a check for the time.

Code: Select all

	settings.options.MAX_TARGET_DIST = 300;
	local startwait = os.clock()
	while ( 120 > (os.clock() - startwait) ) do
		player:findTarget("Boddosh");
		local target = player:getTarget();
		if(target.Name == "Boddosh") then
			player:restrnd(101, 12, 15);
			break;
		end;
		yrest(300)
	end; 

Re: waypoint wait problem

Posted: Mon Apr 18, 2011 5:09 am
by kanta
thank you