Figured I'd ask if there's a way to do this. I'm looking to access a unit's current lock-on target, and I don't know of any way. Does on exist, and if so what must be done?
Hmm, I found some interesting parts of the 1playerhud.hud file:
What are these "events"? How can I access them? These could be very useful for potentially retrieving the entity through Lua.
Re: Getting a locked-on entity through Lua
Posted: Mon Jan 08, 2018 6:00 pm
by Marth8880
Pretty sure you can't.
HUD events are just callbacks sent by C++ to the game's HUD manager to tell it when to do certain things, such as when to bring up the minimap display.
Re: Getting a locked-on entity through Lua
Posted: Mon Jan 08, 2018 6:12 pm
by mrcluster
Marth8880 wrote:Pretty sure you can't.
HUD events are just callbacks sent by C++ to the game's HUD manager to tell it when to do certain things, such as when to bring up the minimap display.
Ah, a shame. My best idea would be a brute-force approach of hooking into the lock-on key through ScriptCB_SetFunctionIdForButtonId (if the function works how I think it does), then looping through a list of entity IDs and checking if the entity meets requirements that'd make it "locked-on", though that's extremely hacky.
Re: Getting a locked-on entity through Lua
Posted: Mon Jan 08, 2018 6:35 pm
by Marth8880
ScriptCB_SetFunctionIdForButtonId? Where have you seen that?
Re: Getting a locked-on entity through Lua
Posted: Mon Jan 08, 2018 7:46 pm
by Teancum
Marth8880 wrote:ScriptCB_SetFunctionIdForButtonId? Where have you seen that?