Hello. I am trying to write my own bot for 3.3.5a. In the process, I read threads related to my issues, some of which were resolved, but in the end, I still have some questions.
How can I find out the total number of objects in the object manager to know exactly how many iterations of the loop to perform? I tried writing in a for loop if(entity == nullptr || entity->next == nullptr) continue;, but it doesn't work, and I crash because I'm accessing an invalid address.
The second question is about using click to move. It works correctly for attacking, but when I want to loot something, it just opens a window without looting. If I manually right-click on the corpse, autoloot works fine. What could be the problem if I'm passing the same arguments I see in Cheat Engine when looting?
ctm->guidTarget = ent[ind].object->guid;
ctm->type = 0x6;
ctm->coords = ent[ind].object->pos;
Is there a way to determine if a unit is dead? I do this by checking their health, but I might run into problems later, and I'd like to know if the unit is dead or alive, not just by their health. Also, I would like to know if it makes sense to loot the mob, i.e., whether there is any loot in its corpse or not.
I want to clarify about the UnitHealth function, which takes an integer argument, and I don't understand what it needs to be passed. I tried passing the unit's GUID and ID, but it crashed as soon as I called the function.
How do people usually determine whether a unit is a mob or an NPC? I'd like to do this by GUID, but my current method is to get the names of all units and write down the ones I need. Then I check if the unit's name (from GetObjectNameFromGuid) is in my list and decide if I need this unit or not. But this is inconvenient, and I'd like to simplify this process.