Jump to content
Rawshark

Reducing damage taken by AI with ACE

Recommended Posts

In the mission that I am building I am trying to create a small squad of super-soldiers to go up against my players. I have done a mission like this before in vanilla by just adding 

this addEventHandler ["HandleDamage",{damage (_this select 0)+((_this select 2)/15)}];

into the init fields of the units in question and it has worked well enough in the past with the AI taking a lot more damage than normal before going down. This time around though I am using ACE and the above script just doesn't seem to work at all. I am fairly sure this might be down to how ACE handles damages but I am not versed enough in scripting to know how to modify (or even re-write) the script so it will play nicely with ACE. I am also aware that in the ACE medical setting I can tinker around with how much damage players and AI can take before going unconscious but that seems to apply a global effect when I only want to apply this to a selection of units. 

Anyone have any ideas or experience trying to do something similar with ACE?

Share this post


Link to post
Share on other sites

Hey there Rawshark. I have to admit that I haven't scripted a lot around ACE so I am not very familiar with its structure, but maybe this github issue will help. It refers to the ACE ace_fnc_handleDamage function. I didn't check exactly how it works but there's a couple of examples in the issue you could check.

 

Additionally, although I am not sure, I believe you could possibly use the same event handler you use but instead of damage use the ace_fnc_handleDamage function. I believe that the said event handler will still trigger so just by interchanging the use of damage with the respectiive ace function should do the trick.

  • Like 2

Share this post


Link to post
Share on other sites

This has worked for me... "6" is the value, and "this" is the unit you are running the code on. I have used in Eden editor in a units init field and in a script.. I use it because the RHS OPFOR units seem to take way to much damage and my BLUFOR AI will take one shot and die. So I will set ACE Medical Damage Threshold for AI real low (Globally for OPFOR) and then run this on all my BLUFOR AI which will override that setting.

this setVariable ["ace_medical_damageThreshold", 6, true]

 

  • Like 2
  • Thanks 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

×