Jump to content
  • 0

Self Bloodbag Script 1.0.4.1


welshviper

Question

Recommended Posts

  • 0

Krixes Self BloodBag for Epoch

 

Requirements-

Notepad ++

some type of PBO manager

 

Steps:

1. Download this Self BloodBag file and save it for later

https://www.dropbox.com/s/vk8aou6lvjnjn2c/player_selfbloodbag.sqf

 

2. Unpack your MISSION pbo, create a folder in the root called "Custom" .. Paste that file above inside that folder.

 

3. Locate your Arma 2 OA directory then go to @DayZ_Epoch folder.

 

4. Unpack the DayZ_Code file from your addons folder and find this file "fn_selfactions" (compile folder) 

 

5. Paste both of these files into the Custom Folder you created earlier

 

6. Create a file called "compiles.sqf" and inside of it paste just this one line

fnc_usec_selfActions = compile preprocessFileLineNumbers "custom\fn_selfActions.sqf";

7. Open up the "fn_selfActions" file that you pasted into the Custom folder earlier. Under this line

_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);

(around line 16)

 

paste this:

//-----------------------------------------SELF BB START-----------------------------------------
	_mags = magazines player;
    if ("ItemBloodbag" in _mags) then {
        hasBagItem = true;
    } else { hasBagItem = false;};
    if((speed player <= 1) && hasBagItem && _canDo) then {
        if (s_player_selfBloodbag < 0) then {
            s_player_selfBloodbag = player addaction[("<t color=""#c70000"">" + ("Self Bloodbag") +"</t>"),"custom\player_selfbloodbag.sqf","",5,false,true,"", ""];
        };
    } else {
        player removeAction s_player_selfBloodbag;
        s_player_selfBloodbag = -1;


    };
// -----------------------------------------SELF BB END--------------------------------------------

8. go to your root folder into your "init.sqf" and find this line:

progressLoadingScreen 1.0;

paste this line under it

call compile preprocessFileLineNumbers "custom\compiles.sqf"; //Compile custom compiles

so it looks like:

progressLoadingScreen 1.0;
call compile preprocessFileLineNumbers "custom\compiles.sqf"; //Compile custom compiles

After this you should be done! Just check out the player_selfbloodbag file and you can edit the settings to your liking. 

Link to comment
Share on other sites

  • 0

Selfbloodbag restrictions : working with Epoch [GAZ_Vodnik_MedEvac , Land_A_Hospital]

//////////////////////////////////////////////////////////////////////////////////////////////
//    Script writen by Krixes																	//
//    Infection chance and some comments added by Player2									//
//    Combat check added by istealth														//
//																							//
//	Version 1.4																				//
//																							//
// Change Log:																			    //
// 1: Added bloodbag use timer																//
// 2: Added a timer for the amount of time before player can use self bloodbag again		//
//////////////////////////////////////////////////////////////////////////////////////////////

//private ["_bloodAmount","_humanityBool","_infectionChance","_humanityNegBool","_humanityNegAmount","_humanityAmount","_infectedLifeLost","_infectedLifeBool","_lastBloodbag","_bloodbagLastUsedTime","_bloodbagTime","_bloodbagUseTime","_bloodbagUsageTime","_incombat","_timeout"];
private ["_bloodAmount","_humanityBool","_infectionChance","_humanityNegBool","_humanityNegAmount","_humanityAmount","_infectedLifeLost","_infectedLifeBool","_lastBloodbag","_bloodbagLastUsedTime","_bloodbagTime","_bloodbagUseTime","_bloodbagUsageTime","_HospitalDistance","_AmbulanceDistance","_Bloodmultiplier","_Infectionmultiplier","_Hospital_enable","_Ambulance_enable","_Anywhere_enable","_nearHospital","_playerASL1","_playerASLx","_playerASLy","_playerASLz","_playerASLz2","_playerASL2","_decke","_Hospitalfound","_Ambulancefound","_bloodAmount","_infectionChance"]; 


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Config Start-----------------------------------------------------------------------------------------------------------------------//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

_bloodAmount = 4000; // Amount of blood to give to player
_bloodbagUseTime = 20; // Amount of time it takes in second for the player to use the self bloodbag
_bloodbagLastUsedTime = 60; // Amount of time in seconds before player can use self bloodbag again after a succesful use

_infectionChance = 10; // Percent chance of player infection on self bloodbag (10 = 10% | 2 = 50% | 1 = 100%)
_infectedLifeBool = true; // Whether the player can loose life if infected (True = On | False = off)
_infectedLifeLost = 1000; // Amount of life to loose in becomes infected

