Page 1 of 1

How to spawn puff via A_FireBullets, even when actor hit?

Posted: Wed Aug 14, 2013 9:15 am
by newbiejackcity
So, the docs from the A_FireBullets function says,
Optionally you can specify a puff type that is spawned when hitting a wall or a non-bleeding actor. The puff also determines the damage type of the attack.
But, on the puff documentation, there's another note,
by default, puffs are only spawned as a result of a hitscan attack hitting a wall, or an actor with one or more of NOBLOOD, INVULNERABLE and DORMANT flags set. In order for puffs to appear in other circumstances, certain flags must be in effect on either the puff actor or the target actor. The ALWAYSPUFF flag applied to the puff actor makes it spawn even for missed attacks. The PUFFONACTORS flag applied to the puff actor will make it spawn (instead of Blood) even if the hit actor does not have any of the aforementioned flags.
However, I tried adding +PUFFONACTORS and +ALWAYSPUFF to a puff associated with A_FireBullets, and it doesn't seem to spawn on actors that bleed. What am I missing?

RE: How to spawn puff via A_FireBullets, even when actor hit?

Posted: Wed Aug 14, 2013 10:45 am
by Zupoman
Zdoom wiki says:
ALWAYSPUFF

Used on puff objects only. Makes the puff appear even when nothing was hit.
PUFFONACTORS

Used on puff objects only. A puff with this flag is spawned even if the actor being hit bleeds. Normally in such a case only blood is spawned but no puff.
Then, as wiki says, +ALWAYSPUFF has got nothing to do with it.

So if you add +PUFFONACTORS, it should spawn puffs. You say it does not, then it is either a Zandronum problem, or you are doing something wrong. Have you given that flag to the puff? Or have you given it to something else? Also try testing it with newest ZDoom, instead of Zandronum, it may be a Zandronum specific problem.

RE: How to spawn puff via A_FireBullets, even when actor hit?

Posted: Wed Aug 14, 2013 8:19 pm
by newbiejackcity
So if you add +PUFFONACTORS, it should spawn puffs. You say it does not, then it is either a Zandronum problem, or you are doing something wrong. Have you given that flag to the puff? Or have you given it to something else? Also try testing it with newest ZDoom, instead of Zandronum, it may be a Zandronum specific problem.
The flag is set on the puff. Here's the code where the A_FireBullets call is made.

Code: Select all

ACTOR Boomstick : Weapon
{
	Weapon.AmmoUse 			1
	Weapon.AmmoGive 		8
	Weapon.AmmoType			"Shell"
	Inventory.PickupMessage		"You got the Boomstick!"
	Obituary			"%o got blasted by %k's Boomstick."
        PoisonDamage                    5000000
	
	Weapon.UpSound			"w2/load"
	AttackSound			"w2/fire"
	
	States
	{
		Ready:
			W2E1 A 1 A_WeaponReady
			goto Ready
		Deselect:
			W2E1 A 1 A_Lower
			W2E1 A 0 A_Lower
			goto Deselect
		Select:
			W2E1 A 1 A_Raise
			W2E1 A 0 A_Raise
			goto Select
		Fire:
			W2E1 A 3 A_GunFlash
			W2E1 A 7 A_FireBullets(6, 6, 7, 0, "BulletPuff_Explosive")
			W2E1 BC 5
			W2E1 D 4 A_PlayWeaponSound("w2/load")
			W2E1 D 0 A_FireCustomMissile("splatShellCasing", 45 + random(-8,8), 0, 2, 3)
			W2E1 CB 4
			W2E1 A 10 A_Refire
			goto Ready
		Flash:
			SHTF A 2 bright A_Light1
			SHTF B 2 Bright A_Light2
			Goto LightDone
	}
}
And here's the bit where BulletPuff_Explosive is defined. It works when walls are hit (i.e., BulletPuff_ExplosiveRemains is spawned), but this doesn't happen when an actor is hit. I've also tried simpler puffs with the +PUFFONACTORS flag set, and no luck was had there either.

Code: Select all

ACTOR BulletPuff_Explosive
{	
	RenderStyle			Translucent
	Alpha				0.66
	Scale				0.66
	VSpeed				1
	Mass				5
	+NOBLOCKMAP
	+NOGRAVITY
	+ALLOWPARTICLES
	+RANDOMIZE
	+PUFFONACTORS	
	States
	{
		Spawn:
			BAL1 CD 4 bright
		Melee:
			BAL1 E 4 bright
			stop
		Crash:
			BAL1 C 4 bright
			BAL1 D 4 bright  A_SpawnItemEx("BulletPuff_ExplosiveRemains")
			BAL1 C 4 bright
			stop
	}
}
(This code is actually from Shotgun Frenzy 1.4, BTW, though slightly modified at this point).

