Mr.Pig

Track AI Kills

11 posts in this topic

Modify your "\@ExileServer\extDB\sql_custom_v2\exile.ini" with the following

Find "[addAccountDeath]" and add this around there (can be anywhere really but to keep with the area on kills and deaths):

[addAccountAiKill]
SQL1_1 = UPDATE account SET ai_kills = ai_kills + 1 WHERE uid = ?
Number Of Inputs = 1
SQL1_INPUTS = 1

Find "[getAccountStats]" make it:

[getAccountStats]
SQL1_1 = SELECT a.money, a.score, a.kills, a.deaths, a.clan_id, c.name, a.ai_kills FROM account a LEFT JOIN clan c ON c.id = a.clan_id WHERE a.uid = ?
Number of Inputs = 1
SQL1_INPUTS = 1 
OUTPUT = 1,2,3,4,5,6-STRING,7

Find "[loadPlayer] and make it:

 

[loadPlayer]
SQL1_1 = SELECT p.id,
SQL1_2 = p.name,
SQL1_3 = p.account_uid,
SQL1_4 = p.damage,
SQL1_5 = p.hunger,
SQL1_6 = p.thirst,
SQL1_7 = p.alcohol,
SQL1_8 = p.oxygen_remaining,
SQL1_9 = p.bleeding_remaining,
SQL1_10 = p.hitpoints,
SQL1_11 = p.direction,
SQL1_12 = p.position_x,
SQL1_13 = p.position_y,
SQL1_14 = p.position_z,
SQL1_15 = p.assigned_items,
SQL1_16 = p.backpack,
SQL1_17 = p.backpack_items,
SQL1_18 = p.backpack_magazines,
SQL1_19 = p.backpack_weapons,
SQL1_20 = p.current_weapon,
SQL1_21 = p.goggles,
SQL1_22 = p.handgun_items,
SQL1_23 = p.handgun_weapon,
SQL1_24 = p.headgear,
SQL1_25 = p.binocular,
SQL1_26 = p.loaded_magazines,
SQL1_27 = p.primary_weapon,
SQL1_28 = p.primary_weapon_items,
SQL1_29 = p.secondary_weapon,
SQL1_30 = p.secondary_weapon_items,
SQL1_31 = p.uniform,
SQL1_32 = p.uniform_items,
SQL1_33 = p.uniform_magazines,
SQL1_34 = p.uniform_weapons,
SQL1_35 = p.vest,
SQL1_36 = p.vest_items,
SQL1_37 = p.vest_magazines,
SQL1_38 = p.vest_weapons,
SQL1_39 = a.money,
SQL1_40 = a.score,
SQL1_41 = a.kills,
SQL1_42 = a.deaths,
SQL1_43 = c.id,
SQL1_44 = c.name,
SQL1_45 = a.ai_kills
SQL1_46 = FROM player p
SQL1_47 = INNER JOIN account a
SQL1_48 = ON a.uid = p.account_uid 
SQL1_49 = LEFT JOIN clan c 
SQL1_50 = ON c.id = a.clan_id
SQL1_51 = WHERE p.account_uid = ?
Number of Inputs = 1
SQL1_INPUTS = 1
OUTPUT = 1,2-STRING,3-STRING,4,5,6,7,8,9,10,11,12,13,14,15,16-STRING,17,18,19,20-STRING,21-STRING,22,23-STRING,24-STRING,25-STRING,26,27-STRING,28,29-STRING,30,31-STRING,32,33,34,35-STRING,36,37,38,39,40,41,42,43,44-STRING,45

SAVE AND CLOSE

 

In file  "ExileServer_object_player_createBambi.sqf" add after "_bambiPlayer setVariable ["ExileDeaths", (_accountData select 3)];"

_bambiPlayer setVariable ["AiKills", (_accountData select 6)];

In file "ExileServer_object_player_database_load.sqf" add after "_player setVariable ["ExileDeaths", (_data select 41)];"

_player setVariable ["AiKills", (_data select 44)];

You will now need to make a new field inside the account table to be called "ai_kills" type "int" length "11" default "0"

or run this

