Jump to content

(SOLVED) Checking for and applying items' swaps outside of prefab


Recommended Posts

			local weapon = inst.components.inventory:GetEquippedItem(GLOBAL.EQUIPSLOTS.HANDS)
			if weapon then
				inst.AnimState:OverrideSymbol("swap_object", "swap_"..weapon.prefab, "swap_"..weapon.prefab)
			else
				inst.AnimState:ClearSymbolExchanges()
				inst.AnimState:Hide("ARM_carry")
			end


This causes any skins to be removed from the item and have it just show the basic item, also some items such as the hambat are completely invisible.
I need it so that any skin(s) applied to the item will show up as well as items such as the hambat showing up too.

Edited by Eusong
Link to comment
Share on other sites

I got the idea to put 
 

weapon.components.equippable.onequipfn


BUT what about the client version of the stategraph? replica.equippable doesn't have the onequipfn as far as I can tell.

The client version of the stategraph shown in master post:
 

			local weapon = inst.replica.inventory:GetEquippedItem(GLOBAL.EQUIPSLOTS.HANDS)
			if weapon then
				inst.AnimState:OverrideSymbol("swap_object", "swap_"..weapon.prefab, "swap_"..weapon.prefab)
			else
				inst.AnimState:ClearSymbolExchanges()
				inst.AnimState:Hide("ARM_carry")
			end




EDIT: Turns out I don't need to change the client version of the stategraph except to remove that chunk of code. The master stategraph takes over.

Edited by Eusong
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...