Jump to content
Sign in to follow this  
InfantryChild

Making Vehicle Invincible to Damage from EAST

Recommended Posts

Title says it all. I'm not a good scripter. I've been looking for a while now, but can't find anything for this. I want a vehicle to be invincible to damage from EAST, only. I know it's something about handleDamage, but I have no idea how to use it.

Thanks.

Share this post


Link to post
Share on other sites

Editor init line compatible

this addEventHandler ["HandleDamage", {
_damageold = (_this select 0) getHit (_this select 1);
_damagenew = _this select 2;

if(side group(_this select 3) == opfor) then {
	_damagenew = _damageold;
};

_damagenew
}];

Read EH documentation to understand what is going on: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage

Edited by SaMatra

Share this post


Link to post
Share on other sites

Thank you very much, I dont think this has been answered before, so this will benefit future generations to come!

Share this post


Link to post
Share on other sites

I had to read that twice ... For a minute I was considering how to apply BIS_fnc_dirTo, relativeDirTo and other radial functions on how to block damage to the player if it comes from the East, but allow from all other directions :)

Share this post


Link to post
Share on other sites
Editor init line compatible

this addEventHandler ["HandleDamage", {
_damageold = (_this select 0) getHit (_this select 1);
_damagenew = _this select 2;

if(side group(_this select 3) == opfor) then {
	_damagenew = _damageold;
};

_damagenew
}];

Read EH documentation to understand what is going on: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage

I read it, and I get it, kinda.. I realize I know nothing about building scripts, as I only work with existing scripts.. but really, this code does nothing when pasted into a unit's INIT. Even running it from a script, or other similar handleDamage scripts seem to do nothing.

If you paste that code into a units INIT, then shoot it as an OPFOR unit, shouldn't it be invincible? Yet, in my game it takes damage just like normal.. This is really frustrating.

Share this post


Link to post
Share on other sites
I read it, and I get it, kinda.. I realize I know nothing about building scripts, as I only work with existing scripts.. but really, this code does nothing when pasted into a unit's INIT. Even running it from a script, or other similar handleDamage scripts seem to do nothing.

If you paste that code into a units INIT, then shoot it as an OPFOR unit, shouldn't it be invincible? Yet, in my game it takes damage just like normal.. This is really frustrating.

I just double checked and it works fine, I simply pasted my code into car's init line and was an opfor unit. Keep in mind that it checks for group side, not unit side. If you will be an OPFOR unit in BLUFOR group damage will apply.

Screen: http://cloud-4.steamusercontent.com/ugc/707398498558082848/C50A45CF2377ED69C75B6722634252F04EDC4439/

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  

×