[1.8.3] Players not gaining humanity after shooting bandits

KrisiS

Member
Hello guys,

I'm having a problem where people that kill bandits are not having there humanity raise.
If they kill survivors though, they lose humanity.

Is there a fix for this or another thread that I am overlooking ?



Also, I know there might be a fix somewhere that can help me to fix the bug where heros and bandits are sometimes not spawning in with the correct skin on.. can someone point me to that one :) ?

Thanks,
 
I dont think players have ever GAINED humanity from killing bandit players. If you are talking about killing bandit AI that setting is in your DZAI config file.

Here is the file in dayz_code.pbo\compile where you can see the humanity changes and you can override the funtionality and give humanity boost to players vs bandits if you desire.

nb9IYmU.png
 
Hey ShootingBlanks, tnx for the reply :)

Would I have to make a copy of fn_damagehandler.sqf to the mission.pbo ...\Scripts\ and make some form of entry into the init.sqf ? Or can I just edit this file and repack it?

Also, do you have any idea how I would edit that file to give +500 humanity for killing a player bandit ?

Sorry, I ask so much of you
 
IMPORTANT EDIT: just realized I looked at the damagehandler file which just gives minor humanity changes for injuries, use player_death.sqf for the major hits to humanity instead!


yes, move it into your mission. change the path in the compiles.sqf to point to the new location.
The first thing to understand about that file is that it deals with the DAMAGE so therefore its run by the player who got shot or killed. Thats why it has that 'publicvariable' pvdz_send and the _source is the person who CAUSED the damage.
PVDZ_send = [_source,"Humanity",[_source,_humanityHit,30]];

that line right there is sending the _humanityHIT to the shooter. So if you set the value of _humanityHit above this line to 500 if the dead player was a bandit. You probably then have to then edit the code that actually changes the players humanity when they receive the publicvariable because if the shooter is also a bandit, they should not have their humanity increase.
use this code to figure out if the shooter is also a bandit
if (( _source getVariable ["humanity",0]) > -2000) then {
//shooter is not a bandit .. figure this into your code
};

