Page 1 of 1

Modification: abort cast at last moment if aggro

Posted: Sun Jul 12, 2009 1:42 pm
by d003232
That's a modification I did in my bot version to abort casts if I get aggro before really attacking a new mob. That should help to avoid fighting against more then one mob.

I tested it with a ranged damage dealer. It will not work, if you are in a group and get aggro becaus of a group member (I suggest not create a group even if botting with more then one char).

Insert in player.lua before line 160 'v:use();':

Code: Select all

-- modif break cast in last moment / works not for groups !!!
			self:update();
			local target = self:getTarget();			
			if( self.TargetPtr ~= 0 ) then  target:update(); end;
-- der Client liefert den self.battling und das Ziel des Zieles erst nach dem 2.ten Cast, wir sind einfach
-- zu schnell, aber warten würde uns langsamer machen
			if( self.Battling == true  and			-- we have aggro
			    target.TargetPtr ~= self.Address  and	-- but not from our target
			    hf_castcount == 0 ) then			-- and we dont cast before
				cprintf(cli.green, "1Aggro while first strik/cast, abort that cast/target: %s\n", target.Name); 			
				self:clearTarget();
				return;         	
			end;
-- end of modif break cast in last moment
Insert in player.lua at line 168 'while( not self.Casting ) do':

Code: Select all

-- STEPH07 modif break cast in last moment
					if( self.TargetPtr ~= 0 ) then  target:update(); end;
					if( self.Battling == true  and					-- STEPH07 we have aggro
					    target.TargetPtr ~= self.Address  and			-- STEPH07 but not from our target
					    hf_castcount == 1 ) then					-- STEPH07 and we dont cast before
						keyboardPress(settings.hotkeys.JUMP.key);	-- STEPH07
						cprintf(cli.green, "2Aggro while first strik/cast, abort that cast/target: %s\n", target.Name); 			-- STEPH07
						self:clearTarget();					-- STEPH07
						return; 		     				-- STEPH07
					end;								-- STEPH07
-- STEPH07 end of modif break cast in last moment
Insert in player.lua after line 177 'while(self.Casting) do':

Code: Select all

-- STEPH07 modif break cast in last moment
					if( self.TargetPtr ~= 0 ) then  target:update(); end;
					if( self.Battling == true  and					-- STEPH07 we have aggro
					    target.TargetPtr ~= self.Address  and			-- STEPH07 but not from our target
					    hf_castcount == 1 ) then					-- STEPH07 and we dont cast before
						keyboardPress(settings.hotkeys.JUMP.key);	-- STEPH07
						cprintf(cli.green, "3Aggro while first strik/cast, abort that cast/target: %s\n", target.Name); 			-- STEPH07
						self:clearTarget();					-- STEPH07
						return; 		     				-- STEPH07
					end;								-- STEPH07
-- STEPH07 end of modif break cast in last moment
and you have to insert the variable hf_castcount at player.lua after line 160 'v:use();':

Code: Select all

	hf_castcount = hf_castcount + 1;	-- STEPH02   <<< NEW LINE
and in player.lua after line 286 'local lastTargetHP = target.HP;'

Code: Select all

hf_castcount = 0;         		-- Modif STEPH02 counter for casts at your target
Pls try that modification only, if you are familar with lua. It is not really well tested.