Jump to content
Sign in to follow this  
SOFTACT

Prevent Object from fully exploding

Recommended Posts

Hey Guys,

Working on a MHQ project,

and im having some "Morals" problems.

Basically, because i dont have a working script for vehicle re-spawning "Tophe's"

I need to be able to keep the name & init of the vehicle, but that script does not work properly with that.

So theres the morals: Either i have the MHQ un-destructible, or let it blow up, and never recover it.

So i was thinking if there is a way to prevent it from exploding, keeping it at the border line from Exploding and being completely damaged.

Having the vehicle rendered use-less until recovered.

If there is a setting for this, i would love to hear about it.

Thanks

Share this post


Link to post
Share on other sites

If you want to keep the original object it gets pretty tricky. But if you're okay with using the art assets that are already wreckage then it's pretty easy.

In order to keep it from going to a damage value of 1.0 (totally destroyed) you have to setup a damage handler script on the object to capture and process the damage so that you can restrict how damage it can get.

Share this post


Link to post
Share on other sites

Do you know of any good ones, im searching the database right now for something similar to restricting it. Unless i have a loop script waiting for the vehicle to re-heal after it finds it !alive.

If {!alive mhq1} then {

mhq1 setdamage 0.9;

};

Something like that maybe?

Share this post


Link to post
Share on other sites

Try a handledamage eventhandler:

mhq1 addEventHandler ["HandleDamage", 
{
private ["_veh","_dmg","_overalldamage"];
_veh = _this select 0;
_dmg = _this select 2;
_overalldamage = (damage _veh) + _dmg;
if (_overalldamage > 0.95) then
	{ 
	_veh setDamage 0.9;
	}else
	{
	_veh setDamage _overalldamage;
	};
}
];

Edited by tpw

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  

×