Jump to content
jazzer12369

Vehicle disable, but not destroy

Recommended Posts

I'm looking for a way to stop a specific vehicle from being able to be blown up. I want the hull and engine to be invincible, so that the vehicle won't explode when hit, but the wheels should still be vulnerable so that it can still be disabled, just not destroyed/blown up. 

 

I'm looking for this to be achieved within the vehicles init field, or via an external script. The reason I want this to be possible is because I don't want a simple vehicle respawn in my mission like I have now. I want to punish players for getting a vehicle blown up, making them have to airlift the damaged vehicle back to base where it can be repaired (I don't need help with the airlift or repairs I've got that covered, just need help on making the vehicles hull and engine invulnerable.)   

 

Are there any scripts out there which can help me a achieve this? I was looking into the "SetHit" functionality etc but I am a total noob when it comes to scripting. To be completely honest with you I'd love for someone to figure this out for me as I really don't have a lot of time to dedicate to testing and playing about with things myself :don11:

Share this post


Link to post
Share on other sites
this addEventHandler ["HandleDamage",{(_this#7 in ["hitlfwheel","hitlbwheel","hitlmwheel","hitlf2wheel","hitrfwheel","hitrbwheel","hitrmwheel","hitrf2wheel"])}]

The code is showing how to deal with on the Marshall. Change the array to use on other vehicles.

 

There are two ways to implement.

this addEventHandler ["HandleDamage",{(_this#7 in [/*HitPoints to break*/])}]
this addEventHandler ["HandleDamage",{!(_this#7 in [/*HitPoints to protect*/])}]

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

This is fantastic mate thanks for this.

 

I've got this working for a hunter now simply by changing the wheels in the array like you suggested.

 

Just a quick question about one of the parameters, what does the "(_this#7" mean? I understand the rest for the most part but I haven't seen this before. I'm quite interested in how it all works. Also, how would this be adapted for a tracked or fixed wing vehicle for example? 

 

 

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage

Quote

unit: Object - Object the event handler is assigned to.
hitSelection: String - Name of the selection where the unit was damaged. "" for over-all structural damage, "?" for unknown selections.
damage: Number - Resulting level of damage for the selection.
source: Object - The source unit that caused the damage.
projectile: String - Classname of the projectile that caused inflicted the damage. ("" for unknown, such as falling damage.)
hitPartIndex: Number - Hit part index of the hit point, -1 otherwise.
instigator: Object - Person who pulled the trigger
hitPoint: String - hit point Cfg name

I think you can disable simulation as well. Note: Once you enable simulation again, the vehicle will be destroyed or whatever damage was dealt before restores. Best approach is HandleDamage EH as @POLPOX said.

Share this post


Link to post
Share on other sites
3 hours ago, jazzer12369 said:

@HazJ @pierremgi 

 

This is great stuff ladies thank you very much! @POLPOX nailed exactly what I needed, awesome stuff all round. 

Definitely not a "lady" - Yup, just checked! Not sure about @pierremgi though? :happy::rofl::rofl:

  • Like 1
  • Haha 1

Share this post


Link to post
Share on other sites

Hi !

 

So I'm trying to adapt the code from @POLPOX for other vehicles. Right now, I'm triyng with the RHS M1165A1, and so far I have this :

this addEventHandler ["HandleDamage",{(_this#7 in ["hitlfwheel","hitlbwheel","hitrfwheel","hitrbwheel","hitengine"])}]

It's working fine for the 4 wheels and the engine, but I wish to make damageable the "turret" and the M2 & M240 mounted on it. I tried with "hitturret" and "hitgun" but that doesn't seem to work.

Any idea where I could find the names of these parts ? I looked in the config viewer but I did not find anything.

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

×