Testing the Zombies Killed Variable - Looking for help

PezDax

Member
I want to add a script to my server that will set some variables, based on the number of Zombie Kills the player has. I'm using the line of code from my custom debug monitor to retrieve the number of zombies killed.

Here's what I've been trying ...

-----------------------------------------------------------------

_kills = player getVariable["zombieKills",0];

if (_kills < 10) then {
_var1 = 0;
_var2 = 0;
};

if (_kills > 10) then {
_var1 = 1;
_var2 = 5;
};

if (_kills > 20) then {
_var1 = 2;
_var2 = 10;
};

------------------------------------------------------------------

The trouble I have with this code is that my if statement checks on the variable _kills, never read as true, so _var1 and _var2 are never set.

Is there something I'm missing here?

Thanks for any suggestions.
 
Looks like it should be working. Are you sure the script is running?
Maybe add a hint that tells you the zombiekills it returns with when it runs.

Also looking at your example code, a person with exactly 10 kills wont trigger it.
 
I want to add a script to my server that will set some variables, based on the number of Zombie Kills the player has. I'm using the line of code from my custom debug monitor to retrieve the number of zombies killed.

Here's what I've been trying ...

-----------------------------------------------------------------

_kills = player getVariable["zombieKills",0];

if (_kills < 10) then {
_var1 = 0;
_var2 = 0;
};

if (_kills > 10) then {
_var1 = 1;
_var2 = 5;
};

if (_kills > 20) then {
_var1 = 2;
_var2 = 10;
};

------------------------------------------------------------------

The trouble I have with this code is that my if statement checks on the variable _kills, never read as true, so _var1 and _var2 are never set.

Is there something I'm missing here?

Thanks for any suggestions.

for a person with 10 kills add this code in
Code:
if (_kills == 10) then {
_var1 = 1; <---change to what ever  you need them to be
_var2 = 5; <---change to what ever  you need them to be
};

also add this at the top of the script to make sure it fires off
in game hint (might happen to fast to see use RPT to double check)
Code:
hint "Count Kills Started";
or get it to write to the RPT file with
Code:
diag_log ("COUNT KILLS STARTED");
 
Thanks for the suggestions :)

After more fooling around with the script, I discovered my problem was a timing issue and I was trying to look at the zombie kills a little too soon after log in.

I added a 1 second delay to the script and all is good.
 
Back
Top