Self Blood Bag

Hi, im trying to add a cooldown and not be available to use in combat but anything i add seems to break it.

In combat:

if (player getVariable["combattimeout", 0] >= time) then {
hintSilent "You can't bloodbag yourself in combat!";
} else {

Tried adding to start of player_selfbloodbag.sqf but breaks. As for the cooldown adding sleep 300; didnt seem to work.
 
To change the infection chance, just change the 10 to xx?

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
};
 
To change the infection chance, just change the 10 to xx?

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
};

yes. random 3 = 33% chance, random 2 = 50% chance
 
Hi, im trying to add a cooldown and not be available to use in combat but anything i add seems to break it.

In combat:

if (player getVariable["combattimeout", 0] >= time) then {
hintSilent "You can't bloodbag yourself in combat!";
} else {

Tried adding to start of player_selfbloodbag.sqf but breaks. As for the cooldown adding sleep 300; didnt seem to work.
i did this and it works fine in my server no problem

Code:
// Script writen by Krixes
//    Infection chance and comments added by Player2
//    Version 1.1
//
    if ((dayz_combat == 1)) then {
        cutText [format["You are in Combat cannot give yourself a Bloodbag"], "PLAIN DOWN"];    //display text at bottom center of screen
    } else {
    
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
};
};
 
Im not sure what the problem is but i tried the above script too and again it breaks. I still get the menu option to use bloodbag but clicking it does nothing. Im guessing that i have many other scripts running there may be conflicts?
 
Is there anyway to make this only give like 3-4k blood? etc
Without any real knowledge, just common sense I would expect that changing this value would change how much blood it gives you?
Code:
r_player_blood = r_player_bloodTotal;            //set their blood to the maximum allowed

Not sure what kind of value it would take though, since you're adding blood to their current amount of blood.
Maybe r_player_blood = r_player_blood + 4000; (not sure how SQF syntax would form that)

** Just had another look over the code and further down it has this:
Code:
player setVariable["USEC_BloodQty",r_player_bloodTotal,true];    //set their blood back up to maximum again
So you'll need to reflect the same value set here that you've changed their blood level to.

Another possibility to self-bloodbagging, much like infection, could be that it removes blood? Like a botched transfusion attempt? Could lose 1k-2k blood this way?
 
Without any real knowledge, just common sense I would expect that changing this value would change how much blood it gives you?
Code:
r_player_blood = r_player_bloodTotal;            //set their blood to the maximum allowed

Not sure what kind of value it would take though, since you're adding blood to their current amount of blood.
Maybe r_player_blood = r_player_blood + 4000; (not sure how SQF syntax would form that)

Yeah i thought that to
 
I have no background of SQF syntax or coding so I wouldn't know how to do it correctly, although surely you could take the code from the random infection and add that on before the amount of blood has been 'added' and change it so if the chance of a botched transfusion is flagged then it would remove blood, if not, it would add the normal amount or potentially a random amount (possibly both ways, randomly lose or add blood)
 
Code:
r_player_blood =        12000;
r_player_lowblood =    false;
r_player_timeout =        0;
r_player_bloodTotal =    r_player_blood;

defines the value in \dayz_code\init\variables.sqf.
 
Code:
r_player_blood =        12000;
r_player_lowblood =    false;
r_player_timeout =        0;
r_player_bloodTotal =    r_player_blood;

defines the value in \dayz_code\init\variables.sqf.
Nice push in the right direction Sarge!

I will do a re-write for this script and make it more non-coder friendly since there is such interest in this code. Give me a few hours as I am busy at this exact moment.


-Krixes
 
Nice push in the right direction Sarge!

I will do a re-write for this script and make it more non-coder friendly since there is such interest in this code. Give me a few hours as I am busy at this exact moment.


-Krixes
is there anyway you could also make it so you can cancel it so like if you hit w or try to walk it will cancel it because if your bloodbag yourself and someone is running to you cant do anything but die
 
LOL i will add in a fancy canceling if moved type of thing too, just hang tight guys it's in the works =p I didn't expect this script to be such a huge hit or I woulda spent more time writting it lmao
 
just use the logic Dayz uses for the cancelling animation - no need to invent sth new when there is a working solution out there already .-)
 
Haha, you have already read my mind Sarge.. I love you =)

**Edit - Almost done guys! I will make a new thread for this and post its where abouts as this is not my own thread lawl.
 
Back
Top