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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
rabidrage
Posts: 36
Joined: Tue Oct 28, 2014 10:59 pm

Explosive burning barrels

Post by rabidrage »

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 all

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??
Jarewill
 
 
Posts: 1766
Joined: Sun Jul 21, 2019 8:54 am

Re: Explosive burning barrels

Post by Jarewill »

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.
rabidrage
Posts: 36
Joined: Tue Oct 28, 2014 10:59 pm

Re: Explosive burning barrels

Post by rabidrage »

Dude! Don't know how I missed that. Or why they would be there.
User avatar
ramon.dexter
Posts: 1529
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Explosive burning barrels

Post by ramon.dexter »

Looks like a barrel from brutal doom. Brutal doom is full of such dirty hacks.
Post Reply

Return to “Scripting”