MANTIA 55 Posted December 6, 2013 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
lappihuan 178 Posted December 6, 2013 (edited) set in the Units Init field which you want to be ignored by AI: this setCaptive true; Edited December 6, 2013 by Lappihuan Share this post Link to post Share on other sites
MANTIA 55 Posted December 7, 2013 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
Kerc Kasha 102 Posted December 9, 2013 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
MANTIA 55 Posted December 9, 2013 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
lappihuan 178 Posted December 9, 2013 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
MANTIA 55 Posted December 9, 2013 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
lappihuan 178 Posted December 10, 2013 a combination of doTarget and forceWeaponFire may help you Share this post Link to post Share on other sites
DarkDruid 96 Posted December 11, 2013 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
MANTIA 55 Posted December 12, 2013 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
Kerc Kasha 102 Posted December 14, 2013 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
DarkDruid 96 Posted December 20, 2013 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