Jump to content

Custom Behaviour if Player is nearby


Recommended Posts

Hello, is there any code for Custom behaviour for bot, if player is nearby? 
Additional thing is: Ignore list of players, as "pause bot if player is nearby" inside wrobot,

Link to comment
Share on other sites

There is no such by default function, but i belive it is possible to do a plugin like that. You will need to scan like 100 meters radius for every unit, every 0.5 second. Then check if any of those units are players, then decide what to do. Also it will be constantley trigered in towns and major hubs, like roads, so you will need to add an exceptions when to ignore those players.
To do so you will need or, check your current region (like If i'm in Orgrimmar), or, add a list of zones "by hands", like if (me.Position.DistanceTo(new Vector3(x, y, z) < 100) then you are at the road and you should ignore players.

First problem here, it's really pain in the ass to wright such thing, add all black list locations, edit them constantly and so on. The second problem, it will constantly scanning and will do a lot of work (i supese). This will increase your CPU load and, as a result, may reduse you bot amount per pc, wich is also not good.

Link to comment
Share on other sites

No need to false positives, this thing will be implemented into Plugin, So how it works:

Creating custom behavior and put it into plugin.
1. Run to Grinding spot with empty bags
2. Enable plugin ( i have that code to enable plugin in any step, so it's easy)
3. Grind spot with enabled plugin, checking nearby players in 100 yards,
4. Grinding spot has IsCompleteCondition = MeFreeBagSlots < 6 as example
5. Next step Turn Off plugin and Force To Town sell that shit,
6. GoToStep 0

P.S I'm okay to Press Shadowmelt if player is nearby for 2mins, cause usually my spots are not poluted with ppl, pausing bot for 2mins in 1hours is fine for me, but i will not get bans cause of report that way

Link to comment
Share on other sites

var playersList = new List<WoWUnit>();
playersList.AddRange(ObjectManager.GetObjectWoWUnit().Where(u => 
	// Here you may also need something like u != Me 
	u.Type == WoWObjectType.Player &&
	u.GetDistance < 100).ToList());

//	Or you can change 1 to 2 here in the IF, if it will be always positive, because 1 is your bot himself.								
if (playersList.Count() >= 1)
{
// Do work or pause bot here
}

You will need to wrap it in to the cikle or subscribe to some event of your choice. For example, maybe you would like to do it only on the fight end, or only when bot is not in combat. Else you will die when any player arrives at a horizont if you are in combat at this moment. After 10 deaths your equipment will broke and then your bot will decide to run for repair with your plugin still on because bags are still not full ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...