Sign in to follow this  
geekm0nkey

Change Kill Credits?

5 posts in this topic

I had asked this question before... Thought I had a solution but doesn't seem to be the case. here is what I was wanting to do.. I wanted to change the way kills for AI/Zeds to be in a percentage instead of 1:1. What I had done was to change the code..

_newKillerFrags = _newKillerFrags + .125;

so zeds should require you to kill 8 to get one point.  Did the same for AI but .25 so 4:1

But today I noticed a new player came on, killed 9 zeds (Exilez) and got 9 points? shouldn't have.. should have only been 1.125.  I have attached the MPKilled.sqf file I have.. I don't know where else to look to make this change to correct this.

Spoiler

/*

ExileZ Mod by [FPS]kuplion - Based on ExileZ 2.0 by Patrix87

*/

// Original script by eraser1 and IT07 //
 
private ["_unit","_killer","_playerObj","_veh","_killMsg","_killMsgRoad","_roadKilled","_respect","_respectChange","_roadKillBonus","_money","_zombieMoney","_zombieRespect","_distanceBonusDivider","_minDistance","_cqbDistance","_cqbBonus","_distance","_killerRespectPoints","_safetoblow","_explode"];

_unit                   = _this select 0;
_killer                 = _this select 1;
_playerObj              = objNull;
_roadKilled                = false;
_respectChange          = 0;
_killerRespectPoints     = [];
_safetoblow                = true;
_explode                = false;

//Parameters
_zombieMoney            = EZM_ZombieMoney;                //default = 5;    // Money per zombie kill
_zombieRespect            = EZM_ZombieRespect;            //default = 10;    // Respect per zombie kill
_roadKillBonus            = EZM_RoadKillBonus;            //default = -5;    // Bonus Respect if roadkill
_minDistance            = EZM_MinDistance;                //default = 50;    // Minimal distance for range bonus
_cqbDistance            = EZM_CqbDistance;                //default = 10;    // Minimal ditance for close quarter bonus
_cqbBonus                = EZM_CqbBonus;                    //default = 40;    // Respect for close quarter bonus at 1 meter
_distanceBonusDivider     = EZM_DistanceBonusDivider;        //default = 10;    // Distance divided by that number = respect E.G. 300m / [20] = 15 Respect
//
_maxMoneyOnZed            = EZM_ZombieMaxMoney;        //default = 15; // Max Money per zombie kill will be random

_killMsg = selectRandom ["ZOMBIE WACKED","ZOMBIE CLIPPED","ZOMBIE DISABLED","ZOMBIE DISQUALIFIED","ZOMBIE WIPED","ZOMBIE WIPED","ZOMBIE ERASED","ZOMBIE LYNCHED","ZOMBIE WRECKED","ZOMBIE NEUTRALIZED","ZOMBIE SNUFFED","ZOMBIE WASTED","ZOMBIE ZAPPED"];
_killMsgRoad = selectRandom ["ZOMBIE ROADKILL","ZOMBIE SMASHED","ERMAHGERD ROADKILL"];

if (EZM_ExplosiveZombies) then
{
    if (EZM_ExplosiveZombiesRatio > random 100) then
    {    
        _killerRespectPoints pushBack [(format ["%1",EZM_ExplosiveZombieWarning]), EZM_ExplosiveRespect];
        _explode = true;
    };
};

// Remove Zombie from Monitor
EZM_aliveZombies = EZM_aliveZombies - [_unit];

// Add to Dead Zombie Monitor
_unit setVariable ["ZedKilledAt", diag_tickTime];
EZM_deadZombies pushback _unit;

if (EZM_ExtendedLogging) then
{
    diag_log format["ExileZ Mod: Zombie killed by %1", name _killer];
};


//Roadkill or not
if (isPlayer _killer) then
{
    _veh = vehicle _killer;
    _playerObj = _killer;
    if (!(_killer isKindOf "Exile_Unit_Player") && {!isNull (gunner _killer)}) then
    {
            _playerObj = gunner _killer;
    };

    if (!(_veh isEqualTo _killer) && {(driver _veh) isEqualTo _killer}) then
    {
            _playerObj = driver _veh;
            _roadKilled = true;
    };
};

_respect = _playerObj getVariable ["ExileScore", 0];
_money = _playerObj getVariable ["ExileMoney", 0];

