Jump to content
Sign in to follow this  
Alpine_gremlin

Decrease Damage Dealt to Players?

Recommended Posts

Good evening folks! I have been searching around for ways to decrease the amount of damage done to the player(s) by enemy AI. After some digging around, I remembered ArmA 3`s class difficulty settings and the server difficulty profile. My question is this: Could I reduce the damage coefficient for both players and their vehicles by including it in the mission`s description.ext file? Or is there perhaps another way to do it?  Could I use the HandleDamage EH? This mission would be intended both for single player and hosted multiplayer servers (read: not dedicated). Note that I am using ACE.

 

Cheers! Any tips would be appreciated!

 

EDIT: In the unit`s init field I have placed the following:

unitname addeventhandler ["handledamage",{ unitname setdamage ((damage unitname) /1.005)}];

Regardless of the last value, if the unit is infantry, then he can still be KO`d with a single hit. I suspect that this ACE`s doing. If the unit is a vehicle, then the different modules (engine, gun, tracks, etc...) seem to take less damage. The vehicle itself can still be knocked out however. I will continue experimenting.

 

EDIT: I removed ACE and am now running vanilla. I tried using the following:

 

guy addEventHandler ["handledamage",{guy setDamage ((damage guy) - 0.000001)}];

Placing myself in front of a Varsuk, I was shot multiple times, and while I got the bloody screen with visible wounds on my character as well as the option to treat, I did not die. I would think that with such a small number being removed from the damage number, I would have eventually went down.

 

I have a looped hint running which actively tracks my damage, but it seems like every time I take a hit, my damage resets. So my damage is constantly around 0.999985. I was hoping that the script would remove a little bit of incoming each time, gradually allowing the total damage to reach 1. Since the damage resets after every hit however, my character cannot die. I am stumped...

Share this post


Link to post
Share on other sites

EH handleDamage is fine, you need to use the embedded parameters (see biki) and return a value instead of a code:

 

unitname addeventhandler ["handledamage",{ (_this select 2) /1.005}];

 

 

  • Like 1

Share this post


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

EH handleDamage is fine, you need to use the embedded parameters (see biki) and return a value instead of a code:

 

unitname addeventhandler ["handledamage",{ (_this select 2) /1.005}];

 

 

 

That works! Thank you!

Share this post


Link to post
Share on other sites
5 minutes ago, Alpine_gremlin said:

 

That works! Thank you!

 

Weird, you're able to tell the difference between 0.3 incoming damage and 0.2985?

 

As @pierremgi stated, use proper syntax.

Also never use setDamage inside the EH, since that would defeat the purpose of the EH in the first place.

 

Reducing the incoming damage by divisions is terrible in terms of readability, use multiplication instead so things get more clear.

To reduce ALL incoming damage by 30% use something like this:

yourUnit addEventhandler ["HandleDamage",{

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

}];

 

Also take note that a projectile can move through different selections in short succession, making it still possible to get an instant kill if you don't reduce the returned damage value by big amounts.

Needs lots of tweaking to get it right.

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, Grumpy Old Man said:

 

Weird, you're able to tell the difference between 0.3 incoming damage and 0.2985?

 

As @pierremgi stated, use proper syntax.

Also never use setDamage inside the EH, since that would defeat the purpose of the EH in the first place.

 

Reducing the incoming damage by divisions is terrible in terms of readability, use multiplication instead so things get more clear.

To reduce ALL incoming damage by 30% use something like this:


yourUnit addEventhandler ["HandleDamage",{

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

}];

 

Also take note that a projectile can move through different selections in short succession, making it still possible to get an instant kill if you don't reduce the returned damage value by big amounts.

Needs lots of tweaking to get it right.

 

Cheers

Thanks so much for the tips! As a newbie I appreciate all the advice.

Share this post


Link to post
Share on other sites
On 10/1/2017 at 6:16 AM, Grumpy Old Man said:

 

To reduce ALL incoming damage by 30% use something like this:


yourUnit addEventhandler ["HandleDamage",{

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

}];

 

 

As I understand it, this means that damage is modified to 70% of default for any selection.

 

For some reason, when I apply this to the player's helicopter via init.sqf, it seems to make the unit invulnerable unless, I think, the hit in question causes enough damage to mean an instant kill.  

When I use the damage function to track the unit's overall damage, the returned value seems totally random.  For example, the value may be less than the previous one, instead of being larger, as you'd expect.

Am I doing something wrong?

Share this post


Link to post
Share on other sites

@chow86 There's a mistake in that code, basically it will work for the first hit on a healthy unit and then, like you noticed, it will act strange, sometimes even healing the unit after a hit. I've posted a solution to your problem in the main HandleDamage topic:

 

  • Like 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
Sign in to follow this  

×