ALTER TABLE account ADD ai_kills int(11) NOT NULL DEFAULT '0';

Ok, that should be it. Now to send an ai kill to database add the following to your fn_aikilled or the appropriate file inside your missions that kill ai or give respect or tabs.

If you find inside your fn_aikilled "ExileKills" then you can replace that with "AiKills" instead. This will now add ai kills to "AiKills" variable instead of just ExileKills.

If it is not there then do the following: (You may need to change _killer to the correct variable used inside your mission to define the player who killed ai)

_aikillerFrags = _killer getVariable ["AiKills", 0];
_killer setVariable ["AiKills", _aikillerFrags + 1];
format["addAccountAiKill:%1", (getPlayerUID _killer)] call ExileServer_system_database_query_fireAndForget;

Hope I didn't miss anything... Have fun!

 

Updated February 7 2016

Edited by Mr.Pig
Update for 0.9.41
3 people like this

Share this post


Link to post
Share on other sites

Hey Man

Nice Script, i was just wondering how do you pull the data now that its recorded? Do I just press "I" like in normal Arma for that table to appear or isn't there a way to get it?

Share this post


Link to post
Share on other sites
Advertisement

This makes it so you can store kills in database. If you want these to send to client you would have to do a bit more tweaking, in the ExileServer_object_player_sendStatsUpdate.sqf and bring the networkmessages to your mission and change updateStatsRequest to include more. Then these stats can be in a status bar.

Or... I grabbed the scoreboard from wasteland and modified it to make it work with exile. So in game players can press a key and a scoreboard pop up listing players and there stats.

Share this post


Link to post
Share on other sites

Sweet script, will make a nice addition to my PvE/PvP Server, to track AI kills on leaderboards :)

Share this post


Link to post
Share on other sites

This makes it so you can store kills in database. If you want these to send to client you would have to do a bit more tweaking, in the ExileServer_object_player_sendStatsUpdate.sqf and bring the networkmessages to your mission and change updateStatsRequest to include more. Then these stats can be in a status bar.

Or... I grabbed the scoreboard from wasteland and modified it to make it work with exile. So in game players can press a key and a scoreboard pop up listing players and there stats.

I would assume that i.e. 

_aikillerFrags = _killer getVariable ["AiKills", 0];
_killer setVariable ["AiKills", _aikillerFrags + 1];
format["addAccountAiKill:%1", (getPlayerUID _killer)] call ExileServer_system_database_query_fireAndForget;

Will go into onMpKilled? 

Not sure how I should do that, as I'm also running Kill Messages by GR8, currently my onMpKilled looks like this:

                _newKillerScore = _killer getVariable ["ExileScore", 0];
                _newKillerScore = _newKillerScore + _overallRespectChange;
                _killer setVariable ["ExileScore", _newKillerScore];
                _weapon = currentWeapon _killer;
                _txt = (gettext (configFile >> 'cfgWeapons' >> _weapon >> 'displayName'));
                _pic = (gettext (configFile >> 'cfgWeapons' >> _weapon >> 'picture'));
                if (_pic == "") then {
                    _weapon = typeOf (vehicle _killer);
                    _pic = (getText (configFile >> 'cfgVehicles' >> _weapon >> 'picture'));
                    _txt = (getText (configFile >> 'cfgVehicles' >> _weapon >> 'displayName'));
                };
                format["setAccountScore:%1:%2", _newKillerScore,getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget;
                _killMessage = format ["%1 was killed by %2", (name _victim), (name _killer)];

                // KILL MESSAGES BY GR8
                Gr8s_kill_msg = [(name _killer), _pic, (name _victim), floor(_victim distance _killer), _txt, nil, nil];
                publicVariable "Gr8s_kill_msg";
                if !(count _fragAttributes isEqualTo 0) then
                {
                    _killMessage = _killMessage + " (" + (_fragAttributes joinString ", ") + ")";
                };
                ["systemChatRequest", [_killMessage]] call ExileServer_object_player_event_killfeed;
                if (_addKillStat isEqualTo true) then
                {
                    _newKillerFrags = _killer getVariable ["ExileKills", 0];
                    _newKillerFrags = _newKillerFrags + 1;
                    _killer setVariable ["ExileKills", _newKillerFrags];
                    format["addAccountKill:%1", getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget;
                };
                [_killer, "showFragRequest", [_killerRespectPoints]] call ExileServer_system_network_send_to;
                _killer call ExileServer_object_player_sendStatsUpdate;
            }
            else 
            {
                _weapon = currentWeapon _killer;
                _txt = (gettext (configFile >> 'cfgWeapons' >> _weapon >> 'displayName'));
                _pic = (gettext (configFile >> 'cfgWeapons' >> _weapon >> 'picture'));
                if (_pic == "") then {
                   _weapon = typeOf (vehicle _killer);
                   _pic = (getText (configFile >> 'cfgVehicles' >> _weapon >> 'picture'));
                   _txt = (getText (configFile >> 'cfgVehicles' >> _weapon >> 'displayName'));
                };
                ["systemChatRequest", [format["%1 was killed by an NPC! (%2m Distance)", (name _victim), floor(_victim distance _killer)]]] call ExileServer_object_player_event_killfeed;
                // KILL MESSAGES BY GR8
                Gr8s_kill_msg = ["NPC", _pic, (name _victim), floor(_victim distance _killer), _txt, nil, nil];
                publicVariable "Gr8s_kill_msg";    
            };
        };
    };
};

