Not attacking mobs due to: "check if aggro before attacking"
Posted: Wed Jul 18, 2012 6:21 am
Hi
As the topic subject says, there is a problem with a character not attacking a mob (that is f.e. spawning next to us and attacking us).
If the mob spawns, we get immediate aggro, the mob runs to us and is attacking us. The following code (in the player.lua) PREVENTS us from killing the mob before it is hitting us.
Is there a workaround for that problem? I want my character to actually fight back when it gets attacked...
As the topic subject says, there is a problem with a character not attacking a mob (that is f.e. spawning next to us and attacking us).
If the mob spawns, we get immediate aggro, the mob runs to us and is attacking us. The following code (in the player.lua) PREVENTS us from killing the mob before it is hitting us.
Code: Select all
-- check if aggro before attacking
if( self.Battling == true and -- we have aggro
target.HP/target.MaxHP*100 > 90 and -- target is alive and no attacking us
-- Fix: there is a special dog mob 'Tatus', he switch from red to green at about 90%
-- there seems to be a bug, so that sometimes Tatus don't have us into the target but still attacking us
-- to prevent from skipping him while he is still attacking us, we do that special fix
target.Name ~= "Tatus" and
target.TargetPtr ~= self.Address and
target.TargetPtr ~= self.Pet.Address and
CPawn(target.TargetPtr).InParty ~= true ) then -- but not from that mob
cprintf(cli.green, language[36], target.Name);
self:clearTarget();
break_fight = true;
break;
end;