Jump to content
HansMolotov

Request for a help: A way to make hull invincible

Recommended Posts

Hi, Im trying to made a simple scenario when players will be facing some units with AT launchers, my problem is that vehicles i'm currently usinng isn't that "tanky" i want to be. I was searching trough various of places to find a remedy to my problem. So i will more than glad if someone helps me out with a script that makes certain vehicles invulnerable to hull damage to prevent being destroyed

Share this post


Link to post
Share on other sites

Hey HansMolotov.

A script that does what you require, make the hull invincible, is:

this allowDamage false;

 

Throw that in the tank's script box and the tank should be invulnerable. This works for anything you don't want dying as well. Hope this helps!

Share this post


Link to post
Share on other sites

Thanks for the reply, im aware of allowdamage but i don't need to make the whole vehicle invincible, i just need a hull as a specific part, i want to be able to damage other parts but not hull

Share this post


Link to post
Share on other sites

This script shows how to use an eventHandler to reduce damage to specific parts of an AI unit.  Read this and see how it works.

Once you understand that, look at this script I used on a vehicle to reduce damage taken by a vehicle (same principle):

// handleBoatDamages.sqf
// dummy = [boat1] execVM "Scripts\handleBoatDamages.sqf";
/*
diag_log ["getAllHitPointsDamage boat1",getAllHitPointsDamage boat1];diag_log ["getAllHitPointsDamage player",getAllHitPointsDamage player];

["HitBody","HitEngine","HitTurret","HitGun","HitTurret","HitGun","HitTurret","HitGun","HitTurret","HitGun"],
["hull","engine","","","","","","","",""],
[0,0,0,0,0,0,0,0,0,0]]]
*/
_u = _this select 0;

	_u addEventHandler ["HandleDamage", 
	{ 
		private ["_return"];
		_unit = _this select 0; 
		_selection = _this select 1; 
		_passedDamage = _this select 2; 
		_source	= _this select 3; 
		_projectile = _this select 4; 
		
		_oldDamage = 0; 
		
		_bodyMultiplier = .01;
		_engineMultiplier = 0.005;

		_otherMultiplier = 0.01;

		_overAllMultiplier = 0.005; 
		
		switch (_selection) do
		{ 
			case("hull"):
			{
				_oldDamage = _unit getHitPointDamage "HitBody";
				_return = _oldDamage + ((_passedDamage - _oldDamage) * _bodyMultiplier); 
			};
			case("engine"):
			{
				_oldDamage = _unit getHitPointDamage "HitEngine";
				_return = _oldDamage + ((_passedDamage - _oldDamage) * _engineMultiplier); 
			}; 			
			case("fuel"):
			{
				_oldDamage = _unit getHitPointDamage "HitFuel";
				_return = _oldDamage + ((_passedDamage - _oldDamage) * _otherMultiplier); 
			}; 			
			case(""):
			{
				_oldDamage = damage _unit;
				//_return = _oldDamage + ((_passedDamage - _oldDamage) * _overAllMultiplier); 
                _return = _oldDamage;
			};
            default{}; 
		}; 
        
		
		_return
	}];

I ran this script on a boat to make it tougher to destroy.   You can tweak this to work for you most likely.  Good luck.

  • Like 3

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

×