Jump to content

How to detect that a quest item is nearby?


RedPia
 Share

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...