Jump to content

Recommended Posts

Hello,

 

I've got the following problem:

I spawn some AI with a script (via createUnit) in a region on the map.

Those spawned AI units don´t shoot at players if i host the mission on a server. They react to my(player) presents and switch to combat mode, run around, etc. but they won't shoot at me.

 

Confirmed details:

- Player is Blufor

- AI is Opfor

- AI switches to Combat Mode if player is present

- AI has enough ammo

- AI is capable to react (https://community.bistudio.com/wiki/enableAI)

- Center is created (https://community.bistudio.com/wiki/createCenter)

- Relations are correct (https://community.bistudio.com/wiki/setFriend)

 

I´ve tested the following:

- Spawn the AI in the editor                                                                                                                                                          -> they shoot me.

- Host a local server and spawn the AI                                                                                                                                       -> they shoot me.

- Switch AI owner on server from server to player ({_x setOwner (owner(allPlayers select 0));} foreach allUnits;)       -> they shoot me.

 

Seems like the AI only shoot its owner on the server...

Any suggestions how I can fix this?

 

Thanks!

Share this post


Link to post
Share on other sites

use setGroupOwner, not setOwner - might not solve your issue but you should be changing the group, not the unit in your code here:  ({_x setOwner (owner(allPlayers select 0));} foreach allUnits;)

Share this post


Link to post
Share on other sites

Yeah that's right! It's not really part of the problem but more correct i guess. Since in my example every unit is in it's own group I think ist doesn't matter that much. 

 

Share this post


Link to post
Share on other sites

Okay I found the error:

 

In the .arma3profile on the server I've hosted the mission on is a parameter for preferredobjectviewdistance. The value was too low so it can be fixed with running "setobjectviewdistance 2000" in the initserver.

Seems like AI (with owner Server) can't shoot farther than the objectviewdistance on the server.

 

Thanks anyway!

  • 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

×