fergfunk22
New Member
Since I couldn't find a thread about self-administered blood bags I was wondering if anyone could help me out on that.
Any scripts out there?
Thanks.
Any scripts out there?
Thanks.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
call compile preprocessFileLineNumbers "custom\compiles.sqf"; //Compile custom compiles
fnc_usec_selfActions = compile preprocessFileLineNumbers "custom\fn_selfActions.sqf"; // fnc_usec_selfActions - adds custom actions to dayz code
// Script writen by Krixes
// Infection chance and comments added by Player2
// Version 1.1
//
player removeAction s_player_selfBloodbag; //remove the action from users scroll menu
player playActionNow "Medic"; //play bloodbag animation
sleep 5; //wait 5 seconds for animation to finish
player removeMagazine "ItemBloodbag"; //remove the used bloodbag from inventory
r_player_blood = r_player_bloodTotal; //set their blood to the maximum allowed
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_bloodTotal,true]; //set their blood back up to maximum again
cutText [format["You have used a bloodbag on yourself!"], "PLAIN DOWN"]; //display text at bottom center of screen
if (random 10 < 1) then { //10% chance
r_player_infected = true; //set players client to show infection
player setVariable["USEC_infected",true,true]; //tell the server the player is infected
};
if (isServer) then { //if running on server
player setVariable["medForceUpdate",true]; //force the server to update the players medical status
};
if (isServer) then { //if running on server
player setVariable["medForceUpdate",true]; //force the server to update the players medical status
};
I recommend to relook into that script ....
couple of points:
Code:if (isServer) then { //if running on server player setVariable["medForceUpdate",true]; //force the server to update the players medical status };
This one is absolutely useless. There is no player variable on the server.
cheers
Sarge
Thanks for posting this! Saves me from googling all over the place!
One thing I thought was missing from this is a chance of infection when using the bloodbag, since giving yourself a transfusion in the middle of a disease ridden apocalypse would be one hell of a risk...
Anyway, here is a modified version of your 'player_selfbloodbag' script that includes a %10 chance of infection, and comments; for no reason other than I was very bored.
Ooooh, I see. I thought that _unit = player at the moment in time.Well,
actually in the dayz code it's
Code:if (isServer) then { _unit setVariable["medForceUpdate",true]; };
and this is a major difference![]()
_array = _this; //_this select 0;
_unit = _array select 0;
What happens here is a script that runs on both the server and the client, reacting on a publicvariabled Array.
.... ect, ect
hope that explains a bit,
Sarge
Ok that's good. I am glad that it really doesn't hurt anything. But definitely needs to be removed since it serves no purpose lmao.nope, no worries. player if called on the server is a nul object.
I see, thank's again for explaining that to me and looking forward to seeing more scripts from you.Giving up on what ?
Nah, it is intended that my AI has no backpacks atm. There were more important things to implement![]()
fnc_usec_selfActions = compile preprocessFileLineNumbers "dayz_code\compile\fn_selfActions.sqf"; //Checks which actions for self
// ---------------------------------------Krixes Self Bloodbag Start------------------------------------
_mags = magazines player;
// Krixes Self Bloodbag
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;
};
// ---------------------------------------Krixes Self Bloodbag End------------------------------------
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);