Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entropy : Zero Uprising Episode 2 Health Vial Backpack #223

Merged
merged 1 commit into from
Nov 13, 2023

Conversation

1upD
Copy link

@1upD 1upD commented Oct 12, 2023

This is a feature intended for Entropy : Zero Uprising Episode 2. This pull request for Entropy : Zero 2 is a placeholder until such a time as we decide we want to implement this feature for workshop content or for other Entropy : Zero mods.

Description

The health vial backpack is a feature that allows the player to store health vials they find. With the backpack enabled, contacting a health vial will add it as an ammo type instead of doing the normal interaction. The number of health vials currently in your inventory will be displayed on a new HUD element.

Pressing a key bound to the command "impulse 28" will consume one health vial from the inventory and restore the normal number of hitpoints.

How to use

To use the health vial backpack, you must set the ConVars and make a few configuration changes to display the backpack on the HUD.

ConVars

This pull request adds two ConVars.

sk_healthvial_backpack 0
sk_healthvial_max 0

To use the health vial backpack, set sk_healthvial_backpack to 1. The player may hold health vials up to sk_healthvial_max. Please note that the HUD is only set up to handle a maximum of 8 healthvials.

Key binding to consume health vial

Bind the command "impulse 28" to a key in order to use the "consume health vial" function. Please look at how "impulse 36" is handled in Entropy : Zero 2's configuration files to figure out the best way to set up a binding in the menu. For debug purposes, you can also type bind b "impulse 28" to bind impulse 28 to the B key.

HUD config files

healthvial_backpack_scripts.zip

hudlayout.res

Add the following configurations:

HudHealthVialStatus	[!$DECK]
{
  "fieldName"	"HudHealthVialStatus"
  "visible"	"1"
  "enabled" "1"
  "xpos"	"16"
  "ypos"	"394"
  "wide"	"104"
  "tall"	"32"
  "xpos_default"	"120"
  "wide_default"	"104"
  "HealthVialIconColor"	"255 244 244 160"
  "LastHealthVialColor"	"255 244 244 160"
  "IconInsetX"	"8"
  "IconInsetY"	"4"
  "IconGap"		"24"
  "IconFont"		"HudNumbersSmall"
  
  "PaintBackgroundType"	"2"
}

HudHealthVialStatus	[$DECK]
{
  "fieldName"	"HudHealthVialStatus"
  "visible"	"1"
  "enabled" "1"
  "xpos"	"16"
  "ypos"	"386"
  "wide"	"104"
  "tall"	"32"
  "xpos_default"	"120"
  "wide_default"	"104"
  "HealthVialIconColor"	"255 244 244 160"
  "LastHealthVialColor"	"255 244 244 160"
  "IconInsetX"	"8"
  "IconInsetY"	"4"
  "IconGap"		"24"
  "IconFont"		"HudNumbersSmall_Deck"
  
  "PaintBackgroundType"	"2"
}

hudanimations_ezu.txt

In a hudanimations file, add these events. (You could create new file hudanimations_ezu.txt and add it to the hudanimations_manifest.txt file)

event HealthVialStatusShow
{
	Animate HudHealthVialStatus Alpha	"255" Linear 0.0 0.4
	Animate HudHealthVialStatus		FgColor		"BrightFg"		Linear	0.4		0.1
	Animate HudHealthVialStatus		FgColor		"FgColor"		Linear	0.5		1.6
}

event HealthVialStatusHide
{
	Animate HudHealthVialStatus Alpha	"0" Linear 0.0 0.4
}

event HealthVialAdded
{
	StopEvent	HealthVialConsumed		0.0
	StopEvent	HealthVialDied		0.0
	StopEvent	HealthVialLeft		0.0

	// add in the squad member, brighter then normal color
	Animate HudHealthVialStatus LastHealthVialColor	"255 255 255 255" Linear 0.0 0.1
	Animate HudHealthVialStatus LastHealthVialColor	"255 244 244 160" Linear 0.3 0.3
}

event HealthVialLeft
{
	StopEvent	HealthVialConsumed		0.0
	StopEvent	HealthVialDied		0.0
	StopEvent	HealthVialAdded	0.0

	// fade out the icon
	Animate HudHealthVialStatus LastHealthVialColor	"255 244 244 0"	Linear 0.0 0.5
}

