Jump to content
Sign in to follow this  
vonsteimel

How to Setdamage to 0 if not killed within a given period? I've got an idea but need

Recommended Posts

Greetings. I'm trying to create a trigger that, for a particular unit, will set their damage to 0 if their damage is less than .85 after 3 seconds from when their damage was first not equal to 0. Make sense?

Here is what I'm trying to do: I want a condition that will detect when this units damage is non-Zero (meaning he has been hurt or shot) and then wait 3 seconds and check again to see if the units damage is less than 0.85. If so, then I want the conditions to be met so the activation line ("unitname setdamage 0;") will restore his health...

This would allow my AI partner to stay alive and fight with me much longer. Otherwise, its not 60 seconds after we get into a fight that he goes down and starts crying in agony for me to come give him first aid... I end up either letting him die or spending all my time babysitting him.... I don't want to just use "allow damage false"... I want it to be possible for him to get killed, just not so easily. So if he gets shot once or twice and can avoid being killed or seriously injured (damage < 0.85) for a short period (3 seconds), he'll be restored 100% health.

I only know how to do this with 2 triggers which would be fine if I could get it to work. I need help with the Conditions. This is what I've got so far and it doesn't work:

Trigger1

(Repeatable)

CONDITION: ((damage joe)>0.1)

ACTIVATION: Action1=True

Trigger2

(Repeatable)

COUNTDOWN = 3

CONDITION: Action1=True and ((damage joe)<0.85)

ACTIVATION: joe setdamage 0;

Any input will be appreciated.

Thanks,

VS

Edited by vonsteimel

Share this post


Link to post
Share on other sites

You can create script.

Search for if then

You can launch it for certain unit only or:

Search for forEach and you can do it for all units on map for example

Just use biki and dont be shy or lazy ;)

Share this post


Link to post
Share on other sites

Assuming the vehicle name of your partner is "partner", then add code below to a new file that you call "RunPartnerDamageModel.sqf".

while {damage partner < 0.85} do {
 partner setDamage 0;
 waitUntil {damage partner > 0};
 sleep 3;
};

Then aff this line to your init.sqf:

execVM "RunPartnerDamageModel.sqf";

Share this post


Link to post
Share on other sites

Thanks for the input. I'll test the .sqf when I get home... I haven't used these types of scripts before. Will it work in "preview" mode in the editor?

Can anyone tell me whats wrong with the 2-trigger method i'm trying to use?

Share this post


Link to post
Share on other sites

Condition in Trigger2. "Action1=true" is an assignement. A comparison is weitten: "Action1==true" (or just "Action1" since it's a boolean).

Also, in Trigger2 activation, set "Action1=false" to make it all start over again (if that is what you want). Both triggers must be set to trigger repeatedly.

Share this post


Link to post
Share on other sites

Thanks Engima, I ended up figuring out how to get it to work with triggers. Also, The SQF works as well... And just as a reference, it doesn't work with the ACE wounding system. It heals their wounds but doesn't take away their issues found during "Examination" (i.e. CPR, Morphine, Bleeding.etc).

Thanks,

VS

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  

×