What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal
RebornBuddy Forums

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Problem with hostile mob detection.

eniac

Member
Joined
Jul 22, 2010
Messages
107
Hey I have made a plugin that will automatically activate and deactivate stealth while gathering. Stealthy
But I just now realised that it will not only use stealth on hostile mobs, but on every mob. Even neutral ones.

Does anyone have an idea how to sort out hostile mobs ?

I'm currently using:
Code:
GameObjectManager.GetObjectsOfType<BattleCharacter>().Where((u, i) => u.Type == GameObjectType.BattleNpc &&                                                                                                                       
                                                                u.Location.Distance(Core.Player.Location) < 30 &&
                                                                u.CanAttack &&
                                                                u.IsVisible).FirstOrDefault() != null
 
There isn't an api for checking a mobs reaction to the player currently, ill see about adding one.

Also, you can safely assume that everything returned from getobjectsoftype will be x type, so you can remove the u.Type == GameObjectType.BattleNpc to save from having todo an extra memory read.
 
Ok, thank you for the answer I will remove "u.Type == GameObjectType.BattleNpc". Looking forward to the hostile enemy api addition.
 
You can now do battlechar.StatusFlags.HasFlag(StatusFlags.Hostile) to check if a mob will aggro when you are near it. You should also check if the npc is much lower level as low enemies that are hostile wont aggro higher level players, im not sure what the breakpoint is for this.
 
Thanks so much mastahg. I just updated my plugin - testing at the moment.
 
Back
Top