Page 1 of 1
Use AOE if targeted by multiple mobs
Posted: Sun Apr 03, 2011 2:13 am
by Mushroomstamp
How can I get the bot to use AOE skills only if I'm targeted by multiple mobs?
Re: Use AOE if targeted by multiple mobs
Posted: Sun Apr 03, 2011 2:31 am
by rock5
Someone asked something similar recently. I posted a little function that counted the number of mobs that have you targeted. Let me look for it.
http://www.solarstrike.net/phpBB3/viewt ... 759#p19759
As to how you could use it, maybe, in the onPreSkillCast section of your profile, check if you are casting your AOE skill. Is so then count your aggroed targets. If number > n then return true else return false so it can continue attacking with other skills.
Re: Use AOE if targeted by multiple mobs
Posted: Sun Apr 03, 2011 6:47 am
by Auto Pilot
Wouldn't it work better to check the mobs that are in AoE range rather than the one targeting you ?
Would just have to replace (in rock5' code linked)
Code: Select all
if pawn.TargetPtr == player.Address then
by
Code: Select all
if 50 > distance(player.X, player.Z, pawn.X, pawn.Z) then
(50 for purgatory fire, change for whatever AoE range is used)
Re: Use AOE if targeted by multiple mobs
Posted: Sun Apr 03, 2011 6:55 am
by rock5
Good point. I just answered what he asked.
Re: Use AOE if targeted by multiple mobs
Posted: Sun Apr 03, 2011 7:25 am
by lisa
Auto Pilot wrote:Wouldn't it work better to check the mobs that are in AoE range rather than the one targeting you ?
Would just have to replace (in rock5' code linked)
Code: Select all
if pawn.TargetPtr == player.Address then
by
Code: Select all
if 50 > distance(player.X, player.Z, pawn.X, pawn.Z) then
(50 for purgatory fire, change for whatever AoE range is used)
Trouble with that is it would recognise all mobs not just the ones targeting you, if people are trying to just through areas faster, hence the aoe, then they wouldn't want to stop to aoe in the middle of mobs not agroed on them because it would waste time. An example would be if you use a lvl 50 character to farm FA, you could easily run past a lot of the mobs and they wouldn't even aggro onto you because of the level difference.
Food for thought =)
Re: Use AOE if targeted by multiple mobs
Posted: Sun Apr 03, 2011 12:00 pm
by Mushroomstamp
I swear I searched... can't believe I missed that other thread - thanks Rock!
Auto - thanks for the reply but Lisa is right on with what I'm trying to do. =)
Re: Use AOE if targeted by multiple mobs
Posted: Fri Apr 08, 2011 8:20 am
by Mushroomstamp
I hate to ask but I can't really wrap my mind around the best way to implement this. Best thing I can think of is to change skill priority if multi aggro'd, but that doesn't seem practical. Can someone point me in the right direction?
Code: Select all
function CountAggroTargets()
local aggrocount = 0
local objectList = CObjectList();
objectList:update();
for i = 0,objectList:size() do
local obj = objectList:getObject(i);
if( obj ~= nil ) then
local pawn = CPawn(obj.Address);
if pawn.TargetPtr == player.Address then
aggrocount = aggrocount + 1
end
end
end
return aggrocount
end
Re: Use AOE if targeted by multiple mobs
Posted: Fri Apr 08, 2011 8:43 am
by rock5
Like I said, you could use it in the onPreSkillCast section of your profile. It would look something like this.
Code: Select all
<onPreSkillCast>
if arg1.Name == "your aoe skill" then
if CountAggroTargets() < 5 then -- Change '5' to how many you want
return false
end
end
return true
</onPreSkillCast>
This will only cast your area of effect if more than 4 mobs have you targeted. There is no provision for changing the sequence of skills. If you want to cast the aoe skill as soon as possible, you could cast the aoe after checking CountAggroTargets(). eg.
Code: Select all
if arg1.Name ~= "your aoe skill" and CountAggroTargets() > 5 then -- Change '5' to how many you want
player:cast("your aoe skill")
end
Re: Use AOE if targeted by multiple mobs
Posted: Fri Apr 08, 2011 11:08 pm
by Mushroomstamp
I'm such a dousche... it was right there in your first reply. New baby = sleep deprivation = fail! >=(