Jump to content
scottb613

SCO SP Heal Self (Catch 22) Script

Recommended Posts

Hi Folks,

 

I'm not sure if this only affects SOG - however - when the player is injured - often applying a First Aid Kit (FAK) doesn't heal you all the way. Since the damage is < 25% you can't use another FAK to heal that last little bit - you're left listening to your player chronically gasp and moan from the injury - hence the Catch 22. This script - heals that last 25% and only the last 25% so you no longer need to listen to the moans and groans. I had started to put the "treating self" animation in - but if you just got done doing that with a FAK - I thought it better not to do it again. It's intended use is via the addAction menu.

 

  • // GIVEN: Displays "HEALTHY" when player health is 100%.
  • // GIVEN: Heals player fully if damage is less than or equal to 25% - after First Aid Kit use.
  • // GIVEN: Displays "---TREATING---" during the healing process.
  • // GIVEN: Displays "HEALTH TOO LOW" when player health is below 75%.

 

 

FULL SCRIPT:

Spoiler

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

// FILE NAME: SCOhealSelf.sqf
// ARGS: None (The script operates based on the player's health status).
// AUTHOR: Scottb613

// OVERVIEW: Handles player self-healing based on current damage status. If health is above 75%, 
//           the script heals the player to full health and provides appropriate visual feedback. 
//           If health is lower than 75%, it displays a warning message to indicate critical health.

// REQUIRES: None. Script is self-contained and only requires execution on the player.

// SUGGESTION: Add this to an "initPlayer.sqf" script:
//  this addAction ["<t color='#00FFFF'>Heal Self</t>", "SCOhealSelf.sqf", "nil", 1.5, true, true, "", "true", 3];

// NOTE: Tested in SP only.

// GIVEN: Displays "HEALTHY" when player health is 100%.
// GIVEN: Heals player fully if damage is below or equal to 25% after First Aid Kit use.
// GIVEN: Displays "---TREATING---" during the healing process.
// GIVEN: Displays "HEALTH TOO LOW" when player health is below 75%.

// DISCLAIMER: This script only handles health status and self-healing; it does not affect weapons, animations, 
//             or other player attributes beyond health restoration.

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

private _bye = 0;
private _hpDam = damage player;

// Display "All Good" if player's health is at 100%
if (_hpDam == 0) then {
    hint parseText "<t size='1.25' color='#98FB98'>HEALTHY</t>"; // Pastel green for 'All Good'
    _bye = 1;
};
if (_bye == 1) exitWith {};

// Test to see if player damage is 75% or better - post First Aid Kit use
if (_hpDam <= 0.25) then {
    player setDamage 0;
    hint parseText "<t size='1.25' color='#ADD8E6'>---TREATING---</t>"; // Pastel blue for 'Healed'
    //[player, "KNEEL_TREAT"] call BIS_fnc_ambientAnim;
    sleep 5; // Adjust the delay as needed
    //player call BIS_fnc_ambientAnim__terminate;
    hint parseText "<t size='1.25' color='#98FB98'>HEALTHY</t>"; // Pastel green for 'All Good'
    _bye = 1;
};
if (_bye == 1) exitWith {};

// Display message if player's health is above 25% but not fully healed
if (_hpDam > 0.25) then {
    hint parseText format ["<t size='1.25' color='#FFB6C1'>HEALTH TOO LOW</t>"]; // Pastel red for 'Health - TOO LOW'
};

 

 

Regards,
Scott  

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
40 minutes ago, major-stiffy said:

I love it. Does it work in MP hosted?

 

Hi...

 

Thanks.

😊

 

I've never played multiplayer - but all the variables are private - I would think it would probably work - it's a pretty simple script.

 

Regards,
Scott

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×