Jump to content
Sign in to follow this  
redarmy

How to assign damage multiplier?

Recommended Posts

Is there a quick and easy event handler code i can throw into the init sqf of a mission to double the damage taken to all infantry?

And if so,does this decrease performance?

Thanks.

PS: I was using a damage multiplier in the config of bcombat,it has stopped working since recent update i beleive if anyones wondering.

Share this post


Link to post
Share on other sites

I would try:

https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage

Or maybe even easier.

https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Hit

Code should be easy enough, just multiply returned damage by 2 for handleDamage, or if using hit, then multiply damage of the unit by 2.

And yes, anything you're coding in will decrease performance (as it wasn't there before). I doubt you would notice the impact of it though with just a simple EH.

Share this post


Link to post
Share on other sites

_unit addeventhandler ["handledamage",{
   _damage = _this select 2;      

// Increase damage
   _damage = _damage * 3; 
_damage
}];

Oops ninja'd by DAS

Share this post


Link to post
Share on other sites
_unit addeventhandler ["handledamage",{
   _damage = _this select 2;      

// Increase damage
   _damage = _damage * 3; 
_damage
}];

Oops ninja'd by DAS

The way I read the wiki, "HandleDamage" returns the total damage level for the unit and "Hit" returns the damage caused by the hit. So in this case it MUST be "Hit" (or ((_this select 2) - getDammage (_this select 0))*2; )

{
_x addEventHandler["Hit",{
(_this select 2)*2;

}];

} forEach allUnits;

Edited by TKTom
Didn't close my BBCode...

Share this post


Link to post
Share on other sites

Did you actually try what I posted? handledamage works fine. *Atleast it does for me in the editor.

Nvm I se what you're driving at. Idk, the handleDmage knocked the ai on his ass with one pop == desired effect :p

Edited by Iceman77

Share this post


Link to post
Share on other sites

Thanks for respnces guys,

Will try now.Please disregard the Bcombat remark,it seem killochs multi national pack and bcombat damage multiplier dont work together on NATO units.Killoch changed some armour values,bcombat damage multiplier still works.

---------- Post added at 12:47 ---------- Previous post was at 12:42 ----------

The way I read the wiki, "HandleDamage" returns the total damage level for the unit and "Hit" returns the damage caused by the hit. So in this case it MUST be "Hit" (or ((_this select 2) - getDammage (_this select 0))*2; )

{
_x addEventHandler["Hit",{
(_this select 2)*2;

}];

} forEach allUnits;

Tktom,

if i want this to apply to spawned in infantry aswell,what else should i write here? Something to loop it?

This is for SP only.

Share this post


Link to post
Share on other sites

It is a foreach loop already. Adding the Eh to all units that are currently on the map. When you create new units, you'll want to re-add the eh.

Share this post


Link to post
Share on other sites
Did you actually try what I posted? handledamage works fine. *Atleast it does for me in the editor.

Nvm I se what you're driving at. Idk, the handleDmage knocked the ai on his ass with one pop == desired effect :p

You are right in that it does need to be "handleDamage" though, "Hit" won't actually change anything. Maybe the OP needs to consider if its worth the extra bother/calculation time required to achieve what he actually asked for versus the effect that can be done simply (one/two shot kill.)

And, as Iceman says, any unit that you want to be vulnerable needs the event handler. So when you create a unit, add the event handler. The code I gave you will add to all units on the map at the start of the misison (if placed in init.sqf).

Alternatively:

If you are using third party scripts to spawn enemies then a loop may be better, I would recommend:

[] spawn {
while {true} do {
{

if (_x getVariable["exempt",true])then {
_x addEventHandler["HandleDamage",{
(_this select 2)*2;

}];
_x setVariable["exempt",false];

};
} forEach allUnits;
sleep 6;
};
};

Edited by TKTom
Forgot to close the BBCode AGAIN!

Share this post


Link to post
Share on other sites

Great to have great minds in the forums ;)

Much appreciated all!

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  

×