I'm trying to experiment with hooking some NextBot-related function calls in TF2 (and figuring out C++ in the process).
Right now I have a hook on a function CTFBotScenarioMonitor::DesiredScenarioAndClassAction
, which expects a return type Action<CTFBot>
. I'd like to return an instance of one of the other actions present in the game.
Is there a way to manually get the size of a class, or to instantiate an instance of that class without an explicit size declaration? I'm able to allocate memory and call the ctor of something like CTFBotSeekAndDestroy
, but so far I'm manually inputting the amount to allocate based on existing references
. Was wondering if there were any other approaches (or something available to extensions that I didn't find).