How would I add this to AI kills?  

Share this post


Link to post
Share on other sites

Why i get this in my rpt file...

18:29:44 Error in expression <setVariable ["AiKills", _newKillerFrags + 1];
format["addAccountAiKill:%1", _kil>
18:29:44 Error position: <+ 1];
format["addAccountAiKill:%1", _kil>
18:29:44 Error Generic error in expression
18:29:44 File A3XAI\compile\A3XAI_utilities\A3XAI_sendKillResponse.sqf, line 101

i have put in this in my A3XAI_sendKillResponse.sqf

//["systemChatRequest", [_killMessage]] call ExileServer_system_network_send_broadcast; //To-do: Non-global version
        _newKillerFrags = _killer getVariable ["AiKills", 0];
        _killer setVariable ["AiKills", _newKillerFrags + 1];
        format["addAccountAiKill:%1", _killerPlayerUID] call ExileServer_system_database_query_fireAndForget;

any ideas ?

Share this post


Link to post
Share on other sites
On 21/10/2015 at 7:14 PM, Mr.Pig said:

This makes it so you can store kills in database. If you want these to send to client you would have to do a bit more tweaking, in the ExileServer_object_player_sendStatsUpdate.sqf and bring the networkmessages to your mission and change updateStatsRequest to include more. Then these stats can be in a status bar.

Or... I grabbed the scoreboard from wasteland and modified it to make it work with exile. So in game players can press a key and a scoreboard pop up listing players and there stats.

Any chance of sharing the modded scoreboard for us to use?????

Would be muchly appreciated :)

 

Share this post


Link to post
Share on other sites
On 26/12/2015 at 0:57 AM, serveratze said:

Hi, i do not find this line in the exile.ini

is the tutorial compatible with 0.9.41 "Clementine" ?

greetings

Hello ?

Possible to directly download files?

I'am novice.. ^^

C.Razer™

Edited by Razer™

Share this post


Link to post
Share on other sites

My files are all edited to track so much more now so my files would not work.

It should all work... Feel free to share your files and changes and I will help

Share this post


Link to post
Share on other sites
On 2/2/2016 at 10:44 PM, serveratze said:

@Mr.Pig

can you please guide the exile version 0.9.41 adapt.

I open my exile.ini and try to follow their instructions.

but the table structure is another and I can not implement their instructions :(

Please adjust your guide to the new exile.ini to thx

I'm just a noob and do not come with their instructions from the manual further

sorry for my bad english

google translate :)

Hey.... sorry i have not updated this. Been really busy.

 

Should be updated correctly and hopefully simplified it for more of a drag and drop or cut and paste :)

This method can be used for many other stats, which we use for suicides, ai_kills, ai_deaths, Player_kills,player_deaths.

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

  • Recently Browsing   0 members

    No registered users viewing this page.