Jump to content
Djavu

Trigger activated when unit is injured in MP

Recommended Posts

Hello, I need help, like getting an enemy to surrender when he's injured. I searched Google for hours and all I found was this:
Trigger Condition
((Damage NameUnit)> 0.2), but for some reason it only worked once.
I tried this code too, without success:
Trigger condition:
(Unit damage)> 0.2 && alive unit)
On activation:
Unit setCaptive true;
Unit removeItems "FirstAidKit";
Unit playMove "AmovPercMstpSsurWnonDnon";

Also this:
Getdammage unit> 0.2
In the three cases, when the AI is injured, it will heal, and it seems that the damage never reaches the assigned value, in the last case: getdammage unit> = 0.2, the trigger triggers when the unit is killed.
Maybe with an event handler, but I have not the slightest idea how to use it.
Thanks for any help.

Share this post


Link to post
Share on other sites

Ah I had similar issues with check damage conditions that were never solved in my end. Either the condition only worked once or the check damage condition only worked at the start of the mission. What I did was to use another condition that was "connected" to my case.

In your case maybe you can check the number of first aid kids the unit to surrender has. He will get shot, he will heal himself and then he will surrender. Maybe this condition could do the trick:

 

({_x == "FirstAidKit"} count itemCargo UnitToSurrender) < 1

Not sure it works but you could try

Share this post


Link to post
Share on other sites
10 hours ago, Dinei Devos said:

Trigger Condition
((Damage NameUnit)> 0.2), but for some reason it only worked once.
I tried this code too, without success:

 

 

That's normal. When you heal (or unit self-heal) with FAK , the remaining damage is ever 0.25. It falls to 0 with medic using medikit.

 

So, as there is few (no) chance to be exactly 0.25 damaged when hit, just try

damage yourUnit > 0.2 && damage yourUnit != 0.25  && alive yourUnit

 

Or the handleDamage EH as you mentioned.

Share this post


Link to post
Share on other sites

There are a few revive scripts that have this built in already DAP revive ect however if you revive a injured enemy unit they just stand there with hands up and if you leave the area the unit will take off and run away. I don't think they will rearm themselves or follow you to a prison area. There is a another script that allows you to pick up units injured or alive and load them up into a vehicles You could then transport them to a prison and then unload them as along as there are units with guns they won't try to run away. Hope this might point you in the right direction. I know how frustrating it can be when you have an idea in your head but lack  knowledge to write the script yourself lol welcome to my world ?

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

×