//Scoring
if ((!isNull _playerObj) && {((getPlayerUID _playerObj) != "") && {_playerObj isKindOf "Exile_Unit_Player"}}) then
{
    //Default
    _killerRespectPoints pushBack [(format ["%1",_killMsg]), _zombieRespect];
    //RoadkillBonus
    if (_roadKilled) then
    {
        _killerRespectPoints pushBack [(format ["%1",_killMsgRoad]), _roadKillBonus];
    }
    else
    //DistanceBonus
    {
        _distance = _unit distance _playerObj;
        if (_distance > _minDistance) then
        {
            _distanceBonus = (floor (_distance / _distanceBonusDivider));
            _killerRespectPoints pushBack [(format ["%1m RANGE BONUS", (round _distance)]), _distanceBonus];            
        };
        if (_distance <= _cqbDistance) then
        {
            _distanceBonus = round((floor ((_cqbDistance + 1) - _distance)) * ( _cqbBonus /_cqbDistance));
            _killerRespectPoints pushBack [(format ["%1m CQB BONUS", (round _distance)]), _distanceBonus];
        };
    };
    
    // Calculate killer's respect and money
    {
        _respectChange = (_respectChange + (_x select 1));
    }
    forEach _killerRespectPoints;
    _respect = (_respect + _respectChange);
    _money = (_money + _zombieMoney);
    
    if (EZM_EnableMoneyOnPlayer) then
    {
        [_playerObj, "moneyReceivedRequest", [str _money, "Killing Zombies"]] call ExileServer_system_network_send_to;
        _playerObj setVariable ["ExileMoney", _money, true];
    };
    
    if (EZM_EnableMoneyOnCorpse) then
    {
        _zedMoney = random(_maxMoneyOnZed);
        _unit setVariable ["ExileMoney", round(_zedMoney), true];
    };
    
    if (EZM_EnableRespectOnKill) then
    {
        [_playerObj, "showFragRequest", [_killerRespectPoints]] call ExileServer_system_network_send_to;
        _playerObj setVariable ["ExileScore", _respect];
        ExileClientPlayerScore = _respect;
        format["setAccountScore:%1:%2", _respect, (getPlayerUID _playerObj)] call ExileServer_system_database_query_fireAndForget;
        (owner _playerObj) publicVariableClient "ExileClientPlayerScore";
        ExileClientPlayerScore = nil;
    };
    
    if (EZM_EnableZombieStatKill) then
    {
        _newKillerFrags = _killer getVariable ["ExileZedKills", 0];
        _newKillerFrags = _newKillerFrags + .125;
        _killer setVariable ["ExileZedKills", _newKillerFrags];
        format["addAccountZombieKill:%1", getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget;
        ExileClientPlayerZedKills = _newKillerFrags;
        (owner _playerObj) publicVariableClient "ExileClientPlayerZedKills";
        ExileClientPlayerZedKills = nil;
    };
    
    if (EZM_EnableStatKill) then
    {            
        _newKillerFrags = _killer getVariable ["ExileKills", 0];
        _newKillerFrags = _newKillerFrags + .125;
        _killer setVariable ["ExileKills", _newKillerFrags];
        format["addAccountKill:%1", getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget;
        ExileClientPlayerKills = _newKillerFrags;
        (owner _playerObj) publicVariableClient "ExileClientPlayerKills";
        ExileClientPlayerKills = nil;
    };

    if (EZM_EnableRankChange) then
    {
        _newKillerRank = _killer getVariable ["ExileRank", 0];
        _killer setVariable ["ExileRank", (_newKillerRank+_zombieRankChange)];
        format["modifyAccountRank:%1:%2",_zombieRankChange,getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget;
        ExileClientPlayerRank = (_newKillerRank+_zombieRankChange);
        (owner _playerObj) publicVariableClient "ExileClientPlayerRank";
        ExileClientPlayerRank = nil;
    };
    
    if (EZM_EnableHumanityChange) then
    {
        _newKillerRank = _killer getVariable ["ExileHumanity", 0];
        _killer setVariable ["ExileHumanity", (_newKillerRank+_zombieRankChange)];
        format["modifyAccountHumanity:%1:%2",_zombieRankChange,getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget;
        ExileClientPlayerHumanity = (_newKillerRank+_zombieRankChange);
        (owner _playerObj) publicVariableClient "ExileClientPlayerHumanity";
        ExileClientPlayerHumanity = nil;
    };
};

if(_explode) then
{
    if ((getPosATL _unit) call ExileClient_util_world_isInTraderZone) then
    {
        _safetoblow = false
    };
    
    if (_safetoblow) then
    {
        [_unit] spawn
        {
            private _unit = _this select 0;
            sleep EZM_ExplosionDelay;
            EZM_ExplosiveType createvehicle position _unit;
        };
    };
};

 

 

Edited by geekm0nkey

Share this post


Link to post
Share on other sites
4 hours ago, geekm0nkey said:

I had asked this question before... Thought I had a solution but doesn't seem to be the case. here is what I was wanting to do.. I wanted to change the way kills for AI/Zeds to be in a percentage instead of 1:1. What I had done was to change the code..


_newKillerFrags = _newKillerFrags + .125;

so zeds should require you to kill 8 to get one point.  Did the same for AI but .25 so 4:1

But today I noticed a new player came on, killed 9 zeds (Exilez) and got 9 points? shouldn't have.. should have only been 1.125.  I have attached the MPKilled.sqf file I have.. I don't know where else to look to make this change to correct this.

  Reveal hidden contents

/*

ExileZ Mod by [FPS]kuplion - Based on ExileZ 2.0 by Patrix87

*/

// Original script by eraser1 and IT07 //
 
private ["_unit","_killer","_playerObj","_veh","_killMsg","_killMsgRoad","_roadKilled","_respect","_respectChange","_roadKillBonus","_money","_zombieMoney","_zombieRespect","_distanceBonusDivider","_minDistance","_cqbDistance","_cqbBonus","_distance","_killerRespectPoints","_safetoblow","_explode"];

_unit                   = _this select 0;
_killer                 = _this select 1;
_playerObj              = objNull;
_roadKilled                = false;
_respectChange          = 0;
_killerRespectPoints     = [];
_safetoblow                = true;
_explode                = false;

//Parameters
_zombieMoney            = EZM_ZombieMoney;                //default = 5;    // Money per zombie kill
_zombieRespect            = EZM_ZombieRespect;            //default = 10;    // Respect per zombie kill
_roadKillBonus            = EZM_RoadKillBonus;            //default = -5;    // Bonus Respect if roadkill
_minDistance            = EZM_MinDistance;                //default = 50;    // Minimal distance for range bonus
_cqbDistance            = EZM_CqbDistance;                //default = 10;    // Minimal ditance for close quarter bonus
_cqbBonus                = EZM_CqbBonus;                    //default = 40;    // Respect for close quarter bonus at 1 meter
_distanceBonusDivider     = EZM_DistanceBonusDivider;        //default = 10;    // Distance divided by that number = respect E.G. 300m / [20] = 15 Respect
//
_maxMoneyOnZed            = EZM_ZombieMaxMoney;        //default = 15; // Max Money per zombie kill will be random

_killMsg = selectRandom ["ZOMBIE WACKED","ZOMBIE CLIPPED","ZOMBIE DISABLED","ZOMBIE DISQUALIFIED","ZOMBIE WIPED","ZOMBIE WIPED","ZOMBIE ERASED","ZOMBIE LYNCHED","ZOMBIE WRECKED","ZOMBIE NEUTRALIZED","ZOMBIE SNUFFED","ZOMBIE WASTED","ZOMBIE ZAPPED"];
_killMsgRoad = selectRandom ["ZOMBIE ROADKILL","ZOMBIE SMASHED","ERMAHGERD ROADKILL"];

if (EZM_ExplosiveZombies) then
{
    if (EZM_ExplosiveZombiesRatio > random 100) then
    {    
        _killerRespectPoints pushBack [(format ["%1",EZM_ExplosiveZombieWarning]), EZM_ExplosiveRespect];
        _explode = true;
    };
};

// Remove Zombie from Monitor
EZM_aliveZombies = EZM_aliveZombies - [_unit];

// Add to Dead Zombie Monitor
_unit setVariable ["ZedKilledAt", diag_tickTime];
EZM_deadZombies pushback _unit;

if (EZM_ExtendedLogging) then
{
    diag_log format["ExileZ Mod: Zombie killed by %1", name _killer];
};


//Roadkill or not
if (isPlayer _killer) then
{
    _veh = vehicle _killer;
    _playerObj = _killer;
    if (!(_killer isKindOf "Exile_Unit_Player") && {!isNull (gunner _killer)}) then
    {
            _playerObj = gunner _killer;
    };

    if (!(_veh isEqualTo _killer) && {(driver _veh) isEqualTo _killer}) then
    {
            _playerObj = driver _veh;
            _roadKilled = true;
    };
};

_respect = _playerObj getVariable ["ExileScore", 0];
_money = _playerObj getVariable ["ExileMoney", 0];

//Scoring
if ((!isNull _playerObj) && {((getPlayerUID _playerObj) != "") && {_playerObj isKindOf "Exile_Unit_Player"}}) then
{
    //Default
    _killerRespectPoints pushBack [(format ["%1",_killMsg]), _zombieRespect];
    //RoadkillBonus
    if (_roadKilled) then
    {
        _killerRespectPoints pushBack [(format ["%1",_killMsgRoad]), _roadKillBonus];
    }
    else
    //DistanceBonus
    {
        _distance = _unit distance _playerObj;
        if (_distance > _minDistance) then
        {
            _distanceBonus = (floor (_distance / _distanceBonusDivider));
            _killerRespectPoints pushBack [(format ["%1m RANGE BONUS", (round _distance)]), _distanceBonus];            
        };
        if (_distance <= _cqbDistance) then
        {
            _distanceBonus = round((floor ((_cqbDistance + 1) - _distance)) * ( _cqbBonus /_cqbDistance));
            _killerRespectPoints pushBack [(format ["%1m CQB BONUS", (round _distance)]), _distanceBonus];
        };
    };
    
    // Calculate killer's respect and money
    {
        _respectChange = (_respectChange + (_x select 1));
    }
    forEach _killerRespectPoints;
    _respect = (_respect + _respectChange);
    _money = (_money + _zombieMoney);
    
    if (EZM_EnableMoneyOnPlayer) then
    {
        [_playerObj, "moneyReceivedRequest", [str _money, "Killing Zombies"]] call ExileServer_system_network_send_to;
        _playerObj setVariable ["ExileMoney", _money, true];
    };
    
    if (EZM_EnableMoneyOnCorpse) then
    {
        _zedMoney = random(_maxMoneyOnZed);
        _unit setVariable ["ExileMoney", round(_zedMoney), true];
    };
    
    if (EZM_EnableRespectOnKill) then
    {
        [_playerObj, "showFragRequest", [_killerRespectPoints]] call ExileServer_system_network_send_to;
        _playerObj setVariable ["ExileScore", _respect];
        ExileClientPlayerScore = _respect;
        format["setAccountScore:%1:%2", _respect, (getPlayerUID _playerObj)] call ExileServer_system_database_query_fireAndForget;
        (owner _playerObj) publicVariableClient "ExileClientPlayerScore";
        ExileClientPlayerScore = nil;
    };
    
    if (EZM_EnableZombieStatKill) then
    {
        _newKillerFrags = _killer getVariable ["ExileZedKills", 0];
        _newKillerFrags = _newKillerFrags + .125;
        _killer setVariable ["ExileZedKills", _newKillerFrags];
        format["addAccountZombieKill:%1", getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget;
        ExileClientPlayerZedKills = _newKillerFrags;
        (owner _playerObj) publicVariableClient "ExileClientPlayerZedKills";
        ExileClientPlayerZedKills = nil;
    };
    
    if (EZM_EnableStatKill) then
    {            
        _newKillerFrags = _killer getVariable ["ExileKills", 0];
        _newKillerFrags = _newKillerFrags + .125;
        _killer setVariable ["ExileKills", _newKillerFrags];
        format["addAccountKill:%1", getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget;
        ExileClientPlayerKills = _newKillerFrags;
        (owner _playerObj) publicVariableClient "ExileClientPlayerKills";
        ExileClientPlayerKills = nil;
    };

    if (EZM_EnableRankChange) then
    {
        _newKillerRank = _killer getVariable ["ExileRank", 0];
        _killer setVariable ["ExileRank", (_newKillerRank+_zombieRankChange)];
        format["modifyAccountRank:%1:%2",_zombieRankChange,getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget;
        ExileClientPlayerRank = (_newKillerRank+_zombieRankChange);
        (owner _playerObj) publicVariableClient "ExileClientPlayerRank";
        ExileClientPlayerRank = nil;
    };
    
    if (EZM_EnableHumanityChange) then
    {
        _newKillerRank = _killer getVariable ["ExileHumanity", 0];
        _killer setVariable ["ExileHumanity", (_newKillerRank+_zombieRankChange)];
        format["modifyAccountHumanity:%1:%2",_zombieRankChange,getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget;
        ExileClientPlayerHumanity = (_newKillerRank+_zombieRankChange);
        (owner _playerObj) publicVariableClient "ExileClientPlayerHumanity";
        ExileClientPlayerHumanity = nil;
    };
};

if(_explode) then
{
    if ((getPosATL _unit) call ExileClient_util_world_isInTraderZone) then
    {
        _safetoblow = false
    };
    
    if (_safetoblow) then
    {
        [_unit] spawn
        {
            private _unit = _this select 0;
            sleep EZM_ExplosionDelay;
            EZM_ExplosiveType createvehicle position _unit;
        };
    };
};

 

 

Change the database stuff aswell for this to increment it by 0.125 instead of 1:

format["addAccountZombieKill:%1", getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget;

 

Edited by StokesMagee

Share this post


Link to post
Share on other sites
Advertisement
2 hours ago, StokesMagee said:

Change the database stuff aswell for this to increment it by 0.125 instead of 1:


format["addAccountZombieKill:%1", getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget;

 

Thank you, and I hate you.... Really. They did the math at the damn sql level instead of just writing the value from the code.. UGH.. that makes things more challanging.. Looks like to get what I want done, Ill have to create 2 new database entries for the same sql table.. I want the players to get actual K/D from ai and zombies. but not 1:1 so looks like ill have to make the addaccountzombieskill in the exile.ini with kills = kills + .125 and then have to make one for AI with kills = kills + .25 but that begs the question? Why the hell bother doing the addition in the code at all? is it because the running game and database have some kinda disconnect relationship where ingame and and database dont keep up in real time?

Share this post


Link to post
Share on other sites
11 minutes ago, geekm0nkey said:

Thank you, and I hate you.... Really. They did the math at the damn sql level instead of just writing the value from the code.. UGH.. that makes things more challanging.. Looks like to get what I want done, Ill have to create 2 new database entries for the same sql table.. I want the players to get actual K/D from ai and zombies. but not 1:1 so looks like ill have to make the addaccountzombieskill in the exile.ini with kills = kills + .125 and then have to make one for AI with kills = kills + .25 but that begs the question? Why the hell bother doing the addition in the code at all? is it because the running game and database have some kinda disconnect relationship where ingame and and database dont keep up in real time?

@kuplion :P

  • Like 1

Share this post


Link to post
Share on other sites

For those interested I was able to get this working without messing with the exile.ini or database..

ExileZ edit file exilez_mod\scripts\MPKilled.sqf on or around line 132

	if (EZM_EnableZombieStatKill) then
	{
		_tmpKillerFrags = _killer getVariable ["TmpExileKills", 0];
		_tmpKillerFrags = _tmpKillerFrags + .125; // percentage of credit for kills
		_killer setVariable ["TmpExileKills", _tmpKillerFrags];
		
		_newKillerFrags = _killer getVariable ["ExileKills", 0];
		ExileClientPlayerKills = _newKillerFrags + _tmpKillerFrags;
		(owner _playerObj) publicVariableClient "ExileClientPlayerKills";
		ExileClientPlayerKills = nil;
		
		if (_tmpKillerFrags >= 1) then 
		{
			_newKillerFrags = _newKillerFrags + 1;
			_killer setVariable ["TmpExileKills", 0];
			_killer setVariable ["ExileKills", _newKillerFrags];
			format["addAccountKill:%1", getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget;
		};
	};

DMS edit file a3_dms\scripts\fn_playerawardonaikill.sqf on or around line 162

	if (DMS_Add_AIKill2DB) then
	{
		_tmpKillerFrags = _killer getVariable ["TmpExileKills", 0];
		_tmpKillerFrags = _tmpKillerFrags + .25; // percentage of credit for kills
		_killer setVariable ["TmpExileKills", _tmpKillerFrags];
		
		_newKillerFrags = _killer getVariable ["ExileKills", 0];
		ExileClientPlayerKills = _newKillerFrags + _tmpKillerFrags;
		(owner _playerObj) publicVariableClient "ExileClientPlayerKills";
		ExileClientPlayerKills = nil;
		
		if (_tmpKillerFrags >= 1) then 
		{
			_newKillerFrags = _newKillerFrags + 1;
			_killer setVariable ["TmpExileKills", 0];
			_killer setVariable ["ExileKills", _newKillerFrags];
			format["addAccountKill:%1", getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget;
		};
	};

feel free to improve upon if you need.

  • Like 1

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.