Jump to content

[need help codding] Is it possible to make a custom hat that increases or decreases the maximum amount of a stat as long as you wear it?


Recommended Posts

I wanna make a hat that as long as you wear it, it gives you + 30 max sanity or another one that decreases 30 max sanity as example (also if anybody knows how i can copy the code of one band man or other items so it would do the same thing as it, it would be cool) I would really appreciate if anybody could help.:wilson_vforvictory:

Edited by DeadlyFox

(update) i found where the code for one band man is and only if someone could help me with the hat it would be greatly appreciated!

On 3/8/2025 at 7:21 PM, DeadlyFox said:

(update) i found where the code for one band man is and only if someone could help me with the hat it would be greatly appreciated!

You can add this code when equipping the hat. You can check the wearer's tag to avoid overriding your sanity value on other characters when they equip your hat.
OnEquip
 

	if owner.components.sanity then
		owner.components.sanity.max = TUNING.YOUR_CHARACTER_SANITY + 30
	end

OnUnequip
 

	if owner.components.sanity then
		owner.components.sanity.max = TUNING.YOUR_CHARACTER_SANITY
	end

 

  • Sanity 1

@Haruhi KawaiiDoes it work the same with health instead of sanity?

because i tried to replace sanity with health and it doesn't really work, here is what i wrote:

OnEquip

Quote

    if owner.components.health then
    owner.components.health.max = TUNING.EMILY_HEALTH + 20
    
     end

OnUnequip

Quote

    if owner.components.health then
       owner.components.health.max = TUNING.EMILY_HEALTH
        
    end

 

39 minutes ago, DeadlyFox said:

@Haruhi KawaiiDoes it work the same with health instead of sanity?

because i tried to replace sanity with health and it doesn't really work, here is what i wrote:

OnEquip

OnUnequip

 

I just looked at the health component, it's a bit different
 

	if owner.components.health then
		owner.components.health.maxhealth = TUNING.EMILY_HEALTH + 20
		owner.components.health:ForceUpdateHUD(true)
	end

 

  • Health 1

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