Jump to content

How to detect that a quest item is nearby?


RedPia

Recommended Posts

Hey , I wanted to change some of my druid fightclass, so that he goes out of Catform once he tries to loot Quest items on the floor, like a piece of wood (not of kill quests).

This is the code i currently use to get out of catform to farm ores.

 

        var nodesNearMe = ObjectManager.GetObjectWoWGameObject().FindAll(p => p.GetDistance <= 8 && p.CanOpen);
        
        // break bear for the nodes
         if (nodesNearMe.Count > 0 && !(ObjectManager.Me.InCombatFlagOnly) && ObjectManager.Me.HaveBuff("Bear Form"))
         {
                Lua.LuaDoString("CastSpellByName(\"Bear Form\",1)");
                Thread.Sleep(400);
         }     

 

Which function could i use here so the Bot detects questitems and not nodes?

 

greet Red

Link to comment
Share on other sites

I am not quite sure if WRobot is able to distinguish between quest objects from any other game object that is interactable. You may need to make a list, or dictionary with quest id, and quest item id.. but you can just compare the nodeNearMe by the name of the object, aka Quest item.

var nodeNearMe = ObjectManager.GetObjectWoWGameObject().Where(t => t != null && t.CanOpen).OrderBy(u => ObjectManager.Me.Position.DistanceTo(u.Position)).FirstOrDefault();

if (nodeNearMe != null && nodeNearMe.Name == "Quest Item Name Here" && ObjectManager.Me.Position.DistanceTo(nodeNearMe.Position) <= 8)
{
    // break bear for the nodes
    if (!ObjectManager.Me.InCombatFlagOnly && ObjectManager.Me.HaveBuff("Bear Form"))
    {
        Lua.LuaDoString("CastSpellByName(\"Bear Form\",1)");
        Thread.Sleep(400);
    }
}

 

Edited by Apexx
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...