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)