Explosive burning barrels

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Explosive burning barrels

Postby rabidrage » Wed Apr 07, 2021 3:23 pm

I've been trying to make different variations of the code I'm about to post work, but all it does so far is strange, obnoxious things.

Code: Select allExpand view
Actor ParticleBurningBarrel replaces BurningBarrel
{
  +SOLID
  +SHOOTABLE
  +NOBLOOD
  +DONTGIB
  +NOICEDEATH
  -NOGRAVITY
   Mass          0x7FFFFF
   radius 16
   height 34
   health 20
   States
   {
   Spawn:
      TNT1 A 0
      GoTo Spawn2
   Spawn2:
      //FCAN D 0 A_SpawnItemEx("ParticleFireSMP", Random(-10, 0), Random(-10, 0), Random(0, 8), (0.001)*Random(10, 200), (0.001)*Random(10, 600), (0.001)*Random(100, 700), 0, 0, 172)
      TNT1 A 0 A_SpawnItemEx("ParticleFireBarrel", 0, 0, 0, 0, 0, 0, 0.0)
      //TNT1 A 5 Light("FIP") A_SpawnItemEx("ParticleFireWall", 0, 0, 30, 0, 0, (0.001)*Random(100, 400), 0.0)
      GoTo Spawn3
   Spawn3:
      FCAN D 200 A_PlaySound("world/fire",2,0.2,false,2)
      loop
      death:
      FCAN A 5 bright A_LoopActiveSound
      TNT1 A 0 bright A_Scream
      TNT1 A 0 bright A_SpawnItemEx ("SFXBarrelExplosion",0,0,25,0,0,0,0,0)
      TNT1 A 0 bright A_Explode
      TNT1 A 0 bright A_SetTranslucent (0)
      TNT1 A 0 A_BarrelDestroy
      TNT1 A 0 A_Respawn
   }
}

Actor ParticleFireBarrel
{
  +NOBLOOD
  +ACTIVATEMCROSS
  +DONTGIB
  +NOICEDEATH
   +SHOOTABLE
   speed 0
   radius 19
   height 30
   SeeSound "world/fire"
   States
   {
   Spawn:
      TNT1 A 0 A_PlaySound("world/fire",2,0.2,true,2)
      //TNT1 A 0 A_CheckSight("NoLos")
      TNT1 A 0 A_Explode(2, 2, XF_NOTMISSILE, false)
      TNT1 A 0 A_CustomMeleeAttack(random(1,10)*6,"none","none","fire",false)
      TNT1 A 0 A_SpawnItemEx("ParticleFireSMP", Random(-6, 6), Random(-6, 6), Random(14, 15), (0.001)*Random(10, 300), (0.001)*Random(10, 300), (0.001)*Random(800, 1800), 0, 0, 172)
      TNT1 A 0 A_SpawnItemEx("ParticleFireSMPLighter", Random(-6, 6), Random(-6, 6), Random(14, 15), (0.001)*Random(10, 300), (0.001)*Random(10, 300), (0.001)*Random(800, 1800), 0, 0, 172)
      TNT1 A 0 A_SpawnItemEx("ParticleFireSMP", Random(-6, 6), Random(-6, 6), Random(14, 15), (0.001)*Random(10, 300), (0.001)*Random(10, 300), (0.001)*Random(800, 1800), 0, 0, 172)
      TNT1 A 0 A_SpawnItemEx("ParticleFireSMPLighter", Random(-6, 6), Random(-6, 6), Random(14, 15), (0.001)*Random(10, 300), (0.001)*Random(10, 300), (0.001)*Random(800, 1800), 0, 0, 172)
      TNT1 A 0 A_SpawnItemEx("ParticleFireSMP", Random(-6, 6), Random(-6, 6), Random(14, 15), (0.001)*Random(10, 300), (0.001)*Random(10, 300), (0.001)*Random(800, 1800), 0, 0, 172)
      TNT1 A 0 A_SpawnItemEx("ParticleFireSMPLighter", Random(-6, 6), Random(-6, 6), Random(14, 15), (0.001)*Random(10, 300), (0.001)*Random(10, 300), (0.001)*Random(800, 1800), 0, 0, 172)
      TNT1 A 0 A_SpawnItemEx("ParticleFireSMP", Random(-6, 6), Random(-6, 6), Random(14, 15), (0.001)*Random(10, 300), (0.001)*Random(10, 300), (0.001)*Random(800, 1800), 0, 0, 172)
      TNT1 A 0 A_SpawnItemEx("ParticleFireSMPLighter", Random(-6, 6), Random(-6, 6), Random(14, 25), (0.001)*Random(10, 300), (0.001)*Random(10, 300), (0.001)*Random(800, 1800), 0, 0, 172)
      TNT1 A 8 Light("FIP") A_SpawnItemEx("ParticleFireFlames", Random(-3, 3), Random(-3, 3), Random(19, 33), (0.001)*Random(40, 200), (0.001)*Random(10, 200), (0.001)*Random(350, 600), 0, 0, 64)
        LOOP

   NoLos:
       TNT1 A 1
       Goto Spawn
   }
}


What you are seeing is a combination of a few things. A Decorate definition for a 3D model burning barrel that spawns the particle fire from B4Doom. All I want to do is to make this thing shootable, and make it explode just like the regular barrels. The problem is that in some variations it takes like a million shots to detonate, while in others it detonates when it spawns (and, as an added bonus, makes all other explosive barrels detonate right away for some reason. Like, I do IDCLEV23 and as soon as I spawn in, the barrels all blow up and kill me.

What is the solution? Where is the balance??
rabidrage
 
Joined: 28 Oct 2014

Re: Explosive burning barrels

Postby Jarewill » Wed Apr 07, 2021 4:22 pm

ParticleFireBarrel calls 2 damaging functions: A_Explode and A_CustomMeleeAttack.
Those functions deal damage to the barrel and cause it to explode instantly.

To fix this either comment out the damage functions or give DamageType "Fire" property to ParticleFireBarrel and DamageFactor "Fire", 0 property to ParticleBurningBarrel.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Explosive burning barrels

Postby rabidrage » Wed Apr 07, 2021 4:31 pm

Dude! Don't know how I missed that. Or why they would be there.
rabidrage
 
Joined: 28 Oct 2014

Re: Explosive burning barrels

Postby ramon.dexter » Wed Apr 07, 2021 11:42 pm

Looks like a barrel from brutal doom. Brutal doom is full of such dirty hacks.
User avatar
ramon.dexter
rudebwoy
 
Joined: 20 Oct 2015
Location: Kozolupy, Bohemia
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support


Return to Scripting

Who is online

Users browsing this forum: 4page and 0 guests