Jump to content

Recommended Posts

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?

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)

 

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!

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...