Jump to content
jonipetteri

Reducing units taken damage with trigger

Recommended Posts

Hello guys!

 

Can someone tell me what is the command to reduce taken damage? (Or increase health?)

 

And the other way around... What is the command to get it back to "normal"?

 

I'm trying to make a bomb suit setup, when player is wearing certain vest_classname, he can take survive even from the biggest explosions of the game...

 

 

Thanks in advance!

Share this post


Link to post
Share on other sites

not tested but should reduce the damage to the half:

_unit addEventHandler ["HandleDamage", 
{
params ["_unit", "_selection", "_damage"];
(_damage * 0.5)
}];

 

  • Thanks 1

Share this post


Link to post
Share on other sites
6 hours ago, sarogahtyp said:

not tested but should reduce the damage to the half:


_unit addEventHandler ["HandleDamage", 
{
params ["_unit", "_selection", "_damage"];
(_damage * 0.5)
}];

 

hi, i have a question related to this.

i played a bit with your code to change it to my suiting but without success so my question is:

how would i script it so that a unit would only survive 10 shots no matter which caliber.

danke

Share this post


Link to post
Share on other sites
18 hours ago, sarogahtyp said:

not tested but should reduce the damage to the half:


_unit addEventHandler ["HandleDamage", 
{
params ["_unit", "_selection", "_damage"];
(_damage * 0.5)
}];

 

Tested this in init of the trigger in the editor. Didn't work. Alltough didn't throw any errors... Can you help with this? Am I missing something?

 

 

Trigger:

Any player

Present

On Activation: hint "Superhuman!"; _unit addEventHandler ["HandleDamage", {params ["_unit", "_selection", "_damage"];(_damage * 0.5)}];

 

Share this post


Link to post
Share on other sites

Normal.

_unit doesn't mean nothing in your trigger.

It's a little bit weird to activate this kind of EH in a trigger.

Prefer

player addEventHandler ["HandleDamage", {

  params ["_unit", "_selection", "_damage"];

  _damage = if (_unit inArea theTriggerNameYouWant) then [{_damage * 0.5},{_damage}];
  _damage

}];

  • Thanks 1

Share this post


Link to post
Share on other sites
2 hours ago, pierremgi said:

Normal.

_unit doesn't mean nothing in your trigger.

It's a little bit weird to activate this kind of EH in a trigger.

Prefer

player addEventHandler ["HandleDamage", {

  params ["_unit", "_selection", "_damage"];

  _damage = if (_unit inArea theTriggerNameYouWant) then [{_damage * 0.5},{_damage}];
  _damage

}];

Not a professional, so I might be weird. Now the trigger is activated when player is wearing certain vest.

 

Do you think it would be better to do this (MP) via script?

Share this post


Link to post
Share on other sites
39 minutes ago, pierremgi said:

Sure!

Okay. 

If I run "[] execVM ""activate.sqf"";" in trigger activation and "[] execVM ""deactivate.sqf"";" in other trigger, do I have to run some kind of code to stop running the first script (activate.sqf)?

 

Hope you understand what I'm trying to ask.

Share this post


Link to post
Share on other sites

You don't need 2 triggers. Perhaps one for the area... and just a condition for your code in your event handler. Simple as that. The understanding effort is on your side.

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

×