Jump to content
Vectif

make players within vehicle & trigger immune to damage?

Recommended Posts

hello. I have a script I made to trigger a 'big' simulated explosion (albeit using a real IED with setDamage), but to make the vehicle not take critical damage, by making it immune to damage, then applying damage through commands, and then making it immune to damage again - therefore using a big explosive to achieve a visual effect that does not damage the vehicle to destruction. However, the player within the vehicle, if the vehicle is light enough (and not an MRAP, e.g. an SUV), will still take critical damage. Is there a way I can make the player immune to damage as long as they are within the trigger & inside the vehicle at the time of activation? Can I somehow detect *any* players within the trigger area at the time of the trigger's activation and disable their allowDamage briefly and then turn it back on afterwards? The trigger detects *any* vehicle and unit that enters and not a specific one, please keep this in mind, as it is a variable situation. Thanks!

Share this post


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

You should use the event handler "handleDamage". There are plenty of examples on forum, once you know the ammo class of your explosive and what you want to set up exactly.

 

I've already set up the explosives and classnames I want to be using, mostly for the visual effect, and to then apply damage manually. However it seems the explosion pierces thru light vehicles and injures the players. The vehicle has temporary godmode, the players in it do not. It works perfect in an MRAP as is, but not in a civilian vehicle for example. I could change the bomb type but it'd be a different effect, probably less astounding visually, but also an alternative.

Share this post


Link to post
Share on other sites

The EH "handledamage" can be applied to crew also, or... the EH on vehicle can have a code for the crew. As this EH fires as soon as the vehicle takes damage, the crew is not already impacted. Did you try this EH or not?

Share this post


Link to post
Share on other sites
On 3/31/2021 at 10:48 PM, pierremgi said:

The EH "handledamage" can be applied to crew also, or... the EH on vehicle can have a code for the crew. As this EH fires as soon as the vehicle takes damage, the crew is not already impacted. Did you try this EH or not?

would this need to be added in the vehicles init field or in the trigger's? Since I want to make sure it works for -any- vehicle that crosses, without having to set specific variable names for each item that could possibly interact with it.

Share this post


Link to post
Share on other sites

@Rhaonoa In case you haven't solved the problem already, the answer to your question is in the BI wiki link PierreMGI posted. 

You could simply create a new Event Handler for every unit that enters your trigger. Set trigger to "repeatable" and set up a forEach loop that creates a separate EventHandler for every "Man" type unit.

You could also consider using two triggers (one in the air, and one on the ground with a 5 second timer) setting allowDamage off and on forEach player.

 Hope that helps..

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

×