Set AI to not attack players w/high humanity

BTAKaSpeR

New Member
I've looked over multiple guides and FAQs but haven't found anything like what i'm trying to do or even if its something i could change. Basically what I'm trying to do is I want to set the roaming AI to be heroes, which i set by any you kill you get negative humanity. But I want to make it so they wont attack players who are above a certain humanity say 5000 or more. Reason for this is due to the missions i run are usually bandits and therefore players on my server become heroes fairly quickly. So for the people who want to become bandits right away without just by killing other players they can also patrol towns and cities for the hero AI squads.

TLDR: Is it possible to set the AI to not attack players with a humanity higher than 5000?

Sorry if this has been answered, i did search but couldn't find any relevant information for what i'm trying to achieve.

EDIT: Running Epoch 1.0.5, DZAI works perfectly as of now
Thanks
 
Hero AI won't ever be added to DZAI because of the following two reasons:

1. I disagree with the concept of friendly AI (so, I won't do it)
2. It's a technical impossibility if you want to do it 100% bug-free (so, I can't do it)

It is difficult enough to have AI selectively not attack any units unless they're attacked, but if you want to complicate it by adding in arbitrary variables like humanity (a DayZ-only system that doesn't exist in Arma2), and then only a certain level of humanity, that's just not possible as far as I know.

Why isn't friendly AI possible? I'll try to give an explanation.

Suppose a player has -5000 humanity. If the AI side is set to be friendly to the player side, then the only way that you can have the AI attack the player is if the addRating command was used to make the player hostile to everyone. This is what Sarge AI does if my understanding is correct.

The addRating command works to a certain degree - all AI will attack the -5000 humanity player. The problem that this causes is that the player is now (from Arma2's point of view) also hostile to all players, so a low-humanity player and a high-humanity player won't be able to use the same vehicle. Sarge AI gets around this issue by creating a small trigger attached to every vehicle that reverses the addRating command's effects, reverting the hostile player's side back to the normal player side.

The problems with this method as I see it:

  • On servers with numerous vehicles (hundreds or thousands), you have equally many tiny triggers attached to each vehicle. Each trigger constantly checks for players within its area every 0.5 seconds. So if you have 1000 vehicles on your server, you have 2000 checks for players per second.
  • Players can simply escape from AI hostility by running to a vehicle.
  • The fix doesn't always get applied to every single vehicle, especially if you have a large amount of vehicles. It also won't be applied to vehicles spawned after the game starts, for example: deployable bikes and other vehicles, Epoch vehicles bought at traders.
  • A script needs to constantly check for nearby players and evaluate their humanity level. Too short of a search range means that friendly AI will be blind to a bandit player until the player kills one of the AI. Too long of a search range will be costing the server performance.
The other reason why I don't ever implement friendly AI is because players who want this will never actually be satisfied. I've seen requests for Sarge AI like:

  • I want some AI to attack players with x amount of humanity, and some other AI to attack players with y amount of humanity (Flat out impossible)
  • I want AI to only attack players that don't have this playerUID (Possible, but constantly checking for both humanity and playerUID will have server performance effects)
  • I don't want AI to be hostile in safezones or trader areas (I don't believe in the concept of safe zones in the zombie apocalypse)
  • I want AI to do a funny tapdance with both thumbs up their butts (maybe not this one, but I won't be surprised if I see it eventually)
 
Okay, thanks for all the information. I appreciate it, i suppose when Sarge AI has them doing a funny tapdance with both thumbs up their butts i'll move over to that ai system. :D

Thanks Buttface!
 
I run a self made mission script on my server, the Ai is hostile to all player, but a bandit player (humanity below a set value) gets a humanity decrease and player above that humanity value get a humanity increase on ai kill.
PHP:
// count humanity for kills
        if (RHAI_add_humanity AND {(vehicle _killer) == _killer} ) then { // es gibt keine Humanity, wenn aus einem Fahrzeug gefeuert wurde
            _humanity = _killer getVariable["humanity",0];
            call {
                // Militarykill
                if ( (side _unitGroup) == RESISTANCE ) exitWith {
                    // Player is a bandit
                    if (_humanity < RHAI_bandit_humanity_threshold) then {
                        _killer setVariable ["humanity",(_humanity - RHAI_humanity_gain),true];
                        if (RHAI_debug_modus > 2) then {diag_log format["[RHAI-DEBUG]: Adjusting humanity by -%2 for %1. (RHAI_fnc_eh_killed)",(name _killer),RHAI_humanity_gain];};
                    };
                    // Player is a Survivor/Hero
                    if (_humanity >= RHAI_bandit_humanity_threshold) then {
                        _killer setVariable ["humanity",(_humanity + RHAI_humanity_gain),true];
                        if (RHAI_debug_modus > 2) then {diag_log format["[RHAI-DEBUG]: Adjusting humanity by +%2 for %1. (RHAI_fnc_eh_killed)",(name _killer),RHAI_humanity_gain];};
                    };
                };
                // Survivorkill
                if ( (side _unitGroup) == WEST ) exitWith {
                    _killer setVariable ["humanity",(_humanity - RHAI_humanity_gain),true];
                    if (RHAI_debug_modus > 2) then {diag_log format["[RHAI-DEBUG]: Adjusting humanity by -%2 for %1. (RHAI_fnc_eh_killed)",(name _killer),RHAI_humanity_gain];};
                };
                // Banditkill
                if ( (side _unitGroup) == EAST ) exitWith {
                    _killer setVariable ["humanity",(_humanity + RHAI_humanity_gain),true];
                    if (RHAI_debug_modus > 2) then {diag_log format["[RHAI-DEBUG]: Adjusting humanity by +%2 for %1. (RHAI_fnc_eh_killed)",(name _killer),RHAI_humanity_gain];};
                };
            };
        };
 
Back
Top