Jump to content
gc8

HandleDamage zero damage

Recommended Posts

Thought this was something simple and what I have done before but I cannot make the plane invulnerable

 

My code:

(vehicle player) addEventHandler ["HandleDamage", 
{
 params ["_veh","_section","_damage","_unit","_cause"];
 
 _dam = 0;

 _dam
}];

 

But the plane I'm flying explodes on too hard ground impact

 

I dont want to use allowdamage because eventually I want to reduce the damage not completely remove

 

any ideas?

 

thx!

Share this post


Link to post
Share on other sites

Hello there gc8 !

 

Have you read this ?

 

On 6/5/2017 at 7:22 PM, ShadowRanger24 said:

How to prevent the unit from taking damage completely:


_unit addEventHandler ["HandleDamage", {0}];

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Hey GEORGE FLOROS GR, to be honest I did read this and after some testing (was trying to find a way to help here) I realized that this is NOT a solution. I also tried with setHit, setDamage (which I am not sure makes sense but tried it anyway) and setHitPointDamage and none made the job...!!!

 

I am not sure why this is happening as, to my understanding, at least the setHit and setHitPointDamage should do the job (the HandleDamage event handler provides enough to be able to use them). I do hope someone will shed some light here as, despite the fact that I am not directly interested in the solution, I am indeed intrigued by the fact that those commands "do not work" (forgive the abuse of phrase here).

  • Like 1

Share this post


Link to post
Share on other sites
23 minutes ago, ZaellixA said:

Hey GEORGE FLOROS GR, to be honest I did read this and after some testing (was trying to find a way to help here) I realized that this is NOT a solution.

 

I think that i'll give it a try !

 

So we want to handle the vehicle damage right ?!

Let's see !

Share this post


Link to post
Share on other sites

I think that it's working this way :

 

Ps is 4:00 in the morning !

I can't test this further !

 

GF_HD_HitPart = {	

	_this addEventHandler ["HitPart", {
	(_this select 0) params ["_target", "_shooter", "_projectile", "_position", "_velocity", "_selection", "_ammo", "_vector", "_radius", "_surfaceType", "_isDirect"];
	
	//	[_target,false]remoteExec["allowDamage",_target];

	_damage = damage _target;
	systemchat format ["_damage %1",_damage];
	
	if!(_target getVariable ["Var_GF_HD_HitPart_EH",false])then{
		
		_new_damage = _damage / 2;		
		_target setDamage _new_damage;
		systemchat format ["setDamage %1",_new_damage];
	
		_target setVariable ["Var_GF_HD_HitPart_EH",true];
	};
	
	}];
};	


[]spawn{
	while{true}do{	
		waitUntil{uisleep 1;
	
		{	
		if(
		(alive _x)
		&& (!(_x getVariable ["Var_GF_HD_HitPart",false]))

		)then{		
			_x spawn GF_HD_HitPart;			
			};					
			_x setVariable ["Var_GF_HD_HitPart",true];
		}forEach vehicles;
		};
	};
};

 

Edited by GEORGE FLOROS GR
...4:38 the code is wrong , good night guys !

Share this post


Link to post
Share on other sites

Thanks guys. I'd say the eventhandler is buggy since returning always zero from there doesn't make the vehicle invulnerable. "allowDamage false" does (Or setting that from editor at least)

  • Like 2

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

×