Jump to content
gc8

Destroying static objects

Recommended Posts

Hi

Unless I am mistaken the static objects like sandbags can't be destroyed in arma, am I right or has this been changed?

 

What the devs did add was HitPart EH that works even with static objects (Atleast as far as I know this is new).

 

So I created this script so you can shoot those sandbags with a tank and destroy them:


 

// Find all static objects in mission
_staObjs = nearestObjects [[0,0,0], ["static"], 7000000];

{

_x addEventHandler ["HitPart",
{

scopename "handleHitPart";

{
    _x params ["_target", "_shooter", "_projectile", "_position", "_velocity", "_selection", "_ammo", "_vector", "_radius", "_surfaceType", "_isDirect"];
    
    player globalChat format[" %1 %2 %3 %4 %5 ",_shooter, _target,_selection,_surfaceType,_ammo];
    
    _objDamage = _target getVariable ["objDamage",0];
    
    _ammo params ["_hit"];
    
    _objDamage = _objDamage + _hit;
    
    _target setVariable ["objDamage",_objDamage];
    
    if(_objDamage >= 100) then // Need some value other than 100 here
    {
     deleteVehicle _target;
     breakout "handleHitPart";
    };
    
 } foreach _this;
    
}];

} foreach _staObjs;

 

What this as very least needs is proper "hit points" for the static object etc

 

Edit: Terrain wall objects probably can't be deleted this way (deleteVehicle)

 

Any tips / help with this is appreciated!

 

thx!

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Not deleted but hidden

"static" is not a good filter. Too much things are static (gears on ground, tripods..;) use instead "building" (too much things are also buildings), "wall" ,"house"

Share this post


Link to post
Share on other sites
9 minutes ago, pierremgi said:

Not deleted but hidden

 

was thinking the same ... for terrain objects

 

if terrain objs supports setvariable

Share this post


Link to post
Share on other sites

Getting some confusion from this post: 

 

 

Possible or not?

Share this post


Link to post
Share on other sites

You're right It seems that some objects (returned by cursorObject with no class (typeOf)) can't get variable.

Share this post


Link to post
Share on other sites

Is it possible to detect if object is destroyable?

 

Share this post


Link to post
Share on other sites

I may have found it:  gettext (configfile >> "CfgVehicles" >> (typeof t) >> "destrType")

 

not sure

 

Share this post


Link to post
Share on other sites

Just a point:

Some objects can't get a variable but can be "damaged".

Example:

cursorObject : 130372: sidewalk_02_narrow_8m_f.p3d

* is detected by nearestTerrainObject

* typeOf cursorObject: ""

* cursorObject setVariable ["test",true]     ......   (cursorObject getVariable "test") stays Nil

* cursorObject setdamage 1   ......                        damage cursorObject  returns 1, but no visual change as there is no model for the damaged sidewalk

* hideObject cursorObject    .... works.  then isObjectHidden cursorObject  is true

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

cursorObject returns hidden objects?

strange

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

×