1.8.2 broken blood type fix

delpi

Well-Known Member
I've noticed that everyone is given the same blood type of b neg.

I wore a fix in the playerllogin SQF but for some reason it isn't taking. There must be somewhere else that it is getting overwritten.

Anyone else played with this?
 
Been at this for 4 hours. Can't figure out where the heck it is setting it to B- everytime.

Anyone got some experience with this? Fed up with it at this point.
 
did you post your RPT? Look in the RPT when someone picks up or gets a bloodbag? ... You might have to check the client side RPT too.
 
I don't think it is when a bloodbag is picked up. It's when the player 1st logs in and the check is done to see if alive or new spawn. It's supposed to dynamically set a blood type. However it is B- every time. I've tried both on the client and server to set the blood type shortly after spawn but I can't seem to get it to take.


The code that should try to make it happen is in player_monotor. Sqs. Going off memory. It's not the sqf one. I've tried the code it is looking at and it's not right. Seems like the database is prepopulating and screwing it up, but can't be sure.
 
in my database, I have A blood which is the 11th item in Medical.
sbRjFrH.png


and in dayz_server.pbo/compiles/player_setup.sqf
Code:
//set medical values
if (count _medical > 0) then {
    _playerObj setVariable["USEC_isDead",(_medical select 0),true];
    _playerObj setVariable["NORRN_unconscious", (_medical select 1), true];
    _playerObj setVariable["USEC_infected",(_medical select 2),true];
    _playerObj setVariable["USEC_injured",(_medical select 3),true];
    _playerObj setVariable["USEC_inPain",(_medical select 4),true];
    _playerObj setVariable["USEC_isCardiac",(_medical select 5),true];
    _playerObj setVariable["USEC_lowBlood",(_medical select 6),true];
    _playerObj setVariable["USEC_BloodQty",(_medical select 7),true];

    _playerObj setVariable["unconsciousTime",(_medical select 10),true];
    _playerObj setVariable["blood_type",(_medical select 11),true];
    _playerObj setVariable["rh_factor",(_medical select 12),true];

    //Add bleeding Wounds
    {
        _playerObj setVariable["hit_"+_x,true, true];
    } forEach (_medical select 8);

    //Add fractures
    _fractures = (_medical select 9);
    _playerObj setVariable ["hit_legs",(_fractures select 0),true];
    _playerObj setVariable ["hit_hands",(_fractures select 1),true];
   
    if ((count _medical) > 13) then {
        //Additional medical stats
        _playerObj setVariable ["messing",(_medical select 13),true];
    };

} else {
    //Reset bleeding wounds
    call fnc_usec_resetWoundPoints;
    //Reset Fractures
    _playerObj setVariable ["hit_legs",0,true];
    _playerObj setVariable ["hit_hands",0,true];
    _playerObj setVariable ["USEC_injured",false,true];
    _playerObj setVariable ["USEC_inPain",false,true];
    _playerObj setVariable ["blood_type", 0, true];
    _playerObj setVariable ["rh_factor", 0, true];
    _playerObj setVariable ["messing",[0,0,0],true];
};

So it looks like new players get blood type set to zero. And it only gets set again during dayz_code/medical/bloodcalc.sqf

//RH type
player setVariable ["rh_factor", _rh_val, true];
//blood type
player setVariable ["blood_type", _bt_val, true];

Which is called in player_monitor.fsm
"if !((player getVariable[""blood_type"", false]) in [""A"",""B"",""AB"",""O""]) then {" \n
" [dayz_characterID] call player_bloodCalc;" \n


So there you go, you spawn in with zero bloodtype and the player monitor calls bloodcalc if you dont have one set. You have to check that file and see how _bt_val gets set. it should be set to O+ for 40% of the players since the file says it matches real world data
5m43n6D.png
 
You have traced it out to the same place I did.

Here is the kicker for me, at that if else choice the _medical count is always above zero for every new player. And the blood and rh have a value of B-.

It should work like you are saying, but it's not.

Something is preseting it and I can't find it. I put diag printouts throughout player login and player setup. It sea to be being set in between the two.
 
Last edited:
[off topic]
. when building a server, I find the "proving grounds" mod to be useful. It allows you to spawn vehicles/items, teleport etc. But the uniquely useful feature is that it has a console where you can actually type in any code and see the result. So if you want to see what values are just type in hint player getvariable["blood_type",0] and it will show you. You can create AI, vehicles whatever, with code to see what works and what doesnt.
http://www.armaholic.com/page.php?id=11936
[/off topic]

The if/else statement to set the bloodtype via bloodcalc is in player_setup which is configured before the player is created. So your 'new player' will already have that setup when they are loaded into the game. Your log outputs need to be in bloodcalc where its calculated.

