SAR AI debug monitor

Discussion in 'Suggestions' started by C.Project, Jun 5, 2013.

  1. C.Project

    C.Project Member

    Joined:
    May 19, 2013
    Messages:
    40
    Likes Received:
    10
    SAR_group_monitor.sqf
    Code:
    // =========================================================================================================
    //  SAR_AI - DayZ AI library
    //  Version: 1.5.0
    //  Author: Sarge ([email protected])
    //
    //        Wiki: to come
    //        Forum: http://opendayz.net/#sarge-ai.131
    //
    // ---------------------------------------------------------------------------------------------------------
    //  Required:
    //  UPSMon  (special SARGE version)
    //  SHK_pos
    //
    // ---------------------------------------------------------------------------------------------------------
    //  SAR_group_monitor.sqf
    //  last modified: 28.5.2013
    //
    // ---------------------------------------------------------------------------------------------------------
    //  Toggle Monitor and Admin Only Edition by C.Project
    //  last modified: 5.06.2013
    //
    // ---------------------------------------------------------------------------------------------------------
     
     
     
     
    private ["_allgroups","_running","_sleeptime","_count_friendly_groups","_count_unfriendly_groups","_debugstring"];
     
        if (isnil ("hotkey_hitme2")) then {
        hotkey_hitme = 0;
    };
        if (hotkey_hitme2 == 1) then {
        hotkey_hitme2 = 0;
        titleText ["Sarge AI Monitor Deactivated","PLAIN DOWN"];titleFadeOut 0.2;
    } else {
        hotkey_hitme2 = 1;
        titleText ["Sarge AI Monitor Activated","PLAIN DOWN"];titleFadeOut 0.2;
    };
     
     
    if (!isServer) exitWith {}; // only run this on the server
     
    _running = true;
    _sleeptime = 5;
     
    if ((getPlayerUID player) in ["123456789","123456789"]) then {
    while {sleep 0.1;hotkey_hitme2 == 1} do {
     
        _allgroups = allgroups;
     
        _count_friendly_groups = {side _x == SAR_AI_friendly_side} count _allgroups;
        _count_unfriendly_groups = {side _x == SAR_AI_unfriendly_side} count _allgroups;
     
        if(_count_friendly_groups > 120) then {
     
            diag_log format["SARGE AI: WARNING - more than 120 friendly AI groups active. Consider decreasing your configured AI survivor and soldier groups. Number of active groups: %1.",_count_friendly_groups];
            SAR_MAX_GRP_WEST_SPAWN = true;
        } else {
            SAR_MAX_GRP_WEST_SPAWN = false;
        };
     
        if(_count_unfriendly_groups > 120) then {
     
            diag_log format["SARGE AI: WARNING - more than 120 unfriendly AI groups active. Consider decreasing your configured AI bandit groups. Number of active groups: %1.",_count_unfriendly_groups];
            SAR_MAX_GRP_EAST_SPAWN = true;
     
        } else {
            SAR_MAX_GRP_EAST_SPAWN = false;
        };
     
     
        // SAR AI debug monitor
     
        if (SAR_DEBUGMONITOR) then {
     
            //[KRON_AllRes] call SAR_debug_array;
            //[KRON_AllEast] call SAR_debug_array;
            //[KRON_targetsPos] call SAR_debug_array;
     
     
            _debugstring = parseText format ["
            <t size='0.85' font='Bitstream' align='left' color='#265CFF'>****** Sarge AI Monitor ******</t><br/>
            <br/>
            <t size='0.88' font='Bitstream' align='left' color='#ff9900'>AI units (alive/ever): </t><t size='0.85' font='Bitstream' align='right'>%6(%1)</t><br/>
            <t size='0.88' font='Bitstream' align='left' color='#ff9900'>AI groups active: </t><t size='0.85' font='Bitstream' align='right'>%2</t><br/>
            <br/>
            <t size='0.95' font='Bitstream' align='left' color='#2DB300'>Friendly AI</t><br/>
            <br/>
            <t size='0.88' font='Bitstream' align='left' color='#ff9900'>Alive AI units: </t><t size='0.85' font='Bitstream' align='right'>%4</t><br/>
            <t size='0.88' font='Bitstream' align='left' color='#ff9900'>Combat: </t><t size='0.85' font='Bitstream' align='right'>%7</t><br/>
            <t size='0.88' font='Bitstream' align='left' color='#ff9900'>Leaders in fight/walkmode: </t><t size='0.85' font='Bitstream' align='right'>%8/%9</t><br/>
            <t size='0.88' font='Bitstream' align='left' color='#ff9900'>%13/%12 AI units: </t><t size='0.85' font='Bitstream' align='right'>%11/%10</t><br/>
            <br/>
            <t size='0.95' font='Bitstream' align='left' color='#FF2626'>Unfriendly AI</t><br/>
            <br/>
            <t size='0.88' font='Bitstream' align='left' color='#ff9900'>Alive AI units: </t><t size='0.85' font='Bitstream' align='right'>%5</t><br/>
            <t size='0.88' font='Bitstream' align='left' color='#ff9900'>in combat: </t><t size='0.85' font='Bitstream' align='right'>%14</t><br/>
            <t size='0.88' font='Bitstream' align='left' color='#ff9900'>Leaders in fight/walkmode: </t><t size='0.85' font='Bitstream' align='right'>%15/%16</t><br/>
            <t size='0.88' font='Bitstream' align='left' color='#ff9900'>%13/%12 AI units: </t><t size='0.85' font='Bitstream' align='right'>%18/%17</t><br/>",
            KRON_UPS_Total,                                                                                                                                                        // 1
            KRON_UPS_Instances,                                                                                                                                                    // 2
            ((count KRON_NPCs)-1),                                                                                                                                                  // 3
            {alive _x} count KRON_AllRes,                                                                                                                                          // 4
            {alive _x} count KRON_AllEast,                                                                                                                                          // 5
            ({alive _x} count KRON_AllRes) + ({alive _x} count KRON_AllEast),                                                                                                      // 6
            {alive _x && (combatMode _x == "RED")} count KRON_AllRes,                                                                                                              // 7
            ({alive _x && (_x getVariable ["SAR_fightmode","not defined"] =="fight")} count KRON_AllRes),                                                                          // 8
            ({alive _x && (_x getVariable ["SAR_fightmode","not defined"] =="walk")} count KRON_AllRes),                                                                            // 9
            ({alive _x && (_x getVariable ["SAR_AI_experience",0] >= SAR_AI_XP_LVL_3)} count KRON_AllRes),                                                                          // 10
            ({alive _x && ((_x getVariable ["SAR_AI_experience",0] >= SAR_AI_XP_LVL_2) && (_x getVariable ["SAR_AI_experience",0] < SAR_AI_XP_LVL_3))} count KRON_AllRes),          // 11
            SAR_AI_XP_NAME_3,                                                                                                                                                      // 12
            SAR_AI_XP_NAME_2,                                                                                                                                                      // 13
            {alive _x && (combatMode _x == "RED")} count KRON_AllEast,                                                                                                              // 14
            ({alive _x && (_x getVariable ["SAR_fightmode","not defined"] =="fight")} count KRON_AllEast),                                                                          // 15
            ({alive _x && (_x getVariable ["SAR_fightmode","not defined"] =="walk")} count KRON_AllEast),                                                                          // 16
            ({alive _x && (_x getVariable ["SAR_AI_experience",0] >= SAR_AI_XP_LVL_3)} count KRON_AllEast),                                                                        // 17
            ({alive _x && ((_x getVariable ["SAR_AI_experience",0] >= SAR_AI_XP_LVL_2) && (_x getVariable ["SAR_AI_experience",0] < SAR_AI_XP_LVL_3))} count KRON_AllEast)          // 18
     
            ];
     
            [nil,nil,rHINT,_debugstring] call RE;
     
     
        };
     
        sleep _sleeptime;
     
    };};
    
    Activate.sqf
    Code:
    waituntil {!isnull (finddisplay 46)};
    if ((getPlayerUID player) in ["123456789","123456789"]) then {
        sleep 20;
        player addaction [("<t color=""#ff5E00"">" + ("AI Monitor") +"</t>"),"addons\SARGE\SAR_group_monitor.sqf","",5,false,true,"",""];
    };
    
    Not perfect and "SAR_DEBUGMONITOR= true;"has to be true to work

    well i noticed it does not run on a live server and i didnt figured out yet why

    Greatz C.Project
     
  2. Sub

    Sub New Member

    Joined:
    Jun 8, 2013
    Messages:
    21
    Likes Received:
    1
    what does this do exactly?
     
  3. C.Project

    C.Project Member

    Joined:
    May 19, 2013
    Messages:
    40
    Likes Received:
    10
    Well, its just Sarge's AI Monitor but with a toggle Key(admin only)
    so u dont have to turn Debug Monitor on and off in Sarge's settings file

    But as i said its still broken and as of the new update to DayZ i think it will be broken for a longer time untill i find a sulution (or Sarge).
     
  4. Sarge

    Sarge OpenDayZ Guru! Staff Member

    Joined:
    Feb 25, 2013
    Messages:
    1,003
    Likes Received:
    206
  5. Dr No

    Dr No Member

    Joined:
    May 23, 2013
    Messages:
    50
    Likes Received:
    5
    Couldn't you technically give all the debug options including markers and way points this way?
     
  6. Sarge

    Sarge OpenDayZ Guru! Staff Member

    Joined:
    Feb 25, 2013
    Messages:
    1,003
    Likes Received:
    206
    the hint window is limited in size .. so not everything can be displayed in there.

    Sarge
     

Share This Page