-
Member
How to properly interact with Unit by lua unlcoker's way?
I used to do external Wow bot and do everything in my bot's lua thread instead of using ingame lua engine, recently I tried study a bit more and now I am able to make my own lua unlocker to unlock protected wow api.But I am stucked at interact with Unit. after do some research in forum it makes me even more confused. My question are listed below, very appreciate if anyone could give me hints and help:
1. By default, wow's native api such as UnitIsDeadOrGhost(unit) only accepts UnitID such as "player","target","pet",etc as parameter, so if I want to use UnitIsDeadOrGhost() to get info of a specific unit without selecting it as target first, what should I use as paramater, or what's the general way of other lua unlocker handles this?
Should I use the specific unit's GUID string as parameter, eg: UnitIsDeadOrGhost("Creature-0-3039-2570-8014-181494-000003E27E")? If so, what exactly do I need to patch to make it recognize GUID string instead of just "target" UnitID? Do i need to hook anything, or should I register my own api and pass unit's actor as paramater like most external bot does?
2. If I need to register my own function to return the ObjectManager/Entity list in game's lua engine, is there a way to make this function remain exists after doing "/reload" ?
-
Hey there,
Glad to see you’re diving into the internal side of things—it definitely gives you more control compared to external bots. I’ve been down this road myself, and there are always ways to work around the limitations.
To answer your questions, I’m assuming you’re working with a specific version of WoW, like Classic, Retail or maybe even private servers.. Let me know if that’s the case, because there can be some differences in how things behave.
1. If you want to use something like `UnitIsDeadOrGhost()` without having to target the unit directly, you can try setting the unit as your focus using its GUID, and then call `UnitIsDeadOrGhost("focus")`. That way, you’re not stuck with always needing to target them. But honestly, it might be better to set up your own function or metatable to pull info straight from the Object Manager. That would let you use GUIDs or other identifiers directly, which gives you more flexibility and doesn’t lock you into using specific unit IDs like “player” or “target.”
2. For the second question, the key is to use a callback. You’ll need a function that re-registers your custom functions every time the game does a `/reload` or when you port to a new area. When the UI reloads, WoW wipes the global table, so everything has to be set up again. I usually hook into the same process that registers the other Lua functions at load time to keep things consistent.
Let me know what version you’re working with and if you need more details. Good luck with the unlocker—it’s a bit of a learning curve, but it’s totally worth it!
-
Member
Originally Posted by
Makkah
Hey there,
Glad to see you’re diving into the internal side of things—it definitely gives you more control compared to external bots. I’ve been down this road myself, and there are always ways to work around the limitations.
To answer your questions, I’m assuming you’re working with a specific version of WoW, like Classic, Retail or maybe even private servers.. Let me know if that’s the case, because there can be some differences in how things behave.
1. If you want to use something like `UnitIsDeadOrGhost()` without having to target the unit directly, you can try setting the unit as your focus using its GUID, and then call `UnitIsDeadOrGhost("focus")`. That way, you’re not stuck with always needing to target them. But honestly, it might be better to set up your own function or metatable to pull info straight from the Object Manager. That would let you use GUIDs or other identifiers directly, which gives you more flexibility and doesn’t lock you into using specific unit IDs like “player” or “target.”
2. For the second question, the key is to use a callback. You’ll need a function that re-registers your custom functions every time the game does a `/reload` or when you port to a new area. When the UI reloads, WoW wipes the global table, so everything has to be set up again. I usually hook into the same process that registers the other Lua functions at load time to keep things consistent.
Let me know what version you’re working with and if you need more details. Good luck with the unlocker—it’s a bit of a learning curve, but it’s totally worth it!
Thx for the answer. I m working on retail. I was considering register my own function but there r too many native wow api related to grab info from a unit. So it will be annoying to register my own functions one by one. as I read from
documentation from some old unlocker, such as EWT, it seems like they could directly use GUID as parameter to all native api, so wonder how they did that?
-
Established Member
Originally Posted by
singed420
Thx for the answer. I m working on retail. I was considering register my own function but there r too many native wow api related to grab info from a unit. So it will be annoying to register my own functions one by one. as I read from
documentation from some old unlocker, such as EWT, it seems like they could directly use GUID as parameter to all native api, so wonder how they did that?
I answered this in your other post the other day:
https://www.ownedcore.com/forums/wor...ml#post4504676 (How to interact Unit by GUID?)
-
Post Thanks / Like - 1 Thanks
aeo (1 members gave Thanks to scizzydo for this useful post)
-
Member
is using objectmanager and exposing objects to lua the best way? so you can use those objects as parametrs in castspellbyname etc?