Jump to content
Sign in to follow this  
Bulik CZE

Ïssue - vehicle damage handling

Recommended Posts

Hello guys, 

in past i was running wasteland server and having difficulties to balance out rocket damage to vehicles, and now i came back out of boredom to my old mission file with some ideas.

I have been trying to reduce damage output of specific type of rocket to specific target or target base.
This code here is default code from A3wasteland github  (+ some of my stuff)
 

// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com *
// ******************************************************************************************
//	@file Name: vehicleHandleDamage.sqf
//	@file Author: AgentRev

#define COLLISION_DMG_SCALE 1
#define PLANE_COLLISION_DMG_SCALE 0.2
#define WHEEL_COLLISION_DMG_SCALE 0.02
#define MRAP_MISSILE_DMG_SCALE 1
#define HELI_MISSILE_DMG_SCALE 1
#define PLANE_MISSILE_DMG_SCALE 1
#define VTOL_MISSILE_DMG_SCALE 1
#define VTOL2_MISSILE_DMG_SCALE 1
#define IFV_DMG_SCALE 1
#define TANK_DMG_SCALE 1
#define NYX_TRACK_DMG_SCALE 0.15

params ["_vehicle", "_selection", "_damage", "_source", "_ammo", "", "_instigator", "_hitPoint"];

if (_selection != "?") then
{
	_isHeli = _vehicle isKindOf "Helicopter";

	if (_isHeli && _selection == "fuel_hit") exitWith
	{
		_damage = 0; // Block goddamn fuel leak
	};

	_oldDamage = [_vehicle getHit _selection, damage _vehicle] select (_selection isEqualTo "");

	if (!isNil "_oldDamage") then
	{
		_isPlane = _vehicle isKindOf "Plane";

		if (isNull _source && _ammo == "") exitWith // Reduce collision damage
		{
			_scale = switch (true) do
			{
				case (_selection select [0,5] == "wheel"): { WHEEL_COLLISION_DMG_SCALE };
				case (_isPlane):                           { PLANE_COLLISION_DMG_SCALE };
				default                                    { COLLISION_DMG_SCALE };
			};

			_damage = ((_damage - _oldDamage) * _scale) + _oldDamage;
		};

		_isMissile = _ammo isKindOf "MissileBase"; // ({_ammo isKindOf _x} count ["R_PG32V_F", "M_NLAW_AT_F", "M_Titan_AT", "M_Titan_AA", "M_Air_AA", "M_Scalpel_AT", "Missile_AGM_02_F", "Missile_AA_04_F"] > 0);


		switch (true) do
		{
			case (_vehicle isKindOf "VTOL_01_base_F"):// blackfish
			{
				if (_isMissile) then
				{
					_damage = ((_damage - _oldDamage) * VTOL_MISSILE_DMG_SCALE) + _oldDamage;
				};
			};
			case (_vehicle isKindOf "VTOL_02_base_F")://xian
			{
				if (_isMissile) then
				{
					_damage = ((_damage - _oldDamage) * VTOL2_MISSILE_DMG_SCALE) + _oldDamage;
				};
			};

			// If vehicle is heli and projectile is missile then multiply damage
			case (_isHeli):
			{
				if (_isMissile) then
				{
					_damage = ((_damage - _oldDamage) * HELI_MISSILE_DMG_SCALE) + _oldDamage;
				};
			};

			// If vehicle is plane and projectile is missile then multiply damage
			case (_isPlane):
			{
				if (_isMissile) then
				{
					_damage = ((_damage - _oldDamage) * PLANE_MISSILE_DMG_SCALE) + _oldDamage;
				};
			};

			// If vehicle is Nyx light tank then reduce track damage
			case (_vehicle isKindOf "LT_01_base_F"):
			{
				if (_hitPoint in ["hitltrack","hitrtrack"]) then
				{
					_damage = ((_damage - _oldDamage) * NYX_TRACK_DMG_SCALE) + _oldDamage;
				};
			};

			// If vehicle is tank then multiply damage
			case (_vehicle isKindOf "Tank"): //&& !(_vehicle isKindOf "LT_01_base_F")):
			{
				//if (_isMissile) then
				//{
					#define TANKTYPE_DMG_SCALE ([TANK_DMG_SCALE, IFV_DMG_SCALE] select ({_vehicle isKindOf _x} count ["APC_Tracked_01_base_F","APC_Tracked_02_base_F","APC_Tracked_03_base_F"] > 0))
					_damage = ((_damage - _oldDamage) * TANKTYPE_DMG_SCALE) + _oldDamage;
				//};
			};

			// If vehicle is MRAP and projectile is missile then multiply damage
			case ({_vehicle isKindOf _x} count ["MRAP_01_base_F", "MRAP_02_base_F", "MRAP_03_base_F"] > 0):
			{
				if (_isMissile) then
				{
					_damage = ((_damage - _oldDamage) * MRAP_MISSILE_DMG_SCALE) + _oldDamage;
				};
			};
		};
	};

	[_vehicle, _selection, _damage, _source, _ammo, _instigator, _hitPoint] call vehicleHitTracking;
};

