- 
				
																			 cokebot
- Posts: 54
- Joined: Wed Oct 19, 2011 7:47 am
						
						
													
							
						#1 
									
						Post
					
								by cokebot » Wed Jul 08, 2015 11:53 am
			
			
			
			
			I'm getting really frustrated here, I want to traget a mob, use an an item on it which have a casttime and then I want to fight.
This is last version of many different I tried, but every time I attack the mob or dont move to it. 
It would be great if someone could help me.
 
Code: Select all
	__WPL:setForcedWaypointType("TRAVEL");
	player:cast("ROGUE_HIDE")
	repeat
	local mob =  player:target_Object(108232);	
	until mob
	inventory:useItem(201558);
	yrest(5000);
	__WPL:setForcedWaypointType();
	player:rest(5);
	inventory:update();
	if(inventory:itemTotalCount(201558) > 1) then
	__WPL:setWaypointIndex(__WPL:findWaypointTag("a"));
	else
	__WPL:setWaypointIndex(__WPL:findWaypointTag("b"));	
	end
 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 noobbotter
- Posts: 527
- Joined: Fri Aug 31, 2012 1:15 pm
						
						
													
							
						#2 
									
						Post
					
								by noobbotter » Wed Jul 08, 2015 12:09 pm
			
			
			
			
			Sounds like you need to watch for casting and wait until it's done. Try this (untested):
Code: Select all
__WPL:setForcedWaypointType("TRAVEL");
   player:cast("ROGUE_HIDE")
   repeat
   local mob =  player:target_Object(108232);   
   until mob
   inventory:useItem(201558);
   repeat
   		yrest (1000) --or maybe  player:rest(1)
   		player:update()
	until not player.Casting
   __WPL:setForcedWaypointType();
   inventory:update();
   if(inventory:itemTotalCount(201558) > 1) then
   __WPL:setWaypointIndex(__WPL:findWaypointTag("a"));
   else
   __WPL:setWaypointIndex(__WPL:findWaypointTag("b"));   
   end
 
		 
				
		
		 
	 
	
				
		
		
			- 
				
								rock5							
- Posts: 12173
- Joined: Tue Jan 05, 2010 3:30 am
- Location: Australia
						
						
													
							
						#3 
									
						Post
					
								by rock5 » Wed Jul 08, 2015 12:33 pm
			
			
			
			
			Note: player:target_Object will attack the mob. To target something without attacking it you have to use player:target(address). This means you have to find it first then target it, eg.
Code: Select all
   local mob
   repeat
       yrest(100)
       mob =  player:findEnemy(nil, 108232);   
   until mob
   player:target(mob)
If you need to move in closer you could do something like this.
Code: Select all
		if( distance(player.X, player.Z, mob.X, mob.Z) > 39 ) then
			player:moveInRange(CWaypoint(mob.X, mob.Z), 39, true);
		end
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
 ________________________
 Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
 
 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 cokebot
- Posts: 54
- Joined: Wed Oct 19, 2011 7:47 am
						
						
													
							
						#4 
									
						Post
					
								by cokebot » Wed Jul 08, 2015 2:11 pm
			
			
			
			
			Thanks Rock, the moveInRange code was what i needed, works fine now.
			
									
									
						 
		 
				
		
		 
	 
	
	
	
	
		Who is online
		Users browsing this forum: Ahrefs [Bot] and 3 guests