Jump to content
Sign in to follow this  
natunobilis

Hide a wall only with specific explosives

Recommended Posts

I have this script, which works with any explosive near a wall, and when it explodes it disappears (wall).

I would like this to only happen when the player uses an explosive DemoChage_F (Explosive Charge).

 

wall01 addEventHandler ["Explosion", {  
wall01 hideObject true;  
}];
 

Can anyone help me with this?

 

Share this post


Link to post
Share on other sites

Version 2.10 added a new parameter to the Explosion EH which is helpful here:

wall01 addEventHandler ["Explosion", {   
	params ["_vehicle", "_damage", "_source"];
	if ("c4_charge_small" in str _source) then { 
		_vehicle hideObject true;  
	};
};

 

Alternately, place this in the init of any object:

this addEventHandler ["Explosion", {   
	params ["_vehicle", "_damage", "_source"];
	if ("c4_charge_small" in str _source) then { 
		_vehicle hideObject true;  
	};
};

 

Or, if you want to get fancy and have the wall sink into the ground then be deleted:

this addEventHandler ["Explosion", {    
	params ["_vehicle", "_damage", "_source"]; 
	if ("c4_charge_small" in str _source) then {  
		[_vehicle] spawn {
			params ["_vehicle"];
			for "_i" from 0 to 250 do {
				_pos = getPosATL _vehicle;
				_vehicle setPosATL [_pos#0,_pos#1,(_pos#2 - 0.1)];
				sleep 0.02;
			};
			deleteVehicle _vehicle;
		};
	};  
}];

 

  • 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  

×