Faintly Macabre Posted May 20, 2016 Share Posted May 20, 2016 I'm probably getting in over my head here, but I'd like to make a change to an existing game component, and I'm wondering how one goes about that. Are there any good examples of mods out there that do something like this that I might be able to look over? Is it possible to do this without creating a conflict with a similar mod, and if so, what do I need to keep in mind to do so? Link to comment Share on other sites More sharing options...
Aquaterion Posted May 20, 2016 Share Posted May 20, 2016 22 minutes ago, TheHalcyonOne said: I'm probably getting in over my head here, but I'd like to make a change to an existing game component, and I'm wondering how one goes about that. Are there any good examples of mods out there that do something like this that I might be able to look over? Is it possible to do this without creating a conflict with a similar mod, and if so, what do I need to keep in mind to do so? AddComponentPostInit("component",fn) lets u modify components to not override components you could do AddComponentPostInit("component", function(self) local oldfunction = self.Function--a function in the component u want to replace function self:Function(arg1, arg2) --overriding that function if arg1 == arg2 then--whatever you need to do(this was just an example) return oldfunction(self, arg1, arg2) --and calling the oldfunction end end end) Link to comment Share on other sites More sharing options...
Faintly Macabre Posted May 20, 2016 Author Share Posted May 20, 2016 4 minutes ago, Aquaterion said: AddComponentPostInit("component",fn) lets u modify components to not override components you could do AddComponentPostInit("component", function(self) local oldfunction = self.Function--a function in the component u want to replace function self:Function(arg1, arg2) --overriding that function if arg1 == arg2 then--whatever you need to do(this was just an example) return oldfunction(self, arg1, arg2) --and calling the oldfunction end end end) Awesome. Thanks for the quick response! Link to comment 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