Jump to content
Prejudice

How to make crew within a specific Vehicle invulnerable

Recommended Posts

Hey there, 

Currently im running a small server for myself and some friends, we have run into the Problem that our tanks are just far too vulnerable, 

 

I've tried Reducing damage to them, I've tried a multitude of scripts and other users help but I can't seem to find a way around it, 

So what I'm wanting to do is make players inside a specific vehicle, invulnerable (I want players in a tank to be invulnerable but players inside a helicopter for example to still be vulnerable, That way, the tank will be fully disabled but the crew can sit inside until the tank is entirely destroyed etc etc. 

 

I tried this bit of code but it doesn't seem to be working

 

_unit = _this select 0;
 
_unit addEventHandler ["HandleDamage",{
   _unit = _this select 0;
   _vehicle = vehicle _unit;
   _checkVehicles = ["vn_b_armor_m41_01_01"];
   if !((_unit == _vehicle) && (_vehicle in _checkVehicles)) exitWith {0};
}];

 

Share this post


Link to post
Share on other sites

Really?

You should try:

allowCrewInImmobile and setUnloadInCombat commands before attempting "invulnerable crew"... or "tank"... but destroyable... Difficult to follow you.

 

An invulnerable tank:

 

this (or _tank) addEventHandler ["handleDamage", {0}];  // apply to tank!

 

invulnerable crew while in tank:
 

{
  _x addEventHandler ["handleDamage", {
    params ["_unit", "", "_dam"];
    if (typeOf objectParent _unit in ["vn_b_armor_m41_01_01"]) then {_dam = 0};
    _dam
  }]
} forEach allUnits;  // or allPlayers, or...

 

Share this post


Link to post
Share on other sites

Sorry for the Vague description. 

I'm using ACE so destroying a tank is close to impossible with the Advanced Damage system turned on, Instead of the tank blowing up, Everything just goes red and it's fully disabled. Then the crew inside will most likely be killed from penetration or explosions etc. 
 

Hopefully thats a bit easier to follow. 

So basically i'm wanting to crew to be able to remain in the tank for cover and my thoughts is just making them invulnerable while inside the tank. 

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

Really?

You should try:

allowCrewInImmobile and setUnloadInCombat commands before attempting "invulnerable crew"... or "tank"... but destroyable... Difficult to follow you.

 

An invulnerable tank:

 

this (or _tank) addEventHandler ["handleDamage", {0}];  // apply to tank!

 

invulnerable crew while in tank:
 


{
  _x addEventHandler ["handleDamage", {
    params ["_unit", "", "_dam"];
    if (typeOf objectParent _unit in ["vn_b_armor_m41_01_01"]) then {_dam = 0};
    _dam
  }]
} forEach allUnits;  // or allPlayers, or...

 



The above hasn't seemed to have worked. 

 

Share this post


Link to post
Share on other sites

If you are using Eden enhanced mode, check the option "Forbid disembarking" in-vehicle spacial states list. Not tested, but it should do exactly what you are asking

Share this post


Link to post
Share on other sites
3 minutes ago, Nemanjic said:

If you are using Eden enhanced mode, check the option "Forbid disembarking" in-vehicle spacial states list. Not tested, but it should do exactly what you are asking

So I don't think it will, 

the issue is that the Crew just dies or passes out inside the tank due to the damage they've taken

Share this post


Link to post
Share on other sites
41 minutes ago, Nemanjic said:

Do you mean they die of an impact?

If you want them to live no matter what then, https://community.bistudio.com/wiki/allowDamage

Not too sure how Ace handles Damage when a vehicle is hit, but you essentially fall unconcious in the tank from an impact or from recieving damage, 

I am wanting to use allowDamage false, but the issue is that there is alot of other vehicles and alot of walking around, I pretty much only want them to be indestructible while inside the vehicle only

Share this post


Link to post
Share on other sites

crew1 init this allowDamage false

crew2 init this allowDamage false

 

Set up a trigger

cond:

!alive tank1

onAct:

crew1 allowDamageTrue;

crew2 allowDamage true;

Share this post


Link to post
Share on other sites
22 hours ago, Prejudice said:



The above hasn't seemed to have worked. 

 

 

But tested with some other tanks. My crew never die before the tank are destroyed, then disembark, then can be killed as any infantry.

So, check your script, and say what you need exactly.

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

×