Jump to content

New widget: inside color is offset / doesn't disappear when killed


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

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...