Jump to content

Recommended Posts

Hey guys,

 

I am working on a script to spawn groups of AI around a marker. I am executing the script only on the server and the AI is spawning but not shooting even though that they are reacting to the player.

They have ammo and their behaviour changes to Combat.

I did some testing and found out if the script is executed on the client the AI shoots on the player, but only the AI which got spawned by the player. So each AI is shooting a different player. This also overflows the objective with AI because every player spawns a new group.

 

As far as I know the "brain" of the AI is the computer which spawned it. Is it possible that a server setting is wrong? I am also using 3 headless clients.

 

This is my code:

That's how I call the script:

[[[_mainobjective],"scripts\mainobjectives\setUpBigTown.sqf"],"BIS_fnc_execVM",false] call BIS_fnc_MP;

Spawning the group:

_pos = [getMarkerPos (markers select _mainobjective), 0, 400, 1, 0, 1, 0] call BIS_fnc_findSafePos;
_grp = [_pos, AIHQ, 5] call BIS_fnc_spawnGroup;
_grp setBehaviour "SAFE";

Does anyone have an idea why the AI is not shooting? or how to fix that? Trying to fix that issue for days now and were not able to find any other post. Excuse me if I overlooked any post.

 

Thank you guys in advance for any reply.

Share this post


Link to post
Share on other sites
AIHQ = createCenter east;

You can also just write "east" instead of "AIHQ".

Share this post


Link to post
Share on other sites

The wiki states this for createCenter

Quote

In Arma 3, the centers for all sides are created for you. An attempt to create center for existing side is ignored.

 

So, maybe this syntax is actually better

_grp = [_pos, east, 5] call BIS_fnc_spawnGroup;

Also, double-check your Side relations settings

Share this post


Link to post
Share on other sites
16 minutes ago, Nikander said:

The wiki states this for createCenter

Quote

In Arma 3, the centers for all sides are created for you. An attempt to create center for existing side is ignored.

 

So, maybe this syntax is actually better


_grp = [_pos, east, 5] call BIS_fnc_spawnGroup;

Also, double-check your Side relations settings

Oh, my bad, will change it back.

 

I was already thinking about side realations but if you check it with zeus you can order the AI to shoot the player, you get the red attack cursor, but they just don't shoot. They react and even aim at the player but they just don't want to shoot. Only if I execute the script on the client. I will try to set the side relations, maybe it's just a weird bug.

Share this post


Link to post
Share on other sites

Just tested - AI shooting OK, as expected. Next time share your mission as not binarized/pboed archive please.

 

Spoiler

aFMpHWd.png

 

Share this post


Link to post
Share on other sites

You tested it locally or on a server? Because if I test it on my PC it also works fine but not on a real server.

Share this post


Link to post
Share on other sites
6 minutes ago, TAW_PHI said:

You tested it locally or on a server? Because if I test it on my PC it also works fine but not on a real server.

 

Locally hosted LAN session

Share this post


Link to post
Share on other sites
7 minutes ago, serena said:

 

Locally hosted LAN session

hmmm, When I create a host via arma it works, probably because the script gets basically executed "locally" for me. If I upload it on the server and the script gets executed on the server the AI does not shoot. I spawned AI by executing a script locally instead on the server and this AI was shooting me.

Not sure if it's a server setting or something I missed in the script. ._.

Share this post


Link to post
Share on other sites

Try to enable console in description.ext (enableDebugConsole = 2) and manipulate/trace game state during mission progress.

Share this post


Link to post
Share on other sites

Got it working now. :D

I read a thread about AI getting disabled because of too less CPU power. According to a friend dedicated server and headless client processes never use more than 20-22% CPU each. He made a "pass to hc" script and now everything works like it should work. I will ask him if I am allowed to post it here for everyone who might need it.

 

Thanks to everyone who responded. :)

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×