Krixes - Self Bloodbag Script

I couldn't go through all 36 thread pages, but a search didn't turn up anything. This code generates a negative number of seconds for the countdown, anyone know how to fix?

Code:
_bloodbagTime = time - lastBloodbag; // Variable used for easy reference in determining the self bloodbag cooldown
_bloodbagUsageTime = time;
 
if(_bloodbagTime < _bloodbagLastUsedTime) exitWith { // If cooldown is not done then exit script
    cutText [format["You've already received blood, please wait %1",(_bloodbagTime - _bloodbagLastUsedTime)], "PLAIN DOWN"]; //display text at bottom center of screen when players cooldown is not done

Don't think of it as code, think of it as simple mathematics. If you invert the calculation it will show a positive number.
Code:
(_bloodbagLastUsedTime - _bloodbagTime)

Hadn't really noticed that before haha.
 
Hello,
I have gone through everything in this discussion. I am running Epoch 1.0.2.4 and I can't get Self Bloodbag to work. Not even getting the menu pop up or any errors. Can someone help me. I attached links to my dayz_code.pbo and epoch_chernarus mission folder. Thanks!
T
dayz_code.zip
epoch.chernarus.zip
 
Hello,
I have gone through everything in this discussion. I am running Epoch 1.0.2.4 and I can't get Self Bloodbag to work. Not even getting the menu pop up or any errors. Can someone help me. I attached links to my dayz_code.pbo and epoch_chernarus mission folder. Thanks!
T
dayz_code.zip
epoch.chernarus.zip

In your init.sqf file, you have the line calling the custom compiles.sqf commented out with //.
I checked your file structure, all appears fine, you should just need to uncomment that line.
 
Hey rosska,
Thanks for the quick response. I commented that out to test some potential path issues, I was trying to see if the fn_selfactions in the pbo file was the file it was defaulting to (if that makes sense). So, compiles should be calling the fn_selfactions file in my Scripts folder, correct? Not in the dayz_code.pbo file? I will uncomment the compiles line in the init.sqf , try again, and let you know. Thanks again.
 
Hey rosska,
Thanks for the quick response. I commented that out to test some potential path issues, I was trying to see if the fn_selfactions in the pbo file was the file it was defaulting to (if that makes sense). So, compiles should be calling the fn_selfactions file in my Scripts folder, correct? Not in the dayz_code.pbo file? I will uncomment the compiles line in the init.sqf , try again, and let you know. Thanks again.

Yeah that's right, init calls compiles, then compiles calls fn_selfactions, then that calls the self blood script. Hope you got it going.
 
It does work! One part of my problem was that sometimes I show signs of idiocy. Meaning, in this case, that you have to have lost blood to be able to bloodbag yourself and I hadn't lost any. Thanks for the help.
 
hi am having trouble getting self blood bag to work when ever i put the "call compile preprocessFileLineNumbers "Scripts\compiles.sqf"; " line in it stops access to vaults and traders please help
 
hi am having trouble getting self blood bag to work when ever i put the "call compile preprocessFileLineNumbers "Scripts\compiles.sqf"; " line in it stops access to vaults and traders please help

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.
 
Ok, I been away from this awhile. Having trouble getting this working on a HFB server.
Wasn't sure wehre to put the call for compiles.sqf. Is it normal for the init.sqf to look like this? On dayz.st there was alot more stuff in this file...

Code:
//Server Settings
dayZ_instance = 1; // The instance
//dayZ_serverName = "UK1337"; // Servername (country code + server number)
dayz_antihack = 1; // DayZ Antihack / 1 = enabled // 0 = disabled
dayz_REsec = 1; // DayZ RE Security / 1 = enabled // 0 = disabled
enableRadio false; // false = radio off
 
call compile preprocessFileLineNumbers "fixes\compiles.sqf";
 
//Game Settings
dayz_spawnselection = 1; // DayZ Spawnselection / 1 = enabled // 0 = disabled, No current spawn limits.
dayz_spawnCrashSite_clutterCutter = 2;    // Helicrash Settings / 0 =  loot hidden in grass // 1 = loot lifted // 2 = no grass around the Helicrash
dayz_spawnInfectedSite_clutterCutter = 2; // Infected Base Settings / 0 =  loot hidden in grass // 1 = loot lifted // 2 = no grass around the infected base
 
#include "\z\addons\dayz_code\system\mission\init.sqf"
 
Ok, I been away from this awhile. Having trouble getting this working on a HFB server.
Wasn't sure wehre to put the call for compiles.sqf. Is it normal for the init.sqf to look like this? On dayz.st there was alot more stuff in this file...

Code:
//Server Settings
dayZ_instance = 1; // The instance
//dayZ_serverName = "UK1337"; // Servername (country code + server number)
dayz_antihack = 1; // DayZ Antihack / 1 = enabled // 0 = disabled
dayz_REsec = 1; // DayZ RE Security / 1 = enabled // 0 = disabled
enableRadio false; // false = radio off
 
call compile preprocessFileLineNumbers "fixes\compiles.sqf";
 
//Game Settings
dayz_spawnselection = 1; // DayZ Spawnselection / 1 = enabled // 0 = disabled, No current spawn limits.
dayz_spawnCrashSite_clutterCutter = 2;    // Helicrash Settings / 0 =  loot hidden in grass // 1 = loot lifted // 2 = no grass around the Helicrash
dayz_spawnInfectedSite_clutterCutter = 2; // Infected Base Settings / 0 =  loot hidden in grass // 1 = loot lifted // 2 = no grass around the infected base
 
#include "\z\addons\dayz_code\system\mission\init.sqf"
 
[SIZE=15px][FONT=Georgia][COLOR=#ebebeb]
[/COLOR][/FONT][/SIZE]

For 1.8 the DayZ team started splitting the mission files up to save on the file size for client downloads. If you check my signature you'll see a link to merged mission files. All I did was merge the parts that are now stored in the dayz_code.pbo into the parts from the mission file so you can add scripts just like before.
 
Ok, that looks a little more familiar. Didn't know they did that. I'll try it out right now.

*** UPDATE ***
Nope, still not working. Hmm.
 
Think I found a possible problem. Think my "fixes\compiles.sqf" is supposed to be after the original compiles, not before?

Code:
progressLoadingScreen 0.4;
 
call compile preprocessFileLineNumbers "fixes\compiles.sqf";
 
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";                    //Compile regular functions
 
progressLoadingScreen 1.0;


*** UPDATE ***

Nope, still not working. :(
 
Here's what I have in my fn_selfActions.sqf

Code:
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
 
// ---------------------------------------Krixes Self Bloodbag Start-----------
PlayerHumanity = (player getVariable"humanity");
if ((getPlayerUID player) in ["#######"] or (PlayerHumanity > 2000)) then {
    _mags = magazines player;
    // Krixes Self Bloodbag
    if ("ItemBloodbag" in _mags) then {
        hasBagItem = true;
    } else { hasBagItem = false;};
    if((speed player <= 1) && hasBagItem && _canDo && (r_player_blood < 10501)) then {
        if (s_player_selfBloodbag < 0) then {
            s_player_selfBloodbag = player addaction[("<t color=""#c70000"">" + ("Self Bloodbag") +"</t>"),"fixes\player_selfbloodbag.sqf","",5,false,true,"", ""];
        };
    } else {
        player removeAction s_player_selfBloodbag;
        s_player_selfBloodbag = -1;
    };
    };
 
// ---------------------------------------Krixes Self Bloodbag End-------------
 
//Grab Flare

Compiles.sqf, fn_selfActions.sqf, and player_selfbloodbag.sqf are all in the "fixes" folder.
 
Good news! I don't know what I did exactly, but I accidently got self bloodbag working again!
I was adding a custom debug monitor, and in the course of things I got them both to work, lol.
 
You should indeed call the custom compiles after the standard compiles, otherwise it wont overwrite anything.
Glad you got it working, it looked like things were fine. Had you tried moving at all before adding the debug? I remember back when I first installed this I didn't realise you had to move to get fn_selfActions to show up so I kept thinking it wasn't working haha.
 
That could have been it. I tweak something, then pack the pbo, go in, log out, tweak some more... lol.
 
I did notice a small problem with the mouse-scroll menu. When Bloodbag shows up, it affects the ability to change between your melee/main/hand weapons.
Thought I saw somewhere you could move the Bloodbag option to the bottom?
 
Do you mean it moves them further down the list?
If so then yes you can adjust the placement via fn_selfActions.
Code:
s_player_selfBloodbag = player addaction[("<t color=""#c70000"">" + ("Self Bloodbag") +"</t>"),"selfbloodbag\player_selfbloodbag.sqf","",5,false,true,"", ""];

This line is what actually generates the menu option. The 5 near the end tells it how high a priority it has. 6 will make it always at the top, 1 means it will always stay near the bottom. You can adjust it as you see fit. :)

Keep in mind for 1.8 onwards you can toggle weapons using the 1,2,3 keys along the top of your keyboard too.

You can also check out this post, to make it so the option will only show if the player actually needs blood.
 
Back
Top