Jump to content

[Help] Make Lucy equippable on other characters


Recommended Posts

I'm trying to create a personal mod to make Woodies axe Lucy equippable on other characters (Wendy in this case). I know it works if I just change the IsValidOwner function in possessedaxe.lua, but I don't want to directly edit game prefabs. How can I overwrite the function in modmain.lua? I tried:

AddPrefabPostInit("possessedaxe", function(inst)

	local function IsValidOwner(inst, owner)
		return owner:HasTag("ghostlyfriend")
	end

end)

but it doesn't do anything. Any help would be appreciated.

Link to comment
Share on other sites

If I remember correctly, "possessedaxe" is a component, not a prefab. That is to say, you need to use "AddComponentPostInit" instead of "AddPrefabPostInit". Additionally, I think there's an extra bit of code involved in overwriting an existing function. I think in the past I've seen people write the code something like this:

AddComponentPostInit("possessedaxe", function(self, inst)

	local old_IsValidOwner = self.IsValidOwner
	self.IsValidOwner = function(inst, owner)
		return owner:HasTag("ghostlyfriend")
	end

end)

Hope this helps!

Link to comment
Share on other sites

Thanks for the help! Sadly it doesn't seem to work, Lucy is still slipping out of my hands.

Since it's a personal mod however, I'm just gonna stick to overwriting the possessedaxe component for now.

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...