[Release] Bloody screen (v1.3)

This visual modification aims to give feedback when taking damage or beeing shot at aside from the health bar. The players screen will turn red on any damage impact if so configured and is scaled with the severity of the damage or the current health relative to the maximum health depending on the enabled features.

This script is highly configurable:

-------------------------------------------------------------------------------------------------------------
	--CONFIG--
-------------------------------------------------------------------------------------------------------------
config = {}

	--Pulsating screeneffect as a permanent health indicator:
	config.activatepulsatingindicator = true
	
	--Accute health indicator:
	config.activateaccutehealthindicator = true
	
	--Static screeneffect as a permanent health indicator:
	config.activatestatichealthindicator = true
	
	--Timecycle modifier to use for screen effect:
	--	https://pastebin.com/kVPwMemE
	config.tcmEffect = "damage"
	
	--The timecycle modifier index to check for:
	--	First set the config.tcmEffect then start the resource
	--	and read the index from the client console and insert it here.
	config.tcmIndex = 58

	--Maximum effect strength:
	config.maxeffectstrength = 0.9
	

-------------------------------------------------------------------------------------------------------------
	--STATIC HEALTH INDICATOR
-------------------------------------------------------------------------------------------------------------
	
	--At what percantage of health (minus deadhealth*) should the static effect start? (0.0 - 1.0):
	config.percentagestaticeffecthealthfraction = 1.0
	
	--Effect strength multiplier for static health indicator:
	config.staticindicatorstrengthmultiplier = 0.3
	
	
-------------------------------------------------------------------------------------------------------------
	--ACCUTE / IMPACT DAMAGE INDICATOR
-------------------------------------------------------------------------------------------------------------
	
	--At what percantage of health (minus deadhealth*) should impact effects start? (0.0 - 1.0):
	config.percentageimpacteffecthealthfraction = 1.0
	
	--Adds a screeneffect ontop of the bloody edges.
	config.impacteffectboosteffect = false
	
	--Effect strength multiplier for damage impacts:
	config.impacteffectstrengthmultiplier = 14.0

	--Value between 0.0 and 1.0 for how fast the screen effect fades away after a damage impact:
	config.accutedamagerecoveryrate = 0.02


-------------------------------------------------------------------------------------------------------------
	--PULSATING SCREENEFFECT
-------------------------------------------------------------------------------------------------------------

	--At what percantage of health (minus deadhealth*) should the pulsating effect start? (0.0 - 1.0):
	config.percentagepulsatingeffecthealthfraction = 0.49
	
	--Adds a screeneffect ontop of the bloody edges:
	config.pulsatingboosteffect = true
	
	-- At what percentage the screeneffect starts playing:
	config.effectthreshold = 0.3
	
	--Variable interval for pulse indicator depending on health. (lower value -> faster):
	config.minpulseinterval = 30
	config.maxpulseinterval = 133

	--Effect strength multiplier for pulsating effect:
	config.pulsatingmultiplier = 0.3
	
	--Heartbeat audio when screen is pulsating:
	config.pulsatingheartbeataudio = true
	
	--Heartbeat volume:
	config.pulsatingheartbeatvolume = 0.8
	
	--Pulse recovery rate multiplier:
	config.pulserecoveryratemultiplier = 1.5
	
	
-- *: Players usally die at a health below 100, not 0. That value is subtracted in the code to get a better relative 
--    value towards the maximum health.


-------------------------------------------------------------------------------------------------------------
	--END CONFIG--
-------------------------------------------------------------------------------------------------------------
config.initialized = true

The default values are tested to represent the player status as accurate as possible. Getting shot at f.e. will deliver a noticeable “punch” and getting hit with high damage weapons like a shotgun will almost always turn the entire screen red.

I highly recommend combining this with negbooks CStyle Damage Indicator.

Demonstration videos:

demo: v1.0

demo: v0.9

Download links:

Changelog v1.3:

  • Added the option to change the main screen effect.

  • Added some presets for the config file.

  • Fixed the main screen effect not working in first person for the default setting.

