Jump to content
Sign in to follow this  
Freddywall

increase damage to player?

Recommended Posts

Hello, i'd like to increase damage by bullets to player how i can do that? 

Share this post


Link to post
Share on other sites

a lazy way is with a hit event handler kind of like so. is it possible to alter the damage done by weapons without altering configs?

player addEventHandler ["Hit", {
	params ["_unit", "_source", "_damage", "_instigator"];
	if (alive _unit) then
	{
		_currentDamage = getDammage _unit;
		_newDamage = _currentDamage + 0.1;
		_unit setDamage _newDamage;
	};
}];

 

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, killzone_kid said:

If you are going to use getDammage might as well use setDammage for consistency

question, whats the difference? ive always wondered if there was a difference between setDamage and setDammage

Share this post


Link to post
Share on other sites

Don't use setdamage/setdammage, it has a very simplistic behaviour and should not be used for units with multiple hitpoints.

HandleDamageEH is preferable IMO :

params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
if (_projectile isEqualTo "") exitWith {false};
_original_damage = if (_selection isEqualTo "") then {damage _unit} else {_unit getHit _selection};
_added_damage = _damage - _original_damage;
_coef = 1;//change this to increase or decrease
_final_damage = _original_damage + _added_damage*_coef;
_final_damage

 

  • Like 3

Share this post


Link to post
Share on other sites
22 hours ago, haleks said:

Don't use setdamage/setdammage, it has a very simplistic behaviour and should not be used for units with multiple hitpoints.

HandleDamageEH is preferable IMO :


params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
if (_projectile isEqualTo "") exitWith {false};
_original_damage = if (_selection isEqualTo "") then {damage _unit} else {_unit getHit _selection};
_added_damage = _damage - _original_damage;
_coef = 1;//change this to increase or decrease
_final_damage = _original_damage + _added_damage*_coef;
_final_damage

 

seems it doesn't work. Where should i put it?

Share this post


Link to post
Share on other sites
3 hours ago, Freddywall said:

seems it doesn't work. Where should i put it?

 

Don't know where to put it?

Spoiler

Game-of-Thrones-memes-about-Samwell-Tarl

 

Well, where did you put it? There're multiple ways for this, one of them being initPlayerLocal.sqf :

player addEventHandler ["HandleDamage", {
	params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
	if (_projectile isEqualTo "") exitWith {false};
	_original_damage = if (_selection isEqualTo "") then {damage _unit} else {_unit getHit _selection};
	_added_damage = _damage - _original_damage;
	_coef = 1;//change this to increase or decrease
	_final_damage = _original_damage + _added_damage*_coef;
	_final_damage
}];

 

  • Like 1
  • Haha 3

Share this post


Link to post
Share on other sites
On 9/25/2019 at 7:27 PM, haleks said:

 

Don't know where to put it?

  Reveal hidden contents

Game-of-Thrones-memes-about-Samwell-Tarl

 

Well, where did you put it? There're multiple ways for this, one of them being initPlayerLocal.sqf :


player addEventHandler ["HandleDamage", {
	params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
	if (_projectile isEqualTo "") exitWith {false};
	_original_damage = if (_selection isEqualTo "") then {damage _unit} else {_unit getHit _selection};
	_added_damage = _damage - _original_damage;
	_coef = 1;//change this to increase or decrease
	_final_damage = _original_damage + _added_damage*_coef;
	_final_damage
}];

 

Working. Thank u

  • 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  

×