_damage

it works well for normal use, but as you know there are huge gaps between vehicles and rockets, some are OP and some are garbage.
I was trying to add rockets (basic one) which i used on server and balance them out. 
well it doesnt work.

my try of "something"
I have tried it on MRAP base to know if it will work in two ways, but non of them worked 

// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com *
// ******************************************************************************************
//	@file Name: vehicleHandleDamage.sqf
//	@file Author: AgentRev

#define COLLISION_DMG_SCALE 1
#define PLANE_COLLISION_DMG_SCALE 0.2
#define WHEEL_COLLISION_DMG_SCALE 0.02
#define MRAP_MISSILE_DMG_SCALE 0.001
#define HELI_MISSILE_DMG_SCALE 1
#define PLANE_MISSILE_DMG_SCALE 1
#define VTOL_MISSILE_DMG_SCALE 1
#define VTOL2_MISSILE_DMG_SCALE 1
#define IFV_DMG_SCALE 1
#define TANK_DMG_SCALE 1
#define NYX_TRACK_DMG_SCALE 0.15

#define VORONA_SCALE 0.1
#define AA_SCALE 0.1
#define AT_SCALE 0.1
#define RPG_SCALE 0.1
#define OTHER_SCALE 0.1



params ["_vehicle", "_selection", "_damage", "_source", "_ammo", "_ammo1", "_ammo2", "_ammo3", "_ammo4", "_isMissile","_isMissile1","_isMissile2","_isMissile3","_isMissile4", "_instigator", "_hitPoint"];