Changelog v1.2:

  • Added an optional secondary screen and audio effect (“RaceBoost”) with configurable health threshold.

  • Added a configurable heartbeat soundeffect with dynamic playback speed and volume.

  • Adjusted default values for the config.

  • Fixed instances of effects playing when dead or afterwards.

Changelog v1.1:

  • Added option to all features to use the effect only below a certain health percentage.

  • Fixed issue where effect may still be applied despite other resources trying to apply effects.

Changelog v1.0:

  • Added an option to turn off/on the impact indicator.

  • Added a static health indicator.

  • Adjusted default values to account for added variables.

  • Fixed issue where script would stop working on resource restart without rejoining the server.

Changelog v0.95:

  • Seperated code through multithreading.

  • Added a buffer for when sustaining constant damage to make transitions smoother (f.e. while beeing on fire).

  • Improved compatibility by not applying screen effects when another resource is using the same function:

  SetTimecycleModifier(
  	  modifierName --[[ string ]]
   )

Known issues:

  • None.

To-do list:

  • Fixing issues. (Leave a comment if you encounter any!)
13 Likes

Any preview like screenshots or a video?

4 Likes

Comming up…

Looks good

I love this, but cannot use it. so sad. 2 reasons
reason 1. if i have this script running the drugs from esx_drugs wont show their screen effects
people would rather get high and drunk (effects) than the bloody, its either/or
reason 2. on my server, and i think default esx_ambulance job has it set up where you will auto heal back to 50% then youll want to go to the hospital to get back up to 100%
the screen does not stop pulsating at 50% I wish it would stabilize and fade away at 50%. our server is low pop and lot of the crims run around at 50% so having it constantly flashing at 50% is a bummer, ( even though they can lay in hospital beds to heal to 100% if there are no EMS online)

Thanks again for all the hard work, this is an amazing piece of art. I would love to see some updates but its perfect either way!

thanks again!! you rock!

Thanks for your feedback! If you send me the links to the scripts you’re using that interfere with mine then maybe I could work out some compatibility. I will add a health cap to when the pulsating effect is used.

Changelog v0.95:

  • Seperated code through multithreading.

  • Added a buffer for when sustaining constant damage to make transitions smoother (f.e. while beeing on fire).

  • Improved compatibility by not applying screen effects when another resource is using the same function:

SetTimecycleModifier(
modifierName --[[ string ]]
)

Changelog v1.0:

  • Added an option to turn off/on the impact indicator.

  • Added a static health indicator…

  • Adjusted default values to account for added variables.

  • Fixed issue where script would stop working on resource restart without rejoining the server.

can I adjust the value somewhere so that the effect only starts at 70% life?

You can adjust that for the pulsating screen effect. For the static effect you can simply turn down the effect multiplier and it will achieve the same effect.

Neat :ok_hand:

is there a solution to prevent other effects such as being drunk and not suppressed? because we would like to use the script but it completely eliminates other effects

Are you using the 1.0 version? If other effects are used then it should turn off.

yes have the current version on it so 1.0 but all other effects are still suppressed tomorrow I will go through the order and delete the cache and see if that brings what

you done it. I think its perfect, drug effects are working too, thanks for looking at it. one question. what setting in config needs to be tweaked I noticed that if the screen is full red and you get to a quite place the red fades( which is awesome) at about 50% health it might fade away 95% or something there is still a small red area around the screen ( would like for it to totally go away) I’ll double check with my players they might like it that way. thanks again for your hard work

it might be this one right? --Effect strength multiplier for static health indicator:
config.staticindicatorstrengthmultiplier = 0.32

this is when there is no action no dmg actively happening? if this was set to 0.1 or something the screen would almost totally go back to normal after a period of no combat/dmg?

This has been mentioned before. I will add a health cap similar to the pulse effect so you can adjust when all effects start.

I might have found the issue. I will add the fix in the next update maybe still today.

1 Like

Changelog v1.1:

  • Added option to all features to use the effect only below a certain health percentage.

  • Fixed issue where effect may still be applied despite other resources trying to apply effects.

don’t know if this will help or not. using drugs after being hurt prevents the drug effect, after this 1.1 update. is there a setting that i need to tweak?