_humanityBool = true; // Whether the player can get humanity from giving self a bloodbag (True = On | False = off)
_humanityAmount = 50; // Amount of humanity to give player if _humanityBool is true (250 is default for normal bloodbags)

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Config End-------------------------------------------------------------------------------------------------------------------------//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
_HospitalDistance = 21; //Max distancewithin Hospital
_AmbulanceDistance = 5; // Max. Distance to get Ambulancebonus
_Bloodmultiplier = 1; // Blood amount multiplier (1 if not in Hospital or near Ambulance, 1.5 if near an Ambulance, 2 if near a Hospital, The Multiplier for Ambulance and Hospital get set later)
_Infectionmultiplier = 0.5; // Multiplier for infectionchance if in Hospital 0.5, 0.75 for an Ambulance, 1 if not in a Hospital (The higher the Value the lower the chance to get infected (it must never get 0 because of division by 0)
_Hospital_enable = 1; // 1 enables SelfBloodbag in Hospitals
_Ambulance_enable = 1; // 1 enables SelfBloodbag near Ambulances
_Anywhere_enable = 0; // 1 enables SelfBloodBag anywhere; (Turns automatically on if _Hospital_enable = 0 and _Ambulance_enable = 0;)
 
_nearHospital = false;
if ((_Hospital_enable == 0) && (_Ambulance_enable == 0)) then { // Check if _Hospital_enable & _Ambulance_enable disabled
    _Anywhere_enable = 1;
    };
if (_Anywhere_enable == 1) then {
        _nearHospital = true;
}; 
if (_Hospital_enable == 1)  then { // if Hospital enabled
        _playerASL1 = getPosASL player;
        _playerASLx = _playerASL1  select 0;
        _playerASLy = _playerASL1  select 1;
        _playerASLz = _playerASL1  select 2;
        _playerASLz2 = _playerASLz + 40;
        _playerASL2 = [_playerASLx,_playerASLy,_playerASLz2];
        _decke = lineIntersects[_playerASL1,_playerASL2]; //überprüft ob sich zwischen dem Player und (Player+40m höhe) ein Objekt befindet (benötigt unbedingt ASL Koordinaten)
        _Hospitalfound = count nearestObjects[player,["Land_A_Hospital"],_HospitalDistance]; // check if near Hospital
        if ((_Hospitalfound > 0) && _decke) then {
                _nearHospital = true;
                _Bloodmultiplier = 2; // multiplier to Bloodamount
                _Infectionmultiplier = 0.5; //multiplier to Infectionchance
            };
    }; 
if (_Ambulance_enable == 1)  then {
        _Ambulancefound = count nearestObjects[player,["GAZ_Vodnik_MedEvac"],_AmbulanceDistance]; // check if near Vodnik
        if (_Ambulancefound > 0 ) then {
                _nearHospital = true;
                _Bloodmultiplier = 0.75;
            }; 
    };
_bloodAmount = _bloodAmount * _Bloodmultiplier; // Calculate bloodamount & Infectionchance with the multiplier
_infectionChance = _infectionChance / _Infectionmultiplier;
 
if(!_nearHospital) exitWith { // Abort messegas if Conditions not met
        if ((_Hospital_enable == 1) && (_Ambulance_enable == 0)) then {
            cutText [format["You need to be inside a Hospital to do this !!!"], "PLAIN DOWN"];
        };
        if ((_Hospital_enable == 0) && (_Ambulance_enable == 1)) then {
            cutText [format["You need to be near an Ambulance to do this !!!"], "PLAIN DOWN"];
        };
        if ((_Hospital_enable == 1) && (_Ambulance_enable == 1)) then {
            cutText [format["You need to be near a Hospital or an Ambulance to do this !!!"], "PLAIN DOWN"];
        };
};

///////////////////////////////////////////////////////////////////////////////
// Everything below need not be modified unless you know what you are doing! //
///////////////////////////////////////////////////////////////////////////////

_bloodbagTime = time - lastBloodbag; // Variable used for easy reference in determining the self bloodbag cooldown
_bloodbagUsageTime = time;
_timeout = player getVariable["combattimeout", 0];
_inCombat = if (_timeout >= diag_tickTime) then { true } else { false };

if(_bloodbagTime < _bloodbagLastUsedTime) exitWith { // If cooldown is not done then exit script
	cutText [format["You may to wait a while,you faggot^^ %1!",(_bloodbagTime - _bloodbagLastUsedTime)], "PLAIN DOWN"]; //display text at bottom center of screen when players cooldown is not done
};