so try this
change this code in player_death.sqf
Code:
if (count _array > 0) then {
    _source = _array select 0;
    _method = _array select 1;
    if ((!isNull _source) and (_source != player)) then {
        _canHitFree = player getVariable ["freeTarget",false];
        _isBandit = (player getVariable["humanity",0]) <= -2000;
        _punishment = _canHitFree or _isBandit; //if u are bandit or start first - player will not recieve humanity drop
        _humanityHit = 0;
        if (!_punishment) then {
            //i'm "not guilty" - kill me and be punished
            _myKills = ((player getVariable ["humanKills",0]) / 30) * 1000;
            _humanityHit = -(2000 - _myKills);
            _kills = _source getVariable ["humanKills",0];
            _source setVariable ["humanKills",(_kills + 1),true];
            PVDZ_send = [_source,"Humanity",[_source,_humanityHit,300]];
            publicVariableServer "PVDZ_send";
        } else {
            //i'm "guilty" - kill me as bandit
            _killsV = _source getVariable ["banditKills",0];
            _source setVariable ["banditKills",(_killsV + 1),true];
        };

Code:
if (count _array > 0) then {
    _source = _array select 0;
    _method = _array select 1;
    if ((!isNull _source) and (_source != player)) then {
        _canHitFree = player getVariable ["freeTarget",false];
        _isBandit = (player getVariable["humanity",0]) <= -2000;
        _punishment = _canHitFree or _isBandit; //if u are bandit or start first - player will not recieve humanity drop
        _humanityHit = 0;
        if (!_punishment) then {
            //i'm "not guilty" - kill me and be punished
            _myKills = ((player getVariable ["humanKills",0]) / 30) * 1000;
            _humanityHit = -(2000 - _myKills);
            _kills = _source getVariable ["humanKills",0];
            _source setVariable ["humanKills",(_kills + 1),true];
            PVDZ_send = [_source,"Humanity",[_source,_humanityHit,300]];
            publicVariableServer "PVDZ_send";
        } else {
            //i'm "guilty" - kill me as bandit
            _killsV = _source getVariable ["banditKills",0];
            _source setVariable ["banditKills",(_killsV + 1),true];
//----------------------------------------------------------------------------------------
//this is where we are rewarding those for killing bandits
//---------------------------------------------------------------------------------------
            _humanityHit = 2000;
            PVDZ_send = [_source,"Humanity",[_source,_humanityHit,300]];
            publicVariableServer "PVDZ_send";
        };

to this .. it should then send the humanity hit to all players, a negative value if the killed player is not a bandit, a positive value if the killed player is a bandit. ALSO SHOULD check if the shooter is a bandit so that if the shooter is ALSO a bandit, they dont get a humanity increase for killing another bandit.


As always, my disclaimer ... this is off the top of my head, its untested and most likely broken, but it should get you going in the right direction anyways.
 
Last edited:
Was late for me last night when you posted this mate, I have done it there now and just waiting the next server restart to check if it worked or not :)

I won't know for about 5hours though xD ( 6hr restarts :O ) but will post the result ASAP
That's a lot of thought and effort on your behalf, thank you so much !!

You hardly know where the fix is to have hero's spawn in with the hero skin on ?
 
I suggest that you learn how to create a private server on your own computer (for development and testing) so you can test scripts without breaking or waiting for restarts on your server. It saves an IMMENSE amount of time. I created a video and shows every step except for copying your Arma and Arma2OA folders because that takes 10 minutes.
http://iaregameplayer.com/smf/index.php?action=articles;sa=view;article=7

we had discussed this before also about 2 weeks ago with the skin spawning. The code is in place, if its not working then its some kind of bug. are you using dayz 1.8.3? ... its broken and with just a few servers using that mod there isnt much in the way of fixes posted. You need to put some diag_log outputs where the skin settings are and figure out why players arent getting the skin. Either their humanity isn't retrieved yet from the database or its a logic error.

D:\Arma\Mods\@Server-1.8.3-Full\@DayZ\Addons\dayz_code\compile\player_humanityChange.sqf
Here is another 'tutorial tip' ... learn how to use the notepadd++ find in files. You type in what you are looking for and the folder and it searches all files. So quickly search the mission, dayz_server or dayz_code. In this case I know the hero skin is survivor3_dz so that is what I searched for. I had already searched for this term in dayz_server and there were no hits so I moved to the @dayz/dayz_code.pbo which is the only pbo you will ever need to take files out of and into your mission (mostly).
 
Last edited:
I don't think the changes in player_death.sqf worked as when I tested it on a player Bandit the humanity didn't raise for me.

Also, good job to you sir: I got myself a test server up and running :)
Thank you for the link and instructions.

I had a look in player_humanityChange.sqf but have no idea what I should be looking at in order to fix the hero's spawning as a survivor until they gain a little more humanity. I'll have to leave that one alone xD
 
Players gaining humanity from killing bandits is something that SHOULD have been in the code all along. I guess the reasoning is that if you are a hero or hero-wanna-be you shouldnt be rewarded for killing ANYONE.
I am working on an Epoch server at the moment and at some point I will put that in and provide the code here.


I have checked this again closer and it looks to me like this code should work,its pretty much the same as above.
You never said whether you were using Epoch or Dayz. Dayz variables use PVDZ_ while Epoch uses PVDZE_ to indicate that its an epoch variable. So in the code below (and what I posted previously), you have to use the correct variable prefix PVDZ_ or PVDZE_ otherwise the publicvariable eventhandler will not be activated because you are sending the wrong publicvariable.


Code:
    if ((!isNull _source) && (_source != player)) then {
        _canHitFree = player getVariable ["freeTarget",false];
        _isBandit = (player getVariable["humanity",0]) <= -2000;
        _punishment = _canHitFree || _isBandit; //if u are bandit || start first - player will not recieve humanity drop
        _humanityHit = 0;
        if (!_punishment) then {
            //i'm "not guilty" - kill me && be punished
            _myKills = ((player getVariable ["humanKills",0]) / 30) * 1000;
            _humanityHit = -(2000 - _myKills);
            _kills = _source getVariable ["humanKills",0];
            _source setVariable ["humanKills",(_kills + 1),true];
            PVDZE_send = [_source,"Humanity",[_source,_humanityHit,300]];
            publicVariableServer "PVDZE_send";
        } else {
            //i'm "guilty" - kill me as bandit
            _killsV = _source getVariable ["banditKills",0];
            _source setVariable ["banditKills",(_killsV + 1),true];
          
            _kills = _source getVariable ["humanKills",0];
            _humanityHit = 2000 -(_kills /30 * 1000);
          
            PVDZE_send = [_source,"Humanity",[_source,_humanityHit,300]];
            publicVariableServer "PVDZE_send";
        };
Bmf1a1X.png
 
I am using DayZ Standard..
It is working now, awesome :) except you gain +2000 humanity for killing a bandit.. any ideas of what to change to drop it to 300 ?
 
i changed :
Code:
_humanityHit = 2000 -(_kills /30 * 1000);

to:
Code:
_humanityHit = 300 -(_kills /30 * 1000);


Works perfect :) thank you soooo much !!!
 
good to know, I will add this to my server now :D

I had set the value at 2000 because bandits lose 2000 for killing a player so I rather thought it should be the same. Its so EASY to be a super low humanity bandit but very hard to become a hero because you just dont gain humanity for doing any good deeds except bloodbag. I have a plan to increase humanity on successful missions. Each mission will have success and fail for both bandits and survivors. So if the survivors protect the 'medical supply convoy' then ALL players will gain humanity .. good for survivors, bad for bandits. And if the convoy is destroyed, then all players on the server LOSE humanity, good for bandits, bad for survivors/heros. That kind of forces players who want to be a hero to participate in each mission because its success or failure affects them directly.

FYI, the humanity value also takes into account the players killed so you get X humanity and it subtracts a number based on the players you have killed (even though you are a survivor/hero).
So if you have killed 5 players that would be 5/30 * 1000 = 166 which was a small amount when the humanity was 2000 but if you reduced it to 300 it lowers the gain to 134 (if you had killed 5 players). So you can fool with that factor too ...
 
Now that's how you take a mission to a whole new level :D
I wish there were more missions available for standard 1.8.3 servers

I also added +3 Humanity per Zombie kill too, people are having a very difficult time gaining humanity on our server. For instance, I went from 11,500 - 1500 (roughly) in x3 Kills... and that was just taking revenge on people that shot my group at an Ai mission... xD

Thanks for the info on the multiplier, I'm sure I would've gotten confused in a short time about that one xD
If I didn't want to use the multiplier would I just do the following to lose a set 300 humanity per kill?
Code:
_humanityHit = 300;


Now I've just gotta keep an eye out for a fix in the the player_humanityChange.sqf to have players spawn in there respective skin upon death and I'll be happy for another short while xD

Thank you so much, you have helped me absolutely loads over the past few weeks !!
 
I used Dayz 1.8.03 and it was flawless. Fixed all bugs, worked perfectly, twice as fast as Epoch. So by the time we get to 1.8.3 the devs have made all kinds of changes which break scripts and cause bugs. Dayz 1.8.3 is just plain broken and with only a handful of servers running it there arent a lot of posts about the fixes. Check the github for issues and fixes https://github.com/DayZMod/DayZ/issues There is one that says you can only be survivor2 after death, is that your problem? https://github.com/DayZMod/DayZ/issues/319
 
If you are a Hero and die, you spawn as a survivor and cannot have the Hero skin again unless you bandage someone, give them painkillers or change into different skin and then back to civilian clothing. You dont automatically spawn with the hero skin on as I assume you should,

Ill keep an eye out :)
 
