Krixes - Self Bloodbag Script

Tried this last night, seemed to work great, but now I notice locked cars and safes cannot be unlocked, any advice?

You used the fn_selfActions.sqf from Krixes' post I'm guessing? You're not supposed to do that. What you need to do is open your local install of Arma and find this
@DayZ_Epoch\addons\dayz_code.pbo\compile\fn_selfActions.sqf
Copy that file to where you have put Krixes' file in your mission folder then open it up and find
Code:
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);

Then directly under that you want to add
Code:
// ---------------------------------------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------------------------------------


Save and you're done.
 
This doesn't seem to be working anymore in Vanilla DayZ 1.8. I've installed this addon dozens of times so I'm sure it's set up correctly. Is there some difference in the coding in fn_selfactions with this version?? I get the option to use the bloodbag and when I click on it there are no script errors. It just doesn't actually give the blood or perform the medical animation. Krixes...help!! :p
 
the selfactions did change in 1.8, you would have to do the above and grab the new one and insert the code, like i have. I do have the option showing up like you, same issue, but i don't think its in the selfactions setup seeing how the option is there so THAT script is doing its job. I'm wonder if in 1.8 they changed the health system just enough to break the actual bloodbag script the above selfaction calls. When i get home i'll poke around at it.
 
I would tend to agree. I tried commenting out the combat check and there was no change in behavior. Still doesn't actually give the blood or do the animation.
 
the selfactions did change in 1.8, you would have to do the above and grab the new one and insert the code, like i have. I do have the option showing up like you, same issue, but i don't think its in the selfactions setup seeing how the option is there so THAT script is doing its job. I'm wonder if in 1.8 they changed the health system just enough to break the actual bloodbag script the above selfaction calls. When i get home i'll poke around at it.


Warning Message: Script fixes\player_selfbloodbag.sqf not found

I see that in my ARMA.rpt not sure whats causing it other than position in the selfActions maybe, I've added other scripts with custom actions that are working can't figure out why this one isn't right now

The script is definitely in that location.
 
In the fn_selfactions file the selfbloodbag script is called. Make sure the path is set correctly. Like "fixes\player_selfbloodbag.sqf". It may be trying to load it from another location. Also make sure that it is not being called from your init.sqf or some other load file.
 
Remove this from player_selfBloodBag.sqf as well as the closing }; at the end

Code:
if (dayz_combat == 1) 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 {
 
In the fn_selfactions file the selfbloodbag script is called. Make sure the path is set correctly. Like "fixes\player_selfbloodbag.sqf". It may be trying to load it from another location. Also make sure that it is not being called from your init.sqf or some other load file.

Like I said the path is fine, I can only think its flagging that error because of something in the script itself.
 
Not really sure why they removed the combat check system, I quite liked not being able to do certain things whilst in combat and this is now going to break a lot of scripts. :(
 
It already existed on the abort screen, the only thing they've changed there is that the text is on the Abort button now instead of the middle of the screen.
 
Ok guys, I got it working with a 'combat' check for anybody who still wants to not be able to self blood whilst in combat. It's very possibly not the only way it can be done but it's how I did it haha.

Working player_selfbloodbag.sqf

For anybody interested in how I did it here's a quick breakdown.
Changed this
Code:
private ["_bloodAmount","_humanityBool","_infectionChance","_humanityNegBool","_humanityNegAmount","_humanityAmount","_infectedLifeLost","_infectedLifeBool","_lastBloodbag","_bloodbagLastUsedTime","_bloodbagTime","_bloodbagUseTime","_bloodbagUsageTime"];
To this
Code:
private ["_bloodAmount","_humanityBool","_infectionChance","_humanityNegBool","_humanityNegAmount","_humanityAmount","_infectedLifeLost","_infectedLifeBool","_lastBloodbag","_bloodbagLastUsedTime","_bloodbagTime","_bloodbagUseTime","_bloodbagUsageTime","_incombat","_timeout"];

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

Then I changed
Code:
if (dayz_combat == 1) then {
To this
Code:
if (_inCombat) then {

Hey presto, you can't self blood for the 30 seconds that the combat counter is running in the abort menu. :)
 
I can confirm that it also works by removing the combat check altogether and the }; at the bottom of the file. So either solution is viable. Just depends on your preference of having the combat limitation or not.
 
Remove this from player_selfBloodBag.sqf as well as the closing }; at the end

Code:
if (dayz_combat == 1) 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 {


Thanks man :)
 
It seems to be stuck in a loop, it is doing the animation 5 times before the bloodbag works I tried both methods here (with and without combat check).
 
It seems to be stuck in a loop, it is doing the animation 5 times before the bloodbag works I tried both methods here (with and without combat check).


That's intentional. It's because the time is set to 30 seconds so it repeats the animation for that length of time too. He set it like that to help stop it from becoming OP. You can adjust the time it takes in the player_selfbloodbag.sqf just look for.
Code:
_bloodbagUseTime = 30; // Amount of time it takes in second for the player to use the self bloodbag
 
Yes what cen posted, delete the code below and remove the last }; in the file.

Remove this from player_selfBloodBag.sqf as well as the closing }; at the end

Code:
if (dayz_combat == 1) 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 {
 
Back
Top