if (_inCombat) then { // Check if in combat
    cutText [format["You are in Combat and cannot give yourself a Bloodbag"], "PLAIN DOWN"]; //display text at bottom center of screen when in combat
} else {

	player removeAction s_player_selfBloodbag; //remove the action from users scroll menu
	
	player playActionNow "Medic"; //play bloodbag animation
	
	////////////////////////////////////////////////
	// Fancy cancel if interrupted addition start //
	////////////////////////////////////////////////
	r_interrupt = false; // public interuppt variable
	_animState = animationState player; // get the animation state of the player
	r_doLoop = true; // while true sets whether to continue self bloodbagging
	_started = false; // this starts as false as a check
	_finished = false; // this starts as false and when true later sets players blood
	while {r_doLoop} do {
		_animState = animationState player; // keep checking to make sure player is in correct animation
		_isMedic = ["medic",_animState] call fnc_inString; // checking to make sure the animstate is the medic animation still
		if (_isMedic) then {
			_started = true; // this is a check to make sure everything is still ok
		};
		if(!_isMedic && !r_interrupt && (time - _bloodbagUsageTime) < _bloodbagUseTime) then {
			player playActionNow "Medic"; //play bloodbag animation
			_isMedic = true;
		};
		if (_started && !_isMedic && (time - _bloodbagUsageTime) > _bloodbagUseTime) then {
			r_doLoop = false; // turns off the loop
			_finished = true; // set finished to true to finish the self bloodbag and give player health/humanity
			lastBloodbag = time; // the last self bloodbag time
		};
		if (r_interrupt) then {
			r_doLoop = false; // if interuppted turns loop off early so _finished is never true
		};
		sleep 0.1;
	};
	r_doLoop = false; // make sure loop is off on successful self bloodbag
	///////////////////////////////////////////////
	// Fancy cancel if interrupted addition end //
	//////////////////////////////////////////////

	if (_finished) then {
		player removeMagazine "ItemBloodbag"; //remove the used bloodbag from inventory

		r_player_blood = r_player_blood + _bloodAmount; //set players LOCAL blood to a certain ammount
		
		if(r_player_blood > 12000) then {
			r_player_blood = 12000; // If players blood is greater then max amount allowed set it to max allowed (this check keeps an error at bay)
		};
		
		// check if infected
		if (random(_infectionChance) < 1) then {
			r_player_infected = true; //set players client to show infection
			player setVariable["USEC_infected",true,true]; //tell the server the player is infected
			cutText [format["You have used a bloodbag on yourself but the bloodbag was infected!"], "PLAIN DOWN"]; //display text at bottom center of screen if infected
			
			// check for if loosing life on infection is turned on
			if(_infectedLifeBool) then {
				r_player_blood = r_player_blood - _infectedLifeLost; //set players LOCAL blood to a certain ammount
				player setVariable["USEC_BloodQty",r_player_blood,true]; //save this blood ammount to the database
			} else { // if loosing life is turned off
				r_player_lowblood = false; //set lowblood setting to false
				10 fadeSound 1; //slowly fade their volume back to maximum
				"dynamicBlur" ppEffectAdjust [0]; "dynamicBlur" ppEffectCommit 5; //disable post processing blur effect
				"colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, 1],  [1, 1, 1, 1]];"colorCorrections" ppEffectCommit 5; //give them their colour back
				r_player_lowblood = false; //just double checking their blood isnt low
				player setVariable["USEC_BloodQty",r_player_blood,true]; //save this blood ammount to the database
			};
		} else { // if not infected
			r_player_lowblood = false; //set lowblood setting to false
			10 fadeSound 1; //slowly fade their volume back to maximum
			"dynamicBlur" ppEffectAdjust [0]; "dynamicBlur" ppEffectCommit 5; //disable post processing blur effect
			"colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, 1],  [1, 1, 1, 1]];"colorCorrections" ppEffectCommit 5; //give them their colour back
			r_player_lowblood = false; //just double checking their blood isnt low
			player setVariable["USEC_BloodQty",r_player_blood,true]; //save this blood ammount to the database
	 
			cutText [format["OMG u used a bloodbag on your own,your good to go!"], "PLAIN DOWN"]; //display text at bottom center of screen on succesful self bloodbag
		};
		
		// check if giving player humanity is on
		if(_humanityBool) then {
			[player,_humanityAmount] call player_humanityChange; // Set players humanity based on amount listed in config area
		};
	} else {
		// this is for handling if interrupted
		r_interrupt = false;
		player switchMove "";
		player playActionNow "stop";
		cutText [format["Mission Bloodbag yourself ,aborted!"], "PLAIN DOWN"]; //display text at bottom center of screen on interrupt
	};
};

