Jump to content

Recommended Posts

Is there anyway to check if the unit targetted is Hostile in CSharp code? something like below?

return ObjectManager.GetWoWUnitHostile()

Not really an issue now but the bot is always trying to cast spell on vendor...  the spell is supposed to be an opening before combat

Link to comment
https://wrobot.eu/forums/topic/4277-checking-if-unit-is-hostile/
Share on other sites

In my profile I don't check "hostily", I check if "not friendly" thats a different. And npc's wouldn't attack

 

if UnitExists("target") and not UnitIsFriend("player", "target") then 
...
end

Its LUA, but I think, there is an option in C# also

3 hours ago, Bugreporter said:

In my profile I don't check "hostily", I check if "not friendly" thats a different. And npc's wouldn't attack

 


if UnitExists("target") and not UnitIsFriend("player", "target") then 
...
end

Its LUA, but I think, there is an option in C# also

I did tried your version, but it still kept casting...

 

Hello, you can check Reaction:

wManager.Wow.ObjectManager.ObjectManager.Target.Reaction
Quote

        Hated,
        Hostile,
        Unfriendly,
        Neutral,
        Friendly,
        Honored,
        Revered,
        Exalted,

You can also use:

wManager.Wow.ObjectManager.ObjectManager.Target.IsAttackable

or use this lua code:

Lua.LuaDoString<bool>("return UnitCanAttack('player', 'target');")

 

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...