f3cuk / WICKED-AI

Wicked AI missions for your server
30 stars 59 forks source link

Zeds hostile to AI problem #26

Closed f3cuk closed 10 years ago

f3cuk commented 10 years ago

Okay so i'm currently testing the Testbranch and i noticed a problem with making Zeds hostile to AI. Not only is the AI attacking Zombies now, it's also attacking stuff like player bases.

Im guessing CIVILLIAN is used for more then just the zombies. Removed it for now.

nerdalertdk commented 10 years ago

From another ai script

// Create the Centers for AI
ZFM_GROUP_EAST = createCenter east;
ZFM_GROUP_WEST = createCenter west;
ZFM_GROUP_CIVILIAN = createCenter civilian;
ZFM_GROUP_RESISTANCE = createCenter resistance; // Vive Le Resistance!

// unfriendly AI bandits
EAST setFriend [WEST, 0];
EAST setFriend [RESISTANCE, 0];

// Players
WEST setFriend [EAST, 0];
WEST setFriend [RESISTANCE, 0];

// friendly AI
RESISTANCE setFriend [EAST, 0];
RESISTANCE setFriend [WEST, 0];
f3cuk commented 10 years ago

Ehm that does nothing with zombies i think (not sure). Just create a few different groups to make stuff more complicated :P

nerdalertdk commented 10 years ago

friendly AI can be used for the Hero missions maybe ?

f3cuk commented 10 years ago

Not sure, but i think ARMA 2 allows for a total of 4 sides.

WEST [BLUFOR] = Used for all player EAST [OPFOR] = Used for all AI CIVILIAN = Used for all zeds and inanimate mission editor placed objects and i think Headless Clients RESISTANCE = Not sure if this one is used right now

We could switch hero units into the resistance slot so we can set different global settings like type of stance. Right now AI is very aggressive and shoots on sight. We could change that to only return fire with Hero missions. Which i think might even be a better method cause we dont have to worry about heroes gone rogue and killing their own kind cause they will return fire. Saves us a lot of time and trouble on that part.

Furthermore "real" bandits are probably always aggressive and wont trust anyone. So its not bad that they kill on sight.

When it testing i noticed the AI did not attack the spawned in barracks etc. Maybe its got to do with spawn order, i spawned in the tanktraps after the AI, now trying to spawn them in before, they might not treat them hostile then.

f3cuk commented 10 years ago

I think we need to find another way to make them hostile towards eachother. Don't believe we can make it work like this.

nerdalertdk commented 10 years ago

Think hero missions are doable if we can move the AI behavior to the mission it self

Hero = combat mode "white" Bandit = combat mode "red"

See http://wiki.zspecialunit.org/index.php?title=ArmA_2_AI_Intelligence

f3cuk commented 10 years ago

Agree. Seems like the way to do it. Will start working on this when 2.0.0 is released.

rockeumel commented 10 years ago

Vehicles (objects) have also a faction/side, most of them should be civillian. Units created as agents are always civillian.

I do it like DZAI, i reduce rating for Zombies in range of the AI-units on client side (of owner side), that works great to let the AI attack the Zombies.

f3cuk commented 10 years ago

How does this reducing of rating work actually? Have you got some code examples?

rockeumel commented 10 years ago

i use a publicvariableeventhandler, compiled in the mission:

"RHAI_changeRating" addPublicVariableEventHandler { _targets = (_this select 1) select 0; _rating = (_this select 1) select 1; { if (local _x) then { if(rating _x > _rating) then { _x addRating _rating; }; }; } forEach _targets; };

and then run on serverside a while loop per group every 15 seconds, that looks for zombies in a 100m range around the AI, and call:

_unitsAlive = {alive _x} count (units _this);

while {_unitsAlive > 0} do {
    _nearEntities = (leader _this) nearEntities ["zZombie_Base",_range];
    {
        if (local _x) then {
            if(rating _x > -30000) then {
                _x addrating -30000;
            };
        } else {
            RHAI_changeRating = [[_x],(-30000)];
            (owner _x) publicVariableClient "RHAI_changeRating";
        };
    } foreach _nearEntities;
    sleep 15;
    _unitsAlive = {alive _x} count (units _this);
};
f3cuk commented 10 years ago

That is actually pretty smart. Didnt know there was something like addrating in ARMA :) Thanks for the example!

rockeumel commented 10 years ago

credits goes to buttface maker of the DZAI

i used something like that by myself, but it is realy effective if you set the rating on the owner side of the zombie, the ai react faster against zombies

nerdalertdk commented 10 years ago

can we add bicycle in there ? _nearEntities = (leader _this) nearEntities ["zZombie_Base","Bicycle",_range];

AI don't detect Bicycle by default.

rockeumel commented 10 years ago

you shouldn't set ratings for player, that could result in bad effects

nerdalertdk commented 10 years ago

technicel its not a player ;)

but right now you can bicycle past all AI since the bicycle is "invisble" to them

rockeumel commented 10 years ago

Hmm, i spawned 2 different bikes on my server and drive by AI, and they shot me realy quick