I tried to do it once before but didn’t like the outcome. This time it is good enough to share. So basically in Arma 3 there are 3 barrel objects, empty, full and empty but with option to have a fire burning. The one we are going to use is “Land_MetalBarrel_F”, which also has a flammable sign. Since the sign doesn’t specify what is inside, we can just assume it has a really volatile mixture that should not even be shaken! 🙂
I often envy the modders, they can add remove objects, assign new properties to objects, like for example in this case it would have been so easy to make this barrel a bomb that detonate on impact. But trying to achieve the same with scripting only means you do not need to download mods, just the mission. Until BIS make mod requisition and initialisation as easy as connecting to a server and downloading the mission, I will continue focusing on this approach.
So I wanted to make this barrel a stand alone extra for a mission designer. Basically a bunch of barrels spawned on mission start in predefined locations and just stand there creating danger. Once barrel exploded, it is gone and doesn’t respawn, same principle as building destruction. The barrel will explode from bullet impact, nearby explosion, including that of another barrel, and if the barrel is moved.
I’m pretty sure there are other ways of doing the same thing, but I’m pretty happy with mine for now. I used “R_TBG32V_F” class warhead to create explosion because it has moderate destructive power, nice particle effect and convincing camera shake. As you can see from config, it also has anti infantry properties:
class R_TBG32V_F: R_PG32V_F { hit = 100; indirectHit = 50; indirectHitRange = 5; model = "\A3\weapons_f\launchers\RPG32\tbg32v_rocket.p3d"; CraterEffects = "ArtyShellCrater"; ExplosionEffects = "MortarExplosion"; allowAgainstInfantry = 1; class CamShakeExplode { power = "(110*0.2)"; duration = "((round (110^0.5))*0.2 max 0.2)"; frequency = 20; distance = "((5 + 110^0.5)*8)"; }; };
Because I used a bunch of local event handlers, barrels should be spawned on the server only. However putting them in place could be a bit tricky as they can explode when shaken, remember? So I added 1 second cooldown, so if the coordinates of barrel position are not very precise, the barrel will have 1 second to come to rest. And here is the code:
The array of barrel coordinates should be ASL (get individual coordinates with getPosASL player). It is nested and should also contain barrel direction. The example coordinates are for Stratis airfield, so create your own.
Enjoy,
KK