za0 3 Posted January 31 Friends, I come to you again, great sages of Arma 3 codes to perhaps solve my current problem... This problem is as follows, I want a static object in my scenario to be destroyed if it takes any instance of damage. The object in question is "Land_PortableServer_01_olive_F". In the init field I tried to put a code that works perfectly on the units: this addEventHandler ["HandleDamage",{ _this spawn { if (_this select 2 > 0) then { _this select 0 setDamage 1; }; }}]; As I said, in units this code works. If I shoot the unit in the foot that has this code in its init, it will be immediate death. But as in the current case the code is in a static object, it doesn't work. I've already tried shooting all the bullets from my gun on this portable server, hand grenades, RPG, tank artillery... nothing happens xD I did a test to see if it is possible for this object to be destroyed by activating a trigger with the code: hard setDamage 1; Oh, the name of the object is "hard" by the way, because of hardware. And another trigger with the condition: !alive hard; Upon activation: hint "It worked"; And it worked... my test. But I wanted this object to be destroyed if it was hit by something, like the code there that works with the units as I explained. If that were possible, I could create a bad ending for the sci-fi mission I'm creating. Thank you in advance for your time! Share this post Link to post Share on other sites
Harzach 2517 Posted February 1 Static objects like the one you are using don't generally have "hit points" in the way that vehicles (using the Arma definition) do. One option you do have here is to use the hitPart EH. 1 Share this post Link to post Share on other sites
za0 3 Posted February 1 I read about HitPart EH, and tried to implement it in my game but I was unsuccessful. I even tried asking GPT chat to help me but it still didn't work. Here is an example of code that didn't work: this addEventHandler ["HitPart", { _target = _this select 0; if (typeName _target isEqualTo "Land_PortableServer_01_olive_F" && {alive _target}) then { _target setDamage 1; }; }]; It was worth a try, thanks for the idea anyway. Share this post Link to post Share on other sites
Harzach 2517 Posted February 6 Syntax is incorrect, see the wiki link I provided. Share this post Link to post Share on other sites
Harzach 2517 Posted February 7 @za0 - OK, a couple of items: Assuming you have placed your code in the init of your server object, "this" refers to the object, so your type check is redundant. It will only - can only - ever be the correct object. In the hitPart EH, the params array is actually a sub-array, as seen in the Wiki example. So _target would be (_this select 0) select 0. this addEventHandler ["HitPart", { (_this select 0) params ["_target", "_shooter", "_projectile", "_position", "_velocity", "_selection", "_ammo", "_vector", "_radius", "_surfaceType", "_isDirect"]; _target setDamage 1; }]; 1 Share this post Link to post Share on other sites
EO 11277 Posted February 7 On 1/31/2024 at 10:42 PM, za0 said: But I wanted this object to be destroyed if it was hit by something, like the code there that works with the units as I explained. You can add destruction effects to static objects with a config modification..... On 1/31/2024 at 10:42 PM, za0 said: The object in question is "Land_PortableServer_01_olive_F". Here's a link to a small mod that adds destruction effects to the olive portable server as requested.... https://www.dropbox.com/scl/fo/htb89qoj77kpsjwuob6xa/h?rlkey=sc1lghdoqzen5fhnynrryfab1&dl=0 1 Share this post Link to post Share on other sites
Harzach 2517 Posted February 7 11 hours ago, EO said: <destruction effects> My funny cat pictures! NOOOO 1 Share this post Link to post Share on other sites