blueboy / portal

This portal repo is for development purposes only
http://github.com/blueboy/portal
GNU General Public License v2.0
27 stars 24 forks source link

remove targets out of range #38

Open kennumen opened 12 years ago

kennumen commented 12 years ago

Okay, so using ".modify speed 6" isn't exactly normal usage, but the bots never forget about a target and keep running off. Reset nor follow help, only logoff + logon (or waiting until they've killed them all + adds).

Suggest we add a check to see if target is too far (75 yards?), if so, remove. I may be a special case but this should be a good check in any case.

blueboy commented 11 years ago

Can you confirm that this issue pertains to combat targets & or loot targets? I believe the problem lies the loot targets!

Scenario: Travelling across hostile country with the bots in tow.

You will quickly find that your bots are left behind as they become involved in combat and subsequent looting. As you exceed the bot/master distance of 50 yds the bots will then be summoned back to your location. Unfortunately, the bots may still have a full loot list (m_lootTargets) and will thus attempt to return to the targets. On the way back they will undoubtedly encounter further targets to combat which makes matters worse.

Solution:

Sometime back there was an issue where target corpses were being left unlooted and some code was removed to resolve this;

https://github.com/blueboy/portal/commit/f80a33137ba558bdad7463863bacff8d7ace791f

If we put this code back and set the default (m_confCollectDistanceMax) to 75yds as you suggest, this may do the trick.

kennumen commented 11 years ago

Would we need to put a periodic scan for corpses removed from the lootlist? Say we move out of range, then circle back and come across the corpses. Obviously the ranges would need to be different enough to prevent 'toggling' on and off. If you pick 75yds as out of range, then scan within 50 yds every 5 seconds?

Just a suggestion.

blueboy commented 11 years ago

Your suggestion has given me an idea ;) Maybe we could include some code in the 'findNearbyCreature()' function to mop up any unlooted corpses, should the bots come within range again. I'll be pushing a few more fixes to the 'new-ai' branch shortly, that I've ported from our 'onenew-ai' branch.

blueboy commented 11 years ago

Issue:

If the bots exceed the distance 'm_confCollectDistanceMax' set in the playerbot.conf file, then unlooted corpse guids will be removed from the m_lootTarget list. Obviously, you can manually loot these corpses later by using the 'get' command, but this can detract from normal game play. We must find a way to automate this process.

Solution:

A new function called findNearbyCorpse() services this process. If the bot collect flag COLLECT_FLAG_LOOT is set, lootable corpses detected within a set radius of the bot(s) will be added to the 'm_lootTarget' list. The corpses will then be looted (& skinned if possible) as normal.

Test:

Toggle off the COLLECT_FLAG_LOOT flag.

/p collect loot

EDIT@ You need to toggle off other flags, depending on the nature of the loot. I found that the bots were still looting skinnable creatures. I realised that they all had 'cooking' as a secondary profession. So I also needed to turn off this flag too.

The go off and kill lots of creatures, including those that can be skinned (As unlooted corpses can't be skinned, it not necessary to turn COLLECT_FLAG_SKIN flag off). Then move well away from the corpses and toggle the COLLECT_FLAG_LOOT flag back on. Approach the corpses with your bot group. As they come within the set distance (INTERACTION_DISTANCE = 5.0) they will start to loot and skin the corpses as normal.

I have created working code and I'll pushing the patch shortly to the new-ai branch.

Hope this helps

kennumen commented 11 years ago

awesome.

One question - the autoloot on 'lost' corpses only works once the bot happens to walk within 5 yards? Wouldn't a value between 15-25 yards be preferable?

blueboy commented 11 years ago

Yes, the distance can be easily set to a value between 15-25 yards,