alamancer Posted April 29, 2022 Share Posted April 29, 2022 (edited) When modding an existing character, can you override just one function? for example the Client_CanUpgradeWithModule(inst, module_prefab) function from wx78.lua file also can you hook a function so it runs like normal but also runs your code before or after it exicutes? Edited April 29, 2022 by alamancer Link to comment https://forums.kleientertainment.com/forums/topic/139782-can-you-hook-or-override-an-existing-characters-function/ Share on other sites More sharing options...
Leonidas IV Posted April 29, 2022 Share Posted April 29, 2022 Use this: AddPrefabPostInit("prefab", function(inst) _target_function = inst.fn.path -- Store the original function inst.fn.path = function(inst, ...) -- your code _target_function(inst, ...) end end) This is a function hook, for overwrite you can just ignore the _target_function. For more details, see this amazing post by CarlZalph. Link to comment https://forums.kleientertainment.com/forums/topic/139782-can-you-hook-or-override-an-existing-characters-function/#findComment-1565218 Share on other sites More sharing options...
alamancer Posted April 29, 2022 Author Share Posted April 29, 2022 thank you!!!!! I'll read that post and test it out Link to comment https://forums.kleientertainment.com/forums/topic/139782-can-you-hook-or-override-an-existing-characters-function/#findComment-1565279 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now