Jump to content
Sign in to follow this  
MANTIA

How to Make A.I. invincible to OPFOR A.I. but not to human OPFOR?

Recommended Posts

Hello I've search around the forums and google and haven't seen any other thread that answers this.

I want OPFOR A.I. to be invincible to BLUFOR A.I. but to be able to be killed by BLUEFOR human players.

I want to do this so an a.i. vs a.i. battle ensues and so that human players respond as a QRF to change the momentum of the battle.

Share this post


Link to post
Share on other sites

set in the Units Init field which you want to be ignored by AI:

this setCaptive true;

Edited by Lappihuan

Share this post


Link to post
Share on other sites
set in the Units Init field which you want to be ignored by AI:

this setCaptive true;

Not sure this would do what I'm looking for.

Basically I need something that will allow human players to kill a unit who is already marked as "invincible".

Share this post


Link to post
Share on other sites

First up, in your init you'll want to do this:

EH_InvOpfor = {
_source = _this select 3;
if (_source isplayer && (side _source == WEST)) then 
{
_this
}
else
{
0
};
};

and then on the units you want invulnerable:

this addEventHandler ["HandleDamage", {_this call EH_InvOpfor}];

Share this post


Link to post
Share on other sites

I appreciate your help Kerc Kasha

But this still seems to allow the BLUFor A.I. to kill the OPfor A.I.

Share this post


Link to post
Share on other sites

Put my code in both of your AI's Init and they will ignore each other and you can kill them still.

Share this post


Link to post
Share on other sites
Put my code in both of your AI's Init and they will ignore each other and you can kill them still.

I want them to engage each other, not ignore each other. So that the human players can hear the fire fight in the distance and locate the unit in distress.

Is there a way to have them blindly fire at nothing? I suppose to could simulate the firefight without actually killing each other.

Share this post


Link to post
Share on other sites

There are some mistakes in Kerc Kasha's code, but I think his way is exactly what you are looking for.

init.sqf:

EH_Inv = {
  _source = _this select 3; 
  _damage = _this select 2; 

  if (isplayer _source) then {_damage} else {0};
};

init of all invincible units (only player can kill them):

this addEventHandler ["HandleDamage", {_this call EH_Inv}]; 

Share this post


Link to post
Share on other sites
There are some mistakes in Kerc Kasha's code, but I think his way is exactly what you are looking for.

init.sqf:

EH_Inv = {
  _source = _this select 3; 
  _damage = _this select 2; 

  if (isplayer _source) then {_damage} else {0};
};

init of all invincible units (only player can kill them):

this addEventHandler ["HandleDamage", {_this call EH_Inv}]; 

Thanks so much DarkDruid. That does exactly what I need. The creation of this mission was at a halt for the last few days but now I can complete it.

Thanks again!

Share this post


Link to post
Share on other sites
There are some mistakes in Kerc Kasha's code, but I think his way is exactly what you are looking for.

init.sqf:

EH_Inv = {
  _source = _this select 3; 
  _damage = _this select 2; 

  if (isplayer _source) then {_damage} else {0};
};

init of all invincible units (only player can kill them):

this addEventHandler ["HandleDamage", {_this call EH_Inv}]; 

Really it needs to return the damage value and not the array? Fair enough, haven't played around with that event handler enough clearly.

Share this post


Link to post
Share on other sites
Really it needs to return the damage value and not the array? Fair enough, haven't played around with that event handler enough clearly.

Yes, it doesn't work with an array. There is documentation of that event handler with more details: http://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage

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
Sign in to follow this  

×