Jump to content

Recommended Posts

Hello all,

I'm trying to create a new widget to show when a character is in the 'rage' state. It activates fine, but the inside is offset by a lot (see the attached picture). Then when it deactivates, the widget is still there despite it being killed by the character prefab file. Any thoughts on why this is happening?

Here's the character's rage function that should hide the widget:

local function LoseRage(inst)
	inst:PushEvent("transform_normal")
	inst:RemoveTag("raging")
	inst.AnimState:SetBuild("normal")

	inst.components.talker:Say("That was exhausting.")

    inst.components.combat.damagemultiplier = 1.1
	inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED

	inst.components.hunger:Resume()
	inst.components.sanity.ignore = false
	inst.components.health.absorb = 0

	inst.components.sanity:DoDelta(-TUNING.SANITY_MEDLARGE)
	inst.components.rage:StopDrainEffect()
	GetSeasonManager():StopPrecip()
	
	if inst.HUD then
		if inst.HUD.ragemeter then
			print('removing rage hud')
			inst.HUD.controls.ragemeter:Deactivate()
			inst.HUD.controls.ragemeter:Kill()
			inst.HUD.controls.ragemeter = nil
		end

		inst.HUD.controls.crafttabs:Show()
		inst.HUD.controls.mapcontrols.minimapBtn:Show()

	end
end

 

widget.png

rage_meter.lua rage_meter.zip

I had this problem long ago when I made my anger meter for my character mod. Now, the issue I had was because I ripped the asset from the game's files. Instead, my friend and I had to completely create a new widget meter asset. You can use my old asset for the meter if that's your problem. (You'll just have to change all the assets and etc. Also, make sure to change the name in Spriter from "irritation" to whatever you've named your widget.)


irritation.zip

Also, for the widget not disappearing. I'm not sure why that happens. It could be the anim, but it could also be a code thing. My character doesn't have a meter that disappears, but rather it stays on screen since it's his whole motif. Sorry about that.

Ok, this is the last time I'll have to edit this, but I also discovered that my animations don't have the "close_90s" and "open_90s". You can easily add those back in by writing a new animation for the file with recreating the frames and size displacement. It can be a bit finicky, but it should work for it. 

Edited by Cagealicous
  • Like 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...