Page 1 of 3
Teaming & Aggro Issue
Posted: Sat Mar 12, 2011 9:25 pm
by Auto Pilot
I started using the bot in teams (of bots) recently (relationship buffs are so nice) and had a few issues.
When running similar waypoints on every bot, each time a bot aggroed something, every other char was stopping everything. That was easily fixed by a few minor edits to stop the bot from interrupting casts & similar stuff.
But, still, everytime someone got aggro, other bots would finish their current target (if they had one) and then "wait for aggressive ennemies" until every bot finished his fight.
Since I switched to a healer/assist waypoints (a modified version of the "lil helper" posted here) for the 2nd char (main char is only fighting, the 2nd one is buffing/healing/looting and assisting - or trying - on main's targets) but a few issues :
- It seems the bot is never targeting mobs, so assist doesn't work
- There is still the "waiting for agressive ennemies" issue : when the healer gets adds (from healing or just new aggro), main bot ignores them and moves to other mobs (even though that add is the nearest one and ANTI_KS is turned off) leaving the healer with a train of adds on him (how could I be screaming "BOT HERE!!!! BOT" harder ?)
So any idea on how to fix those 2 issues ? Making the bot actually target the targets (so secondary chars can assist) and not ignore the mobs shooting other people in team.
Edit : for the aggro issue I found a quick solution, replace in
player.lua around line 243 in the
CPlayer:findEnemy function
Code: Select all
local aggroOnly = aggroOnly or false;
by
It's a very quick fix, since it will make the main char shoot everything in range, regardless of who is the target, and ofc the best way would be to limit it to shoot stuff aggroing the team.
Re: Teaming & Aggro Issue
Posted: Sat Mar 12, 2011 10:02 pm
by lisa
It's not an easy task to do a party bot properly. You can of course just make it ignore agro and to just keep going, this would mean you would attack mobs that other players are killing, which wouldn't be good and you would also walk away from mobs that are attacking you or party members.
RoM bot has been built and designed around working solo, some have managed to get it work with 2 chars semi-efficiently.
I think it would need a rewrite of quite a bit of the coding to do it properly which would basically mean having 2 rombots, 1 for solo and 1 for partying.
I think in order to have a party bott working efficiently there would need to be a good way of communicating between the different bots for each character. I believe this is what is holding back most of the people who are working on a party bot, most are doing it independantly though.
Re: Teaming & Aggro Issue
Posted: Sat Mar 12, 2011 10:59 pm
by rock5
Lisa is of course correct although I think there are probably minor changes that would help peoples party scripts to work that wouldn't require a separate bot (mainly to do with targeting).
Auto Pilot wrote:- It seems the bot is never targeting mobs, so assist doesn't work
I assume you are talking about, from the second bot the first one seems to not have a target when it does. This is a known issue with the bot and I don't think it will ever be solved. Any solution would have to work around this limitation.
Auto Pilot wrote:- There is still the "waiting for agressive ennemies" issue : when the healer gets adds (from healing or just new aggro), main bot ignores them and moves to other mobs (even though that add is the nearest one and ANTI_KS is turned off) leaving the healer with a train of adds on him.
If you have ANTI_KS off then it's probably one of the other checks in the eval function that's stopping it being targetted. Hard to say which. You could enable DEBUG_TARGET to see why it didn't target that mob.
I have half a mind to do some work on the targeting to help with partying. I think the main thing it needs is, when you have aggro and it's searching for a mob that has you targetted, it should also check if it has a friend or party member targeted. We might need a profile option or 2 to assist friends and/or party members. What do you think?
Re: Teaming & Aggro Issue
Posted: Sat Mar 12, 2011 11:07 pm
by lisa
Checking if any mobs have party members targeted would solve a few of the issues for sure.
I still like my idea of using the party icons, so party leader (tank) targets a mob and then sets icon I on it. Party members search for the mob with the I and then kill it.
Would need a bit of searching and testing to make that work though.
Re: Teaming & Aggro Issue
Posted: Sun Mar 13, 2011 1:30 am
by lisa
This may or may not help but if going with the "raidtargetindex" idea these in game functions set and check the value
set's the target to I
returns value of target as numerical 1-8 or nil
So the leader would use
Code: Select all
sendMacro("SetRaidTarget("target", 1);")
Party member would need
Code: Select all
local _tarid = sendMacro("GetRaidTargetIndex("target");")
if _tarid ~= nil and _tarid == 1 then
*kill it*
else
*keep looking lol*
end
I tried to find the raidicon in memory but failed miserably lol
Re: Teaming & Aggro Issue
Posted: Mon Mar 14, 2011 1:47 am
by Auto Pilot
Raid Icon idea is a pretty sweet one when good assisting is needed
Also would it be possible to just check if
target.TargetPtr is in the list of team member's addresses ? Then I could just take the eval function, keep all the basic security checks (target alive, attackable, ....) and replace all the additionnal checks by that one.
It still wouldn't be assisting, but at least it would only select mobs that the team already aggroed. And with the scoring algorithm RoM Bot has, even with multiple adds, it would probably select the tank's target most of the time. Anyway I'll have to check if it works, but I'm probably missing something, it feels "too easy".
And I'll check the debug stuff (didn't know about those options) on tank side to see what was preventing him from attacking adds on healer.
Re: Teaming & Aggro Issue
Posted: Mon Mar 14, 2011 2:04 am
by rock5
Auto Pilot wrote:Also would it be possible to just check if target.TargetPtr is in the list of team member's addresses ?
That's what I was talking about. I think it should work although the way you said it makes me realise you would need to know the addresses of all your team mates. Still, it should be possible.
I haven't been working on it as I'm working on something else at the moment. If you get it working, please share.
Re: Teaming & Aggro Issue
Posted: Mon Mar 14, 2011 7:05 am
by Auto Pilot
Got some other improvments to make first (mostly some mana management issue and also some kind of detection so each bot can notice when the other one is gone and recall back to safety).
But I should be able to write the code (and have a party setup to test it out) tonight or tomorrow and will certainly post any positive results here.
Re: Teaming & Aggro Issue
Posted: Mon Mar 14, 2011 7:47 am
by JackBlonder
Maybe the network bot I started is helpful:
http://www.solarstrike.net/phpBB3/viewt ... =21&t=2248
I don't have time atm to improve it but feel free to use its code.
The targeting is solved by using a GUID that Rock found in memory (I also tried to find RaidTargetIndex but gave up).
It also has still the aggro issues mentioned.
Re: Teaming & Aggro Issue
Posted: Mon Mar 14, 2011 10:25 am
by Auto Pilot
I had checked your post Jack and it seemed like really good work
But my botting partner isn't even in the same country than me, so networking between the bots was kinda ruled out. And I'm trying to get something that works even if the main isn't botting (so I can just stick the healer on some alt or friend doing quests)
Also I had time to test a bit with comparing address of mob's target and team's ones and it seems to work nicely
Code: Select all
if RoMScript("UnitExists('party1')") then
table.insert(partymemberName, RoMScript("UnitName('player')"))
i = 1
while i < 6 do
if RoMScript("UnitIsPlayer('party"..i.."');") then
table.insert(partymemberName,i+1, RoMScript("UnitName('party"..i.."')"))
else
break
end
i = i + 1
end
printf("Team detected... We have %s members\n", i);
for i,v in ipairs(partymemberName) do
obj = player:findNearestNameOrId(partymemberName[i]);
printf("Looking for %s... ", partymemberName[i]);
if obj ~= nil then
table.insert(addressList,i,obj.Address)
table.insert(partymember,i,CPawn(obj.Address))
printf("OK\n")
else
printf("findNearestNameOrId failed\n");
end
end
end
Code is mostly from Jack. It checks all party members and tries to find their address with
findNearestNameOrId which seem to fail a lot (it's automatic when target is out of range and I also still get errors sometimes when standing on top of target). For now all I do is restart it until it works and couldn't figure out the problem. A
repeat ... until loop on that part won't solve the issue, when just restarting the bot will often get it right ...
Code: Select all
target = player:getTarget();
if not target:haveTarget() then
printf("[DEBUG] Target has no target\n");
-- Mob not aggroed yet, attack or ignore depending on result wanted
elseif in_table(target.TargetPtr, addressList) then
printf("[DEBUG] Target is attacking our team! \n");
-- Attack code here
else
printf("[DEBUG] Target is attacking someone not in team\n");
-- Add on ignore list, do nothing, kill steal, give buffs to that player or whatever else ...
end
in_table is a small function I wrote that just checks if 1st argument is an element of the 2nd argument.
Couldn't get 2 chars to test the last part, but there is no reason for it to not work. An example of the output log I get :
Resumed.
OPENING LOCAL SKILLS DB!
RoM windows size is 1600x900, upper left corner at 8,30
MACRO Test: ok
Ranged skill found: PRIEST_BONE_CHILL
[DEBUG] CPU Frequency 2345.644
Team detected... We have 4 members
Looking for MyName... OK
Looking for SomeDudeNameOutOfRange... findNearestNameOrId failed
Looking for SomeOtherDudeNameOutOfRange... findNearestNameOrId failed
Looking for AnotherDudeNameOutOfRange... findNearestNameOrId failed
[DEBUG] Target has no target ? <-- bot found a new target
Use ': PRIEST_RISING_TIDE => Some Mob's Name (20011/20011)
[DEBUG] Target is attacking our team! <-- I attacked it, it's on me now
Use ': PRIEST_RISING_TIDE => Some Mob's Name (20011/20011)
Use Ú: PRIEST_REGENERATE => Me (8119/8262)
[DEBUG] Target is attacking our team!
Use ': PRIEST_RISING_TIDE => Some Mob's Name (15515/20011)
[DEBUG] Target is attacking our team!
Use ': PRIEST_RISING_TIDE => Some Mob's Name (13211/20011)
[DEBUG] Target is attacking our team!
Use ': PRIEST_RISING_TIDE => Some Mob's Name (10915/20011)
Re: Teaming & Aggro Issue
Posted: Sun Mar 20, 2011 2:06 am
by lisa
How hard would it be to get the name of target or target.
I had a browse through player.lua and it appears to me it is comparing the isFriend(from profile) to the CPawn(target.TargetPtr)
Code: Select all
local targetOfTarget = CPawn(target.TargetPtr);
if( not self:isFriend(targetOfTarget) ) then
debug_target("anti kill steal: target not fighting us: target don't targeting a friend")
return false;
end
I thought that would return the address of the target of target and not name. So did it get the address of the player's name listed in the profile friends?
If we could get the name of the target of target this would be very simple.
returns the actual name of the first person in the party (not urself) it has no distance limitations either.
Re: Teaming & Aggro Issue
Posted: Sun Mar 20, 2011 3:40 am
by rock5
Code: Select all
targetOfTarget = CPawn(target.TargetPtr)
returns the whole pawn class. So 'targetOfTarget.Name' is the name and 'targetOfTarget.Id' is it's id. The problem arises when the target you are trying to get the targets target from is botting. When they are botting, because of the way it targets, you wont be able to get it's target. I'm not sure if the same is true when using in game functions, such as 'UnitName("targettarget")'.
Re: Teaming & Aggro Issue
Posted: Sun Mar 20, 2011 10:30 am
by lisa
Spent quite a bit of time working on this. The code I asked about earlier works perfectly(i tested and retested). I believe the issue of the bot not attacking mobs targeting a friend(profile) is line 272 of player.lua
Code: Select all
(( (pawn.TargetPtr == self.Address or (pawn.TargetPtr == self.PetPtr and self.PetPtr ~= 0)) and
aggroOnly == true) or aggroOnly == false) ) then
I think if we put in to also check if the target of target is a friend then it might actually attack it (then later can be changed to check party members aswell as friends) I tried but my understanding of how the function CPlayer:isFriend(pawn) works was failing me.
If anyone is working on using the functions to do with targeting there are a few things I discovered today.
1. Distance of agro is 400 yards, if party member within this range has agro then you will also be in combat, if you are out of that range u won't be in combat.
2. Distance of target information is 350 yards, you can't get target of target out of this distance.
3. If a pawn targets something while you are out of the 350 yards and you move closer you won't see it's target unless it retargets.
Re: Teaming & Aggro Issue
Posted: Sun Mar 20, 2011 7:43 pm
by rock5
The way findEnemy works, we would need to add a score for when a friend is targeted. eg.
Code: Select all
if player:isFriend(pawn.TargetPtr) then
currentScore = currentScore + SCORE_HELPFRIEND
end
But, remember, not everyone may want to help friends so maybe it needs to be an option. In which case it might have to be
Code: Select all
if player:isFriend(pawn.TargetPtr) and settings.profile.options.HELP_FRIEND == true then
currentScore = currentScore + SCORE_HELPFRIEND
end
Or could we use the antiks option?
And if you want to help friends you might not want to help party members so that might need to be checked separately, maybe needing another option.
Which brings us to party members. I think we might need a separate function, player:isPartyMember(). Then we could do,
Code: Select all
if player:isPartMember(pawn.TargetPtr) and settings.profile.options.HELP_PARTY == true then
currentScore = currentScore + SCORE_HELPPARTY
end
We could also change the antiks section in the default eval function.
Code: Select all
if( not player:isFriend(targetOfTarget) and not player:isPartyMember(targetOfTarget) ) then
debug_target("anti kill steal: target not fighting us: target not targeting a friend")
return false;
end
Unfortunately, I can't see a way past problem '3' but hopefully it wont happen very often. It just means that occassionally you might run past a party member and not help them.
I'm not sure what values to use for SCORE_HELPFRIEND and SCORE_HELPPARTY. I don't know how Administrator came to those other 'score' values. Also, I'm not sure what effect using GetPartyMember, which needs RoMScript, will have on the functioning of the bot. I think it would slow it down too much. Ideally we would need to get the party member names from memory. I'll take a stab at finding them.
Re: Teaming & Aggro Issue
Posted: Sun Mar 20, 2011 8:21 pm
by lisa
could get bot to set a table of party names when it is first launched, so would just run the romscript once for each member at startup. only issue would be if it changes afterwards.
Yeah I have been working on adding in a score for attacking friendly and I was going to make it more important then when mob is targeting player but yeah more options needed down the track. For now I just want to get it so a "dps" will actually kill something when it has agro but isn't being attacked.
For testing purposes I have been using the RoM functions for getting names and targettarget, still not quite there yet. Seems there are quite a few "checks" each time bot looks for a target.
Re: Teaming & Aggro Issue
Posted: Sun Mar 20, 2011 9:42 pm
by lisa
I think I found the main source of the issue, or maybe just the bigger one.
player.lua
Code: Select all
if( player.Battling == true and -- we have aggro
target.TargetPtr ~= player.Address ) then -- but not from that mob
debug_target("target lvl above/below profile settings with battling from other mob")
return false;
end;
Since you are in combat it checks if the mob is
not targeting you and if not then it doesn't attack it. So trick is to change that. obviously you can't just add in an or friend as it would still be not you.
I wonder if this part of the code is redundant now with the antiKS code that was added to the end? Because if that code is removed it will still get to the end of function and check for anti KS which would check who the pawn is targeting.
Re: Teaming & Aggro Issue
Posted: Sun Mar 20, 2011 11:17 pm
by rock5
Hm.. No I think it's correct. What it's saying is; if the mob is outside the level range then it wont target it, which is correct. But if you have aggro and the mob is targeting you then it will still attack the mob anyway. You don't want it to attack a mob that is out of the level range just because it is attacking a friend. If you want to attaack higher level mobs with your group you just need to change the level settings in your profile.
Re: Teaming & Aggro Issue
Posted: Sun Mar 20, 2011 11:43 pm
by lisa
Been doing lots of messing around today, actually got it to kill mobs that were targeting "friend" while anti-KS was true, I did however discover more issues that are probably even harder to deal with lol
If you have a healer in group, which is probably what most want, then you have the issue of if you cast a heal on another player and if they have no target they will then target the healer, same with buffs.
At one point I had a heal hit a DPS at just the wrong time and the dps tried to attack the healer, of course it couldn't and after a few seconds it gave up and continued on it's merry way but the issue is still there that your bot might be forced to target other players because of how RoM is set up.
I think I will put this back in the to hard basket again for a bit, doing my head in lol
Re: Teaming & Aggro Issue
Posted: Mon Mar 21, 2011 6:16 am
by rock5
Not sure why that happened. I'm pretty sure there should be a check to see if the target is a mob.
I just had a look. The eval function checks to see if the target is attackable, which players aren't so it shouldn't try to attack.
Anyway I found the party member names in memory. I've whipped up a userfunctions file to test it out. Try it out.
Just use GetPartyMemberName(n) to return the name of party member 'n'.
I'll try and incorporate it in the bot tomorrow.
Re: Teaming & Aggro Issue
Posted: Mon Mar 21, 2011 8:41 am
by lisa
Yeah I saw the check for target being player, the timing has to be bad. Bot has to start attacking, so it has already decided player:fighting and then you heal it before the mob fights back. So with the memory targeting it doesn't actually get a physical target until the mob attacks you which means any heals or buffs makes the physical target the player healing/buffing.
On a previous point the UnitName("targettarget") doesn't work for bot unless the bot gets a physical target ie. mob attacked it.
Physical target means you can see icon on screen, memory target is when you can't.
I'll test out the function and see how it goes, still need to get the issue of battling and not fighting sorted out.