event HealthVialConsumed
{
	StopEvent	HealthVialDied		0.0
	StopEvent	HealthVialAdded	0.0
	StopEvent	HealthVialLeft	0.0

	// Flash orange while fading out the icon
	Animate HudHealthVialStatus	LastHealthVialColor	"255 192 0 255"	Linear 0.0 0.15
	Animate HudHealthVialStatus	LastHealthVialColor	"255 192 0 0"	Linear 0.3 0.15
}

event HealthVialDied
{
	StopEvent	HealthVialAdded	0.0
	StopEvent	HealthVialConsumed		0.0
	StopEvent	HealthVialLeft		0.0

	// flash red, hold, then disappear
	Animate HudHealthVialStatus	LastHealthVialColor	"255 0 0 255"	Linear 0.0 0.5
	Animate HudHealthVialStatus	LastHealthVialColor	"255 0 0 0"		Linear 1.0 1.0
}

// Blixibon couldn't figure out how to do this in code. 1upD never even tried :(
event HealthVialElementSizeOne
{
	Animate HudHealthVialStatus		Wide	"29"	Deaccel	0.0		0.3
}

event HealthVialElementSizeTwo
{
	Animate HudHealthVialStatus		Wide	"53"	Deaccel	0.0		0.3
}

event HealthVialElementSizeThree
{
	Animate HudHealthVialStatus		Wide	"77"	Deaccel	0.0		0.3
}

event HealthVialElementSizeFour
{
	Animate HudHealthVialStatus		Wide	"101"	Deaccel	0.0		0.3
}

event HealthVialElementSizeFive
{
	Animate HudHealthVialStatus		Wide	"125"	Deaccel	0.0		0.3
}

event HealthVialElementSizeSix
{
	Animate HudHealthVialStatus		Wide	"149"	Deaccel	0.0		0.3
}

event HealthVialElementSizeSeven
{
	Animate HudHealthVialStatus		Wide	"173"	Deaccel	0.0		0.3
}

event HealthVialElementSizeEight
{
	Animate HudHealthVialStatus		Wide	"197"	Deaccel	0.0		0.3
}

event HealthVialElementSizeMax
{
	Animate HudHealthVialStatus		FgColor		"255 0 0 128"		Linear	0.0		0.5
	Animate HudHealthVialStatus		FgColor		"FgColor"		Linear	0.5		1.6
}

@1upD 1upD requested a review from Blixibon October 12, 2023 03:28
@1upD 1upD self-assigned this Oct 12, 2023
@entropy-zero entropy-zero deleted a comment from breakdowngamesYT Oct 18, 2023
@1upD 1upD removed the DO NOT MERGE label Nov 9, 2023
@1upD 1upD marked this pull request as ready for review November 9, 2023 05:05
@@ -2978,6 +2978,11 @@ CAmmoDef *GetAmmoDef()
def.AddAmmoType("762mm", DMG_BULLET, TRACER_LINE_AND_WHIZ, "sk_plr_dmg_762mm", "sk_npc_dmg_762mm", "sk_max_762mm", BULLET_IMPULSE(200, 1225), 0 );
#endif

// Uprising
#ifdef EZ
def.AddAmmoType("item_healthvial", DMG_GENERIC, TRACER_NONE, "sk_healthvial", "sk_healthvial", "sk_healthvial_max", 0, 0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems odd to have an ammo type name exactly match an existing classname, but I can't think of any specific case in which it would cause an issue (aside from being confusing)

@@ -113,6 +119,7 @@ void CHealthKit::Precache( void )
m_nSkin = 1;

PrecacheScriptSound( pTouchSounds[ GetEZVariant() ] );
PrecacheScriptSound( "HealthVial.BackpackPickup" );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This precaches whether sv_healthvial_backpack is enabled or not. I'm assuming that's intentional

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, but if it did check sv_healthvial_backpack then the sound wouldn't be cached if the value gets changed at any point after the map has loaded

@1upD 1upD merged commit b507c8a into entropy-zero:ez2/mapbase Nov 13, 2023
5 checks passed
@1upD 1upD deleted the ezu2/health-vial-backpack branch November 13, 2023 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants