Krixes - Self Bloodbag Script

Discussion in 'Script/Addon help' started by Krixes, Apr 8, 2013.

  1. SchwEde

    SchwEde OpenDayZ Rockstar!

    Joined:
    Jul 11, 2013
    Messages:
    989
    Likes Received:
    177
    try to replace der Krixes Selfaction with this:

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

    creativesamurai1982 Member

    Joined:
    Nov 2, 2014
    Messages:
    47
    Likes Received:
    1
    Your Selfbloodbag script is fine. but somehow you have managed to remove the scroll wheel menu from selfactions. im new here and still learning myself so im sorry but you gonna need a smarter man then my self to help you. your best bet would be to start again adding 1 mod at a time. start with the selfbloodscript. Sorry i wan't much help
    Dave.
     
  3. SchwEde

    SchwEde OpenDayZ Rockstar!

    Joined:
    Jul 11, 2013
    Messages:
    989
    Likes Received:
    177
    Also there is an option to make it with right click on the blood bag which in my opinion is a bit better :)
     
  4. thomas withers

    thomas withers Member

    Joined:
    Apr 24, 2013
    Messages:
    48
    Likes Received:
    0
  5. SchwEde

    SchwEde OpenDayZ Rockstar!

    Joined:
    Jul 11, 2013
    Messages:
    989
    Likes Received:
    177
  6. HospitalChair

    HospitalChair Well-Known Member

    Joined:
    Dec 27, 2013
    Messages:
    121
    Likes Received:
    0
    Is this functioning with vanilla 1.8.3. In 1.8.2 for some reason isn't wasn't removing the bloodbag but other than that it was fine. I changed the name from bloodbag to bloodbagOneg and just made those available.
     
  7. deadlokd

    deadlokd Well-Known Member

    Joined:
    May 31, 2013
    Messages:
    135
    Likes Received:
    3
    one thing about this script is that it sometimes broke the trader menus. so please check that all your functions work every time you add a new script.
    as far as
    traders working
    being able to get into vehicles with 2 or more people..

    im just giving you a heads up on the the problems i used to encounter.. i believe thats why they made the self transfuse script..
     
    Last edited: Dec 1, 2014
  8. ColinM9991

    ColinM9991 New Member

    Joined:
    Jan 2, 2014
    Messages:
    8
    Likes Received:
    0
    What's the process to get this running on Vanilla for all clients?
     
  9. DangerRuss

    DangerRuss OpenDayZ Rockstar!

    Joined:
    Jul 10, 2013
    Messages:
    1,258
    Likes Received:
    69
    I can't be 100% sure but this would probably work as long as you make sure the classname for the blood bag is the same as the new one.
     
  10. ColinM9991

    ColinM9991 New Member

    Joined:
    Jan 2, 2014
    Messages:
    8
    Likes Received:
    0
    I looked at it for a while yesterday and I guess that without modifying the DayZ mod for yourself and all clients then there really isn't any way to get it working; other than possibly setting it server side in a script mod and broadcasting it, or calling it for each client that connects.
     
  11. DangerRuss

    DangerRuss OpenDayZ Rockstar!

    Joined:
    Jul 10, 2013
    Messages:
    1,258
    Likes Received:
    69
    I was on a server a couple days ago, that had a scroll wheel option for self blood bag.. running 1.8.3... I'll have a look and see if I can find out for you.
     
  12. DangerRuss

    DangerRuss OpenDayZ Rockstar!

    Joined:
    Jul 10, 2013
    Messages:
    1,258
    Likes Received:
    69
    // Krixes Self Bloodbag
    if (("ItemBloodbag" in _mags) || ("bloodBagOPOS" in _mags) || ("bloodBagONEG" in _mags) || ("bloodBagABPOS" in _mags) || ("bloodBagABNEG" in _mags) || ("bloodBagBPOS" in _mags) || ("bloodBagAPOS" in _mags) || ("bloodBagANEG" in _mags) || ("wholebloodBagOPOS" in _mags) || ("wholebloodBagONEG" in _mags) || ("wholebloodBagABPOS" in _mags) || ("wholebloodBagABNEG" in _mags) || ("wholebloodBagBPOS" in _mags) || ("wholebloodBagAPOS" in _mags) || ("wholebloodBagANEG" 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\fn_self\player_selfbloodbag.sqf","",5,false,true,"", ""];
    };
    } else {
    player removeAction s_player_selfBloodbag;
    s_player_selfBloodbag = -1;
    };

    You're welcome!
     
  13. ColinM9991

    ColinM9991 New Member

    Joined:
    Jan 2, 2014
    Messages:
    8
    Likes Received:
    0
    Final verification: Am I putting this in dayz_code.pbo server side or the mission? I presume the mission. (I'm quite new to the DayZ editing side and its framework)

    P.S; Here's a faster method rather than all of those if statements for the bloodbag removal on the above script, if anybody's interested.

    http://pastebin.com/aMNHDrJW
     
    Last edited: Jan 13, 2015
  14. DangerRuss

    DangerRuss OpenDayZ Rockstar!

    Joined:
    Jul 10, 2013
    Messages:
    1,258
    Likes Received:
    69
    very interesting I'll save that for future reference. Although I don't run vanilla and that's the only version with multiple types of bloodbags.

    You pull the fn_selfactions.sqf out of your client side dayz_code PBO, usually steam > steamapps > common > arma2OA > @Dayz or something like that... pull that , slap it in the mission PBO. You'll also need to pull out the compiles.sqf.. In your init.sqf redirect to wherever you put the compiles.sqf.. in the compiles.sqf redirect to wherever you put your fn_Selfactions. Hope that makes sense.
     
  15. ColinM9991

    ColinM9991 New Member

    Joined:
    Jan 2, 2014
    Messages:
    8
    Likes Received:
    0
    That makes sense; the only part that confuses me when I was thinking about that yesterday is the overwriting of global or public variables.


    Code:
    call compile preprocessFileLineNumbers "Scripts\compiles.sqf"; //Compile custom compiles
    I presume of course that putting the following AFTER the dayz_code compiles call in the init.sqf will overwrite the mod defined actions, but as I'm unsure about the DayZ framework and timers or waitUntil's then I'm unsure as to whether dayz_code compiles will still overwrite my custom compiles on start or even for JIP clients, although I guess the JIP issue could be fixed with the initPlayerLocal event script

    --Update--

    I think I understand it now actually, disable the server called compiles and put the entire compiles in the mission instead.

    --Update #2--

    For people getting errors about s_player_bloodBag being an invalid variable, then place the dayz_code variables.sqf in your mission and change the missions init.sqf to reference the new variables.sqf path; then in there you have a function full of variables set to -1, do the same for s_player_bloodBag.
     
    Last edited: Jan 14, 2015
  16. DangerRuss

    DangerRuss OpenDayZ Rockstar!

    Joined:
    Jul 10, 2013
    Messages:
    1,258
    Likes Received:
    69
    Yea sorry I forgot about variables, I havn't had to do all of this from the beginning in some time. But yes, any time you want to modify a client side script, you have to move it from your dayz_code to your mission PBO, and completely redirect server call for that script.

    You could also, although I don't like to, make a separate compiles.sqf, adding only the call lines you wish to edit, and call it after the original call line for the server. The server will compile the second one after the first. This would keep your mission size down but not by much. I prefer to bring the entire thing over and just make edits to it.
     
  17. ColinM9991

    ColinM9991 New Member

    Joined:
    Jan 2, 2014
    Messages:
    8
    Likes Received:
    0
    The best way to keep the mission file size down in this case is either by putting it in to the DayZ_Server in the @hive mod; or else you could make your own script mod that runs server side only and reference the mod path in the mission init.sqf.

    All your customization goes in the server side script mod and calls as it should usually.
     
  18. DangerRuss

    DangerRuss OpenDayZ Rockstar!

    Joined:
    Jul 10, 2013
    Messages:
    1,258
    Likes Received:
    69
    I might be misunderstanding you, but you definitely can't put client side scripts in the server PBO.
     
  19. opie

    opie New Member

    Joined:
    Mar 14, 2015
    Messages:
    2
    Likes Received:
    0
    i have installed the selfblood bag script and i got it working , only thing is the scroll option to give myself blood is always there even if i do not need the blood, , is there a way to make it where i can only give myself blood if i am low on blood?
     
  20. ALKINDA

    ALKINDA Valued Member!

    Joined:
    Mar 24, 2013
    Messages:
    269
    Likes Received:
    29



    FN_SELFACTION

    // ---------------------------------------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) && (r_player_blood < 12000)) then {
    s_player_selfBloodbag = player addaction[("<t color=""#c70000"">" + ("Self Bloodbag") +"</t>"),"Scripts\player_selfbloodbag.sqf","",5,false,true,"", ""];
    };
    } else {
    player removeAction s_player_selfBloodbag;
    s_player_selfBloodbag = -1;
    };
    // ---------------------------------------Krixes Self Bloodbag End------------------------------------



    This should not let it pop up if your blood is 12000
     
    SchwEde likes this.

Share This Page