Unfortunately, this mod doesn't work on ZDoom, but I'll set up a simpler test case to test in both Zandronum and ZDoom when I get a chance.
Well, it looks like +PUFFONACTORS doesn't work in Zandronum. Here's my test case, in case anyone else wants to verify.

DECORATE.TXT

Code: Select all

#include "newpuff.txt"
NEWPUFF.TXT

Code: Select all

ACTOR NewPuff : BulletPuff replaces BulletPuff
{
  Game Doom
  SpawnID 131
  +NOBLOCKMAP
  +NOGRAVITY
  +ALLOWPARTICLES
  +RANDOMIZE
  +PUFFONACTORS
  RenderStyle Translucent
  Alpha 0.5
  VSpeed 1
  Mass 5
  States
  {
  Spawn:
    BFS1 AB 4 Bright
    BFE1 AB 8 Bright
    //BFGG A 4 Bright
    //BFGG B 4
    // Intentional fall-through
  Melee:
    BFS1 AB 4 Bright
    Stop
  }
}
Behavior in ZDoom: As expected, BFG animations happen when bullets strike both actors and walls.

Behavior in Zandronum: BFG animations happen when bullets strike walls only, not when actors are struck.

Does anyone know if this flag is intentionally not supported in Zandronum, or is this a bug?

RE: How to spawn puff via A_FireBullets, even when actor hit?

Posted: Wed Aug 14, 2013 8:54 pm
by President People
-ALLOWPARTICLES doesn't work either, last I checked (particles spawn regardless), but I haven't gotten around to creating a ticket for that yet.

RE: How to spawn puff via A_FireBullets, even when actor hit?

Posted: Wed Aug 14, 2013 10:08 pm
by newbiejackcity
President People wrote: -ALLOWPARTICLES doesn't work either, last I checked (particles spawn regardless), but I haven't gotten around to creating a ticket for that yet.
Interesting.

I wouldn't care too much about the +PUFFONACTORS if it was just an aesthetic thing, but Shotgun Frenzy uses it for the "explosive" damage part of the explosive shot, and I can't think of another way to do it short of modifying the weapon to both A_FireBullets and shoot a projectile. Right now, the explosive shot only works when it strikes walls and non-bleeding actors, which kinda gimps the gun.

Edit: I filed a ticket for the +PUFFONACTORS issue.

RE: How to spawn puff via A_FireBullets, even when actor hit?

Posted: Mon Aug 19, 2013 1:14 am
by newbiejackcity
If anyone else comes across a similar issue, I resolved this by basically using inheritance to modify every existing actor which bleeds, and added +NOBLOOD. It's a hack, but it seems to work for nowl.

RE: How to spawn puff via A_FireBullets, even when actor hit?

Posted: Mon Aug 19, 2013 1:39 am
by Ijon Tichy
funny, because PUFFONACTORS sure works fine with samsara with the thunderbolt

RE: How to spawn puff via A_FireBullets, even when actor hit?

Posted: Mon Aug 19, 2013 2:19 am
by newbiejackcity
Ijon Tichy wrote: funny, because PUFFONACTORS sure works fine with samsara with the thunderbolt
Weird. I guess maybe it works in some situations and not others? I did a lot of playing around / testing with puff flags on A_FireBullets puffs, and there's definitely something up with it. I uploaded a good test case to the bug report I filed.

RE: How to spawn puff via A_FireBullets, even when actor hit?

Posted: Mon Aug 19, 2013 2:24 am
by Ænima
Try this for now:

Code: Select all

ACTOR NewPuff : BulletPuff replaces BulletPuff
{
  Game Doom
  SpawnID 131
  +NOBLOCKMAP
  +NOGRAVITY
  +ALLOWPARTICLES
  +RANDOMIZE
  +PUFFONACTORS
  RenderStyle Translucent
  Alpha 0.5
  VSpeed 1
  Mass 5
  States
  {
  Spawn:
    BFS1 AB 4 Bright
    BFE1 AB 8 Bright
    //BFGG A 4 Bright
    //BFGG B 4
    // Intentional fall-through
  Melee:
  XDeath: //forces it to enter this state when hitting a bleeding actor
    BFS1 AB 4 Bright
    Stop
  }
}

RE: How to spawn puff via A_FireBullets, even when actor hit?

Posted: Mon Aug 19, 2013 8:11 am
by newbiejackcity
Ænima wrote: Try this for now:

Code: Select all

snip
Thanks! This is a cleaner solution than what I came up with.

RE: How to spawn puff via A_FireBullets, even when actor hit?

Posted: Mon Aug 19, 2013 2:12 pm
by Ænima
Does it work?

RE: How to spawn puff via A_FireBullets, even when actor hit?

Posted: Tue Aug 20, 2013 2:16 am
by newbiejackcity
Ænima wrote: Does it work?
Seems to work just fine. Works identically to changing the actors to +NOBLOOD.