if (_selection != "?") then
{
	_isHeli = _vehicle isKindOf "Helicopter";

	if (_isHeli && _selection == "fuel_hit") exitWith
	{
		_damage = 0.05; // Block goddamn fuel leak
	};

	_oldDamage = [_vehicle getHit _selection, damage _vehicle] select (_selection isEqualTo "");

	if (!isNil "_oldDamage") then
	{
		_isPlane = _vehicle isKindOf "Plane";

		if (isNull _source && _ammo == "") exitWith // Reduce collision damage
		{
			_scale = switch (true) do
			{
				case (_selection select [0,5] == "wheel"): { WHEEL_COLLISION_DMG_SCALE };
				case (_isPlane):                           { PLANE_COLLISION_DMG_SCALE };
				default                                    { COLLISION_DMG_SCALE };
			};

			_damage = ((_damage - _oldDamage) * _scale) + _oldDamage;
		};

		_isMissile = _ammo isKindOf "RPG32_F"; //"MissileBase"; // ({_ammo isKindOf _x} count ["R_PG32V_F", "M_NLAW_AT_F", "M_Titan_AT", "M_Titan_AA", "M_Air_AA", "M_Scalpel_AT", "Missile_AGM_02_F", "Missile_AA_04_F"] > 0);

		_isMissile1 = _ammo1 isKindOf "Vorona_HEAT"; // ({_ammo isKindOf _x} count ["R_PG32V_F", "M_NLAW_AT_F", "M_Titan_AT", "M_Titan_AA", "M_Air_AA", "M_Scalpel_AT", "Missile_AGM_02_F", "Missile_AA_04_F"] > 0);

		_isMissile2 = _ammo2 isKindOf "Titan_AA"; // ({_ammo isKindOf _x} count ["R_PG32V_F", "M_NLAW_AT_F", "M_Titan_AT", "M_Titan_AA", "M_Air_AA", "M_Scalpel_AT", "Missile_AGM_02_F", "Missile_AA_04_F"] > 0);

		_isMissile3 = _ammo3 isKindOf "Titan_AT"; // ({_ammo isKindOf _x} count ["R_PG32V_F", "M_NLAW_AT_F", "M_Titan_AT", "M_Titan_AA", "M_Air_AA", "M_Scalpel_AT", "Missile_AGM_02_F", "Missile_AA_04_F"] > 0);

		_isMissile4 =  ({_ammo4 isKindOf _x} count [ "MRAWS_HEAT_F", "MRAWS_HEAT55_F"] > 0);






		switch (true) do
		{
			case (_vehicle isKindOf "VTOL_01_base_F"):// blackfish
			{
				if (_isMissile) then
				{
					_damage = ((_damage - _oldDamage) * VTOL_MISSILE_DMG_SCALE) + _oldDamage;
				};
			};
			case (_vehicle isKindOf "VTOL_02_base_F")://xian
			{
				if (_isMissile) then
				{
					_damage = ((_damage - _oldDamage) * VTOL2_MISSILE_DMG_SCALE) + _oldDamage;
				};
			};

			// If vehicle is heli and projectile is missile then multiply damage
			case (_isHeli):
			{
				if (_isMissile) then
				{
					_damage = ((_damage - _oldDamage) * HELI_MISSILE_DMG_SCALE) + _oldDamage;
				};
			};

			// If vehicle is plane and projectile is missile then multiply damage
			case (_isPlane):
			{
				if (_isMissile) then
				{
					_damage = ((_damage - _oldDamage) * PLANE_MISSILE_DMG_SCALE) + _oldDamage;
				};
			};

			// If vehicle is Nyx light tank then reduce track damage
			case (_vehicle isKindOf "LT_01_base_F"):
			{
				if (_hitPoint in ["hitltrack","hitrtrack"]) then
				{
					_damage = ((_damage - _oldDamage) * NYX_TRACK_DMG_SCALE) + _oldDamage;
				};
			};

			// If vehicle is tank then multiply damage
			case (_vehicle isKindOf "Tank"): //&& !(_vehicle isKindOf "LT_01_base_F")):
			{
				//if (_isMissile) then
				//{
					#define TANKTYPE_DMG_SCALE ([TANK_DMG_SCALE, IFV_DMG_SCALE] select ({_vehicle isKindOf _x} count ["APC_Tracked_01_base_F","APC_Tracked_02_base_F","APC_Tracked_03_base_F"] > 0))
					_damage = ((_damage - _oldDamage) * TANKTYPE_DMG_SCALE) + _oldDamage;
				//};
			};


			// If vehicle is MRAP and projectile is missile then multiply damage
			case ({_vehicle isKindOf _x} count ["MRAP_01_base_F", "MRAP_02_base_F", "MRAP_03_base_F"] > 0):
			{
//							if (_isMissile) then
//   			{
//					_damage = ((_damage - _oldDamage) * MRAP_MISSILE_DMG_SCALE) + _oldDamage;
//				};
//							if (_isMissile1) then
//   			{
//					_damage = ((_damage - _oldDamage) * VORONA_SCALE) + _oldDamage;
//				};
//							if (_isMissile2) then
//   			{
//					_damage = ((_damage - _oldDamage) * AA_SCALE) + _oldDamage;
//				};
//							if (_isMissile3) then
//   			{
//					_damage = ((_damage - _oldDamage) * AT_SCALE) + _oldDamage;
//				};
//							if (_isMissile4) then
//   			{
//					_damage = ((_damage - _oldDamage) * OTHER_SCALE) + _oldDamage;
//				};

                _scaleMRAP = switch (true) do
                {
                    case (_isMissile1): { VORONA_SCALE };
                    case (_isMissile2): { AA_SCALE };
                    case (_isMissile3): { AT_SCALE };
                    case (_isMissile4): { RPG_SCALE };
                    default                                    { OTHER_SCALE };
                };





			};
		};
	};

	[_vehicle, _selection, _damage, _source, _ammo, _ammo1, _ammo2, _ammo3, _ammo4, _scaleMRAP, _instigator, _hitPoint] call vehicleHitTracking;
};

_damage


Is there a way how to do that?
(reply in the way that you are trying to explain something to your loved one and they dont get it ) 

Thanks in advance 



 

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  

×