So this block below is where the problem is to be found (in bloodcalc.sqf). Check the values of _ranVal and _bt_calc because its odd that _bt_calc would have to be between 6 and 29 to be B. I could understand if it were zero, but it has to be this narrow value. So possibly when it gets the values from the database in player_setup, is it retrieving the correct values from the medical array? I would use a diag_log and print what _medical select 11 and _medical select 12 are right before line 121 (
_playerObj setVariable["blood_type",(_medical select 11),true];
)

What is your medical array in the database?

Code:
switch true do {
    case (_bt_calc >= 61) : {
        _bt_val = "O";
        if (_ranVal >= 11) then {
            _rh_val = true; //89% of O type population is RH +
        } else {
            _rh_val = false;
        };
    };
    case (_bt_calc >= 29) : {
        _bt_val = "A";
        if (_ranVal >= 11) then {
            _rh_val = true; //89% of A type population is RH +
        } else {
            _rh_val = false;
        };
    };
    case (_bt_calc >= 6) : {
        _bt_val = "B";
        if (_ranVal >= 6) then {
            _rh_val = true; //94% of B type population is RH +
        } else {
            _rh_val = false;
        };
    };
    case (_bt_calc >= 0) : {
        _bt_val = "AB";
        if (_ranVal >= 9) then {
            _rh_val = true; //91% of AB type population is RH +
        } else {
            _rh_val = false;
        };
    };
};

here is my medical array from the database. Mine are saving correctly. Does your array look like this?
aIiVYDE.png
 
I'll play with that tonight.

all my players are "B" false

If you look at "player_bloodCalc", based on its player call, doesn't that have to be run client side?
 
looks to be ... Since the blood is wrong on your system only, I would say you have inserted an error somewhere along the line. Most of these files here you probably haven't edited so I would do a compare (notepad++ plugin) the player_setup.sqf with an original. and the blood_type is also set in player_humanitymorph.sqf so check that file too.
 
I've got to try out that mod. That could make things much easier. It says it only runs on server?

I'm a little confused by ther discriptios on what to do.
 
I'll do that, but I'm not sure what I'll find. My server with Vert Hosting was doing this before I touched it. My freshly downloaded Test Server was doing it before I touched it.
And I didn't play with any of that code till now.

I checked with a few other server admins and they looked at their data and its all B - now too. I don't think its just me.

Would you mind uploading yoru versions of those files you mentioned so I can compare?
 
Just to test and make sure I am not wrong, I downloaded a completely fresh install of Dayz 1.8.2 http://uk1.dayz.nu/latest/ and reinstalled since I have been fooling with a custom mod.
I joined as a fresh spawn with O+ blood. let the zombies eat me (died) and respawned with AB+ blood. I exited the game and rejoined and still had AB+ blood.
I shut down the server and restarted, rejoined and my blood was still AB+

RA584Jv.png


What happens when you test LOCALLY on your test server?
So, my suggestion is delete the Vert dayz install files and upload a fresh copy from the repository I linked above.
 
I'll give it a shot.

I am using their Bliss Database Setup. Perhaps it is filli i t Medical Field by default??
 
I have only been doing this for a few years and really have no idea what a bliss or reality is. Dayz has a new database schema ...
how about you create a script that sets your blood_type to O+ and see if that is written to the database.
at the bottom of your init.sqf . After palyer load in he should have o+ and it should be updated to the database next player update which is every couple minutes
Code:
//RH type
_rh_factor = true;
_bt_value = "o";
player setVariable ["rh_factor", _rh_val, true];
//blood type
player setVariable ["blood_type", _bt_val, true];
You could try createing a new database, execute the 1.8.1 sql query, set hive.ini to connect to that db. see what happens.
 
Bliss is just the database structure and the hive write files.

It is a pain, you have to change a few things in the DayZ code to get vehicles, tents, ect to save correctly because it has seperate tables, ect.

Fairly new to this too. Modified minecraft for a long time, so I know the concepts, but still learning what exists out ther for this platform. I'm going to start releasing some things soon.


I've tried doing what you said above without luck, however, not necessarily in that location. The problem with that location is I'll have to check to see what is written at the point and see if there is a flag to decide if the player is a 'fresh' spawn.

Since you are referencein the player variable, I'm assuming you are suggesting that on the client side?
 
I understand the bliss schema, I just dont know what it looks like as I dont know if I have ever seen it. Most hosts dont use a single schema because they have a single database for all their mods so they just have a mashup.

Separate tables? You mean like instance_vehicles, instance_deployables? that for sure is reality. I would create the new database format and use the new hiveext.dll that comes with 1.8.2

setvariable saves data to the player, so its always client side. there is no player object on the server (if you recall from the addmpeventhandler on the death screen).
so yes, in your init.sqf, set the blood type and see if it writes to the database.
 
New idea I'm going to try. In the custom load out section I should be able to set it there. I'll duplicate the determination script.
 
Okay.
I would simplify it and just select a random type
bt_value = ["a","o","ab","b","vampire"] bis_select_random;
And do same for true false rh fa tor
 
Back
Top