Bandit Humanity Cutoff Limit

Swash

New Member
Not a bug just a help request.

I'm attempting to build a server that has a very polarized map between hero and bandit.

I'd like to know if there is a way to modify SARGE AI to have bandit AI not attack other pc bandits at a certain negative humanity level (out of fear or respect).

Much like Survivors and Soldiers wont attack anyone above a certain humanity level.

Thanks in advance for any help or suggestions.

SARGE AI v1.5.2
DayZ Epoch v1.0.2

Current Mods
*AI - Sarge
*Accelerated Time - mrritchietos
*Artillery and Logistic - R3F
*BTK Cargo Drop - sxp2high
*Bury Corpses - seaweeduk
*Cannibalism - seaweeduk
*CPC Name Tags 1.0 - ToejaM
*Credits - ZedBuster
*Custom Spawn Locations - Player 2
*Headshot Suicide - Grafzahl
*Fire Dance - cyrq
*Protective Domes - Dayz.st, Matt L and Unbound Gaming
*Self Blood - Krixes
*Take Clothes - Churchie
*Tent Sleep - Krixes
 
@swash

I tried modifying SARGE's AI code to do just this without too much success. I attempted to set a player to setcaptive = true when it was the AI bandit faction and the player humanity <5000. This kinda worked, however these players could then murder the bandit AI without them becoming hostile again. Also I think that ALL AI would then treat these players as non-threats.

The only suggestion would be to set all AI factions to friendly to the player faction by default. Then check the humanity of the player and set the player to hostile.

For example

BELOW IS UNTESTED - JUST AN EXAMPLE OF A POSSIBLE SOLUTION.

Code:
// side definitions
createCenter east;
createCenter resistance;
 
// unfriendly AI bandits
EAST setFriend [WEST, 1]; //1 bandit are friendly to all players by default
EAST setFriend [RESISTANCE, 0];
 
// then set the hostility based on humanity
 
            _humanitylimit = SAR_HUMANITY_HOSTILE_LIMIT;
_humanity=0;
_ai_side = side _ai;
 
 
            if(isPlayer _x) then {
         
                _humanity= _x getVariable ["humanity",0];
 
                If ( _humanity > _humanitylimit && rating _x > -10000 && side _x = west and _ai_side = SAR_AI_unfriendly_side) then {
                    if(SAR_EXTREME_DEBUG) then {
                        diag_log format["SAR EXTREME DEBUG: reducing rating (trace_entities) for player: %1", _x];
                    };
                    _x addrating -10000;
                };
            };

If the AI faction is east (bandit by default) and the player humanity >-5000 then make hostile.

If the AI faction is resistance (friendly AI) and humanity <=-5000 then hostile.

Not sure if this would work as I haven't tested this approach before turning the lights out on my server, but was then next thing I was gonna try.

Hope that helps.
 
Nope no go. This broke the AI.

3:09:14 Error position: <= west and _ai_side = SAR_AI_unfriendly_>
3:09:14 Error Missing )
3:09:14 File mpmissions\DayZ_Epoch_13.Tavi\addons\SARGE\SAR_AI_init.sqf, line 107
3:09:14 Error in expression <bandit && rating _x > -10000 && side _x = west and _ai_side = SAR_AI_unfriendly_>
3:09:14 Error position: <= west and _ai_side = SAR_AI_unfriendly_>
3:09:14 Error Missing )

As the error says it looks like it's expecting a ) somewhere.. but as I check the syntax in notepad++ all the ( are closed with a ).
No clue..
 
Back
Top