Jump to content
Reeveli

Registering damage on prop objects

Recommended Posts

So I am trying to create a situation where there is critical information on computer terminal that the players are trying to get. The catch is that if the players accidentally shoot the computer during the firefight it is destroyed (they wont get the option of accessing its files). My problem is how to achieve this. The computer (or as far as I know all prop items like barrels, crates, soda cans etc) objects do not register damage from bullets/grenades so a simple trigger with if (damage computer <0) condition will not work. I will however note that it is possible to manually set the damage on the object using the setDamage command (from example from debug menu) while in-game. However I would rather not have to worry about such minutiae if I am zeusing a hectic mission.

The 'Hit' and 'Dammaged' eventhandlers are also not registering on the prop objects so using them will not work. An alternative I thought was to use the 'Fired' and/or 'EpeContactEnd' eventhandlers to track the bullets fired by the players to see if they end up hitting the computer. This however does not sound to me like a performance friendly solution, especially since I would also like to have possibility for an AI to damage the computer by accident (thus greatly increasing the tracked bullets). I guess I could try to only add the eventhandler to units only when the move to the vicinity of the computer and removing the EHs afterwards in an effort to reduce the amount of bullets tracked.

If someone here would have a more elegant solution in mind please share your thoughts.

Edited by Reeveli

Share this post


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

What about allowDamage false?

Not sure what you are referring to. I specifically want to allow the prop to be damaged.

Share this post


Link to post
Share on other sites

You want to disable the damage of the computer but still be able to damage it? What?

Share this post


Link to post
Share on other sites

Poor wording on my part, first post updated to correct this. What I meant is that the players are not allowed to damage the computer in order to get the intel out of it. From a scripting perspective I definitely want to allow the computer to be damaged. The problem is that short of manually setting the damage I haven't found out any good ways of achieving this dynamically.

Share this post


Link to post
Share on other sites

The "HitPart" EH fires for these kind of objects.

 

1 hour ago, Reeveli said:

What I meant is that the players are not allowed to damage the computer in order to get the intel out of it.

Spoiler

giphy.gif?cid=790b7611b1e2db4569dd1de484

 

  • Like 1

Share this post


Link to post
Share on other sites

This may not be perfect, but it's a possible solution.

 

You could place a water balloon in front of the computer, and remove the texture of the balloon so you don't see it. If the balloon is hit, it will be destroyed. So you would not be registering a hit on the computer, but the balloon.

 

The down side to using the water balloon is that when it's hit, you get the effect of a water splash. 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites
6 minutes ago, 7erra said:

The "HitPart" EH fires for these kind of objects.

Beat me to it, was just checking and it works nicely.

Share this post


Link to post
Share on other sites
12 minutes ago, Harzach said:

Beat me to it, was just checking and it works nicely.

 

 

Could you post the code you used to do that?

Share this post


Link to post
Share on other sites
10 minutes ago, 7erra said:

The "HitPart" EH fires for these kind of objects.

 

  Reveal hidden contents

giphy.gif?cid=790b7611b1e2db4569dd1de484

 

Didn't know that, I was assuming the 'HitPart' was using same detection model as 'Hit' or 'Dammaged'.

Just because you can recover stuff afterwards from a hard drive doesn't mean careless fire discipline is the desired form of gameplay on every mission.

Share this post


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

Could you post exactly how you set that up?

 

this addEventHandler ["HitPart", {
    (_this select 0) params ["_target", "_shooter", "_projectile", "_position", "_velocity", "_selection", "_ammo", "_vector", "_radius", "_surfaceType", "_isDirect"];
    systemChat "You shot the laptop, dummy.";
}];

 

  • Thanks 1

Share this post


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

 


this addEventHandler ["HitPart", {
    (_this select 0) params ["_target", "_shooter", "_projectile", "_position", "_velocity", "_selection", "_ammo", "_vector", "_radius", "_surfaceType", "_isDirect"];
    systemChat "You shot the laptop, dummy.";
}];

 

 

Awesome, thank you sir.

Share this post


Link to post
Share on other sites

Of course, you can get as complex as you'd like regarding how you handle the hitPart events.

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

×