Jump to content

Recommended Posts

Hello!

I'm creating my very first simple mod and I got stuck with a really simple thing. All I need is to replace the implementation of Wisecracker:OnUpdate with my own logic. What is the best way to do it in a mod?

(I can implement my functionality using AddPlayerPostInit, but it seems to be better to inject my code directly into Wisecracker component).

You can manipulate classes using AddClassPostInit (or at least I think that's how it is called). See API Examples for further reference.

By the way, consider keeping a reference to the existing function in a local variable and calling that function within your new one. Pseudo-code:

local oldfn = self.OnUpdate
self:OnUpdate(dt)
  --code
  oldfn(self, dt)
end
Edited by Mobbstar
corrected pseudo-code

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...