http://opendayz.net/threads/restrict-krixes-selfbloodbag-only-to-a-special-location.10440/

Link to comment
Share on other sites

  • 0

I was going to use that but unfortunately the first step I cant even do heh. I do not have those 3 files anywhere in my pbos :( Epoch 1.0.4.1

They're client side files you have to call server side, same way you do the self actions :)

Anything that is dayz_code is your client files

Link to comment
Share on other sites

  • 0

My fn selfactions are in my mission pbo. I dont have a folder called dayz_code. Would I ned dedicated for that?

 

dayz_code.pbo is part of the Epoch client install. It's in the DayZ_Epoch folder. Unpack it, and in one of the folders you'll find the 1.0.4.1 version of fn_selfActions.sqf.

Link to comment
Share on other sites

  • 0

Krixes Self BloodBag for Epoch

 

Requirements-

Notepad ++

some type of PBO manager

 

Steps:

1. Download this Self BloodBag file and save it for later

https://www.dropbox.com/s/vk8aou6lvjnjn2c/player_selfbloodbag.sqf

 

2. Unpack your MISSION pbo, create a folder in the root called "Custom" .. Paste that file above inside that folder.

 

3. Locate your Arma 2 OA directory then go to @DayZ_Epoch folder.

 

4. Unpack the DayZ_Code file from your addons folder and find this file "fn_selfactions" (compile folder) 

 

5. Paste both of these files into the Custom Folder you created earlier

 

6. Create a file called "compiles.sqf" and inside of it paste just this one line

fnc_usec_selfActions = compile preprocessFileLineNumbers "custom\fn_selfActions.sqf";

7. Open up the "fn_selfActions" file that you pasted into the Custom folder earlier. Under this line

_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);

(around line 16)

 

paste this:

//-----------------------------------------SELF BB START-----------------------------------------
	_mags = magazines player;
    if ("ItemBloodbag" in _mags) then {
        hasBagItem = true;
    } else { hasBagItem = false;};
    if((speed player <= 1) && hasBagItem && _canDo) then {
        if (s_player_selfBloodbag < 0) then {
            s_player_selfBloodbag = player addaction[("<t color=""#c70000"">" + ("Self Bloodbag") +"</t>"),"custom\player_selfbloodbag.sqf","",5,false,true,"", ""];
        };
    } else {
        player removeAction s_player_selfBloodbag;
        s_player_selfBloodbag = -1;


    };
// -----------------------------------------SELF BB END--------------------------------------------

8. go to your root folder into your "init.sqf" and find this line:

progressLoadingScreen 1.0;

paste this line under it

call compile preprocessFileLineNumbers "custom\compiles.sqf"; //Compile custom compiles

so it looks like:

progressLoadingScreen 1.0;
call compile preprocessFileLineNumbers "custom\compiles.sqf"; //Compile custom compiles

After this you should be done! Just check out the player_selfbloodbag file and you can edit the settings to your liking. 

Nice guide! It worked for me!

Link to comment
Share on other sites

  • 0

Wanna skip getting fn_selfActions? put this in your init:

if (!isDedicated) do {
    s_player_selfBloodbag = -1;
	while {true} do {

	//-----------------------------------------SELF BB START-----------------------------------------
	private ["_canDo","_onLadder","_mags", "_hasBagItem"];
	_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
	_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);

	_mags = magazines player;
    if ("ItemBloodbag" in _mags) then {
        _hasBagItem = true;
    } else { _hasBagItem = false;};
    if((speed player <= 1) && _hasBagItem && _canDo) then {
        if (s_player_selfBloodbag < 0) then {
            s_player_selfBloodbag = player addaction[("<t color=""#c70000"">" + ("Self Bloodbag") +"</t>"),"custom\player_selfbloodbag.sqf","",5,false,true,"", ""];
        };
    } else {
        player removeAction s_player_selfBloodbag;
        s_player_selfBloodbag = -1;


    };

	// -----------------------------------------SELF BB END--------------------------------------------
};
};

I dont know why hasBagItem has to be global (didnt check the blood bag script itself), and there were some undeclared vars. I didnt test this script but i think it should work

Link to comment
Share on other sites

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
  • Advertisement
  • Discord

×
×
  • Create New...