Jump to content
Sign in to follow this  
osmo

Repairing a Helicopter

Recommended Posts

I'm working on a service script that repairs a helicopter, and it seems in Take On Helicopters simply setting damage with setDamage-command is not enough.

We have commands setHitPointDamage and getHitPointDamage for this. However, there are a lot of different hit points. Is there a command to get list of all hitpoints of a helicopter? If I would want to completely fix the helicopter, I would need a command to get all available hitpoints so I can loop it through and set each of their damage to 0.

I noticed a list of some known hitpoints. One way might be to create setHitPointDamage command for every known hitpoint, but isn't there any easier way to repair a helicopter completely?

Edited by Osmo

Share this post


Link to post
Share on other sites

the hitpoints are defined as classes in the config space.

you could query the list for the current vehicle and check them one by one.

sorry cannot provide sample code right now

Share this post


Link to post
Share on other sites

@Osmo - the way BIS do it to check damage is to loop through each of the damage types checking them one by one (in BIS_fnc_helicopterCanFly). I guess you would just have to do the reverse using setHitPointDamage to repair the helicopter.

Share this post


Link to post
Share on other sites

private ["_hpClasses", "_hps"];
_hpClasses = configFile >> "CfgVehicles" >> (typeOf (vehicle player)) >> "HitPoints";
_hps = [];

for "_i" from 0 to ((count _hpClasses) - 1) do 
{
  private ["_hp"];
  _hp = _hpClasses select _i;
  if (isClass _hp) then {_hps set [count _hps, configName _hp];};
};

  • HitEngine
  • HitEngine2
  • HitEngine3
  • HitHull
  • HitHRotor
  • HitVRotor
  • HitBatteries
  • HitGlass1
  • HitGlass2
  • HitGlass3
  • HitGlass4
  • HitGlass5
  • HitRGlass
  • HitLGlass
  • HitMissiles
  • HitLight
  • HitHydraulics
  • HitTransmission
  • HitAvionics
  • HitGear
  • HitFuel
  • HitHStabilizerL1
  • HitHStabilizerR1
  • HitVStabilizer1
  • HitTail
  • HitPitotTube
  • HitStaticPort
  • HitStarter1
  • HitStarter2
  • HitStarter3

Share this post


Link to post
Share on other sites

Thanks for your reply!

With the above script, I got the following arrays:

Light:

["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitGlass5"]

Medium:

["HitEngine","HitEngine2","HitEngine3","HitHull","HitHRotor","HitVRotor","HitBatteries","HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitGlass5","HitRGlass","HitLGlass","HitMissiles","HitLight","HitHydraulics","HitTransmission","HitAvionics","HitGear","HitFuel","HitHStabilizerL1","HitHStabilizerR1","HitVStabilizer1","HitTail","HitPitotTube","HitStaticPort","HitStarter1","HitStarter2","HitStarter3"]

Heavy:

["HitEngine","HitEngine2","HitEngine3","HitHull","HitHRotor","HitVRotor","HitBatteries","HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitGlass5","HitRGlass","HitLGlass","HitMissiles","HitLight","HitHydraulics","HitTransmission","HitAvionics","HitGear","HitFuel","HitHStabilizerL1","HitHStabilizerR1","HitVStabilizer1","HitTail","HitPitotTube","HitStaticPort","HitStarter1","HitStarter2","HitStarter3"]

How come there is no engine / rotor /transmission etc hitpoints for light helicopters? Is there some other command to get those? In my experience, when I had damaged the transmission of my light helicopter, and I tried to fix it with only setDamage 0, the helicopter transmission remained damaged, so there must be some kind of transmission hitpoint in the light helicopters as well.

Is there any relation between setDamage and the hitpoint damages? What does setDamage exactly affect in Take On Helicopters? I see it at least brings back a destroyed rotor in the helicopter model when used.

Share this post


Link to post
Share on other sites

I've done some testing and it seems indeed the above command for Light Helicopter returns wrong list of hitpoints. Light helicopter has other hitpoints too such as "HitTransmission", although the command only returns those "HitGlass" hitpoints.

I'll have to find another way to look for what hitpoints are available for a certain vehicle, or perhaps just loop through all of them for all choppers-

Share this post


Link to post
Share on other sites

My quick script sample may not be able to fetch inherited classes. You'd have to also fetch the HitPoints classes from the parent classes of your helicopter (script command inheritsFrom).

Share this post


Link to post
Share on other sites

I found a BIS function that gets all of the available hitpoints for a chopper (BIS_fnc_helicopterGetHitpoints).

Code to call the function:

_hitpoints = _heli call BIS_fnc_helicopterGetHitpoints;

BIS_fnc_helicopterGetHitpoints:

private ["_cfgHitPoints", "_hps", "_funcGetHitPoints"];
_cfgHitPoints = configFile >> "CfgVehicles" >> (typeOf _this) >> "HitPoints";
_hps = [];

_funcGetHitPoints = 
{
for "_i" from 0 to ((count _this) - 1) do 
{
	private ["_hp"];
	_hp = configName (_this select _i);

	if (!(_hp in _hps)) then 
	{
		_hps set [count _hps, _hp];
	};
};
};

//Explore inheritance structure fully
while {(configName _cfgHitPoints) != ""} do 
{
_cfgHitPoints call _funcGetHitPoints;
_cfgHitPoints = inheritsFrom _cfgHitPoints;
};

_hps

Share this post


Link to post
Share on other sites

Funnily enough, I wrote that function I see now ... if my memory wouldn't fail me, could have saved some time ;)

Share this post


Link to post
Share on other sites

Would be interested to see your script when you are done Osmo as I need to write one myself for a mission I am doing - you would save me some time and I would probably learn something from what you have done. Also, it may come in handy in Xeno's port of Domination as that can only fix Arma helicopters at the moment.

@DnA - I don't suppose there are a few more helicopters lying around that you forgot you developed? ;-)

Share this post


Link to post
Share on other sites
Would be interested to see your script when you are done Osmo as I need to write one myself for a mission I am doing - you would save me some time and I would probably learn something from what you have done. Also, it may come in handy in Xeno's port of Domination as that can only fix Arma helicopters at the moment.

I've released a Beta version of the "Helicopter Service" script. It's nearly completed, next version will most likely be 1.0. This is actually conversion of a service script I've done for ArmA (never released it publicly, just used in my missions). The ArmA version is larger as it contains service for all kinds of vehicles. I'm going to update that script and release it publicly too in the future. You might also want to check out my other TKOH script (Helicopter Interaction). It is related to this one as it adds actions to inspect damage of helicopters.

Helicopter Service

Helicopter Interaction

Share this post


Link to post
Share on other sites

Thanks - Can't believe I forgot to try the interaction scripts! Anyway, both downloaded and I will give them a whirl tomorrow!

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  

×