Jump to content
JB47394

Damaging Land_SatellitePhone_F

Recommended Posts

If I have a satellite phone that I want players to be able to disable, I can put an action on it.  They walk up, trigger the action and it's disabled.  No muss, no fuss.

 

But my players are equipped with all manner of weapons.  Rifles, bombs, grenades, explosives, etc.  I want them to be able to destroy that phone.  I can't figure out a way to make that happen, or even to respond as if it was happening.

 

It doesn't take any damage.  I've tried enableSimulation and allowDamage.

It doesn't take any event handlers that would allow me to detect impacts.  I've tried Hit and HandleDamage.

 

The only thing that occurs to me now is to attach some kind of proxy object to the phone (or attach the phone to it) so that when it gets destroyed, I can detect that.  But I don't know of any innocuous or special objects where hits or destruction can be damaged.  Or am I missing some other technique that turns these objects into something that can be damaged?

Share this post


Link to post
Share on other sites

I had a similar problem in my mission Property of Mabunga, I had Lanterns on docks that I wanted to extinguish if the Lantern was shot. There are 2 lantern objects:  one is lit, and the other is not lit.  They do not take damage, but they are physics enabled.  So I simply checked for a position change of the lantern, and use that to determine the lantern was "hit".  When object's position changed,  I replaced the lit lantern with an unlit lantern object.  It worked great.  Maybe you can do the same with the sat phone.  Note that I also set the lantern's mass to .02 so it was easily moved by a bullet hit or explosion.  Here's the script:

// **********************************************************************
// Extinguish lantern when its shot, blown up, knocked over (i.e., moved in any way)
// Note: lantern1 is an editor placed object of type "Land_Camping_Light_on_F"
// **********************************************************************
[lantern1] spawn {
    sleep 1; 
    _lantern = _this select 0; 
    _origMass = getmass _lantern; 
    _origPos = getPos _lantern;
    _origMass = getmass _lantern;
    _lantern setMass .02;
    waituntil {sleep .2; !(_origPOs isEqualTo  (getpos _lantern))};
    _lamp2= "Land_Camping_Light_off_F" createVehicle [0,0,0];
    _lamp2 setdir getdir _lantern;
    _lamp2 setvelocity velocity _lantern;
    _pos = getpos _lantern;
    deleteVehicle _lantern;
    _lamp2 setpos _pos;
    _lamp2 setMass _origMass;
};

Good luck and happy editing!

Share this post


Link to post
Share on other sites

Thanks, that's certainly not something that would have occurred to me.  Unfortunately, it's a little too delicate a solution, so I'll just have to use other means that ARMA can handle a bit more robustly.

  • Like 1

Share this post


Link to post
Share on other sites

np dude.  I hope you find what works for you.  Arma scripting can get frustrating, so its good to think outside the box, and be flexible to a less than optimal solution sometimes.  That way you can move forward on you broader project goals (whatever those are).

Share this post


Link to post
Share on other sites

use getDammage to check to see if damage changes (even if it isn't visible) after shooting at it, etc.  If it does, have a condition that checks to see if it equals 0.  From there you could delete the object to simulate it being destroyed, or even swap it with another junky looking object.  I honestly don't know if this would work and I'm not home at the moment to test. 

 

Share this post


Link to post
Share on other sites

You could test the EPEContactStart EH

this addEventHandler ["EpeContactStart", {hint str _this}];

 

1 Fine for bullets, charges, a little bit weird for hand grenades (too quick, too sensitive)

2 you have to remove the first contact(s) (ground, table...). Generally two. Test with:

st = 0; this addEventHandler ["EpeContactStart", {st = st + 1; if (st >0) then {hint str [_this,st]}}];

and adjust the condition (st>2) should work.

Share this post


Link to post
Share on other sites
On 8/31/2017 at 0:43 PM, zigzagtshirt said:

use getDammage

 

If you read the base post, you'll notice that the object cannot take damage.  Also, I could find no small, damaged objects.  In general, things like this are just considered background props and aren't intended to be manipulated.

 

23 hours ago, pierremgi said:

You could test the EPEContactStart EH

 

I certainly greatly prefer events over polling loops.  However, that's ultimately the same solution that @johnnyboy presented; detect a large enough force.  If the only thing I was doing was detecting the hit, I'd go with the event.  As it turns out, I have a loop that manages playing sound through the satellite phone, so I'm going to stick with what I have - which is @johnnyboy's approach.

 

Reduce the mass of the phone by half, and watch for movement in a polling loop (or a significant force via the event handler).  When I see movement, I turn off the sounds, throw some particle effects on the phone, and it's clear that it's not going to work anymore.

 

The only question now is whether the technique will survive contact with a full server of players.

  • Like 1

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

×