Well the second link I posted there is THAT bug and it says it has the fix although it was a 'possible' fix, but they did explain what is causing the bug.

dayz 1.8.3 = broken :( I think the epoch devs have paid the dayz devs to sabotage the mod
 
:O oops , that is the bug - my bad.
Can you tell me what is the 'possible fix' that I should try from here, I get swallowed by so much code and snippets :(

I like the idea of Epoch but just cant better the standard mod :)
 
the guy 2nd post from the bottom says this works

_tmpFix = [] spawn { sleep 1; dayz_slowCheck = [] spawn player_spawn_2; };
(dont forget the \n at the end of the line)

but he doesnt say where to put that or what to replace. i searched for dayz_slowcheck and this code below shows up so I assume he wants you to replace this line below with that he shows. Basically its just adding in a 1 second delay before spawning in a player (player_spawn_2) which gives something else time to finish. You might want to change the delay sleep 1; to sleep 2; just to make sure .. whats another second

@dayz\dayz_code\system\player_monitor.fsm
you will have to copy this file into your mission and edit your init.sqf to point to the new location
execFSM "\z\addons\dayz_code\system\player_monitor.fsm";

Hfw36dA.png


BTW: everyone does their file structure differently, most commonly people use a fixes folder in their mission and copy the dayz_code files there. I prefer to replicate the dayz_code structure in my mission. So I have a folder in my mission that is setup like this
- dayz_code
- init
- system
- player_monitor.fsm
- compiles

the benefit is when I edit a line in compiles or init.sqf all i have to do is remove the \z\addons from the path and then it automatically points to the correct location in my mission\dayz_code folder ..
Probably a bit of a confusing idea with pictures or a video .. but just passing it on (if anyone cares)
 
Man, you're a LEGEND, it worked!!
Thank you so much, I can't believe this is sorted so soon :)

I changed:
Code:
"dayz_slowCheck =     [] spawn player_spawn_2;" \n
to:
Code:
"dayz_slowCheck =     [] spawn { sleep 2; dayz_slowCheck = [] spawn player_spawn_2; };" \n

That's a nice tidy mission folder you have there :)
Mine's a bit all over the place xD but at least I have a Scripts folder
 
the post I made, removed the tabs from my folder layouts so it doesnt look like it makes sense so here is a screenshot. So I would like to clarify (just for general information) You can see the dayz_code folder and then its got compile, init,system etc etc subfolders identically to the dayz_code.pbo
as I said, it doesnt really matter as long as YOU know where stuff is but I like it because if the instructions to change the path from dayz_code into your mission I simply remove z\addons\
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";
call compile preprocessFileLineNumbers "dayz_code\init\compiles.sqf";


Ii91EcJ.png
 
Not sure if it will matter .. probably not ... but you are assigning dayz_slowcheck twice
"dayz_slowCheck = [] spawn { sleep 2; dayz_slowCheck = [] spawn player_spawn_2; };" \n

I would change it to
"[] spawn { sleep 2; dayz_slowCheck = [] spawn player_spawn_2; };" \n
we dont need a handle for the first spawn ...
 
Back
Top