Page 1 of 2

How to make casings get crushed?

Posted: Mon Mar 13, 2017 10:02 pm
by Nevander
I have this code for casings which works well and even vanishes on sky flats or makes a splash sound in liquids but doesn't get crushed by doors and such. It looks weird seeing a bunch of casings sitting inside a doorway so I'd prefer them to be crushed, but this code isn't working. I feel like I am missing something simple as to why they aren't being crushed.

EDIT: They also don't move with scrolling floors, which also is weird to see them not move with the floor.

Also, I'd appreciate any feedback on the way I did the casings. Areas for improvement or some other optimization. Mine are built from several other examples I've seen.

Code: Select all

ACTOR BulletCasing
{
	Scale 0.25
	Height 2
	Radius 3
	BounceFactor 0.5
	WallBounceFactor 0.4
	BounceCount 5
	BounceSound "casings/bulletbounces"
	BounceType Doom
	PROJECTILE
	-NOGRAVITY
	+NOBLOCKMAP
	+MOVEWITHSECTOR
	+BOUNCEONCEILINGS
	-BOUNCEONACTORS
	-CANBOUNCEWATER
	+EXPLODEONWATER
	+NOTELEPORT
	+NOTRIGGER
	+THRUACTORS
	+DROPOFF
	+FLOORCLIP
	-DONTGIB
	+WINDTHRUST
	+GHOST
	+CORPSE
	+CLIENTSIDEONLY
	
	States
	{
		Spawn:
			BCAS FGHABCDE 1
			Loop
		Death:
			TNT1 A 0 A_Jump(255, "Death1", "Death2", "Death3", "Death4", "Death5")
			Goto Death1
		Death1:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 1, "DisappearLiquid")
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 2, "Disappear")
			BCAS I -1 A_PlaySound("casings/bulletdeaths")
			Stop
		Death2:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 1, "DisappearLiquid")
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 2, "Disappear")
			BCAS J -1 A_PlaySound("casings/bulletdeaths")
			Stop
		Death3:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 1, "DisappearLiquid")
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 2, "Disappear")
			BCAS K -1 A_PlaySound("casings/bulletdeaths")
			Stop
		Death4:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 1, "DisappearLiquid")
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 2, "Disappear")
			BCAS L -1 A_PlaySound("casings/bulletdeaths")
			Stop
		Death5:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 1, "DisappearLiquid")
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 2, "Disappear")
			BCAS M -1 A_PlaySound("casings/bulletdeaths")
			Stop
		Disappear:
			TNT1 A 0
			TNT1 A 1
			Stop
		DisappearLiquid:
			TNT1 A 0
			TNT1 A 1 A_PlaySound("casings/liquidhits")
			Stop
		Crush:
			TNT1 A 0
			TNT1 A 1
			Stop
	}
}

Re: How to make casings get crushed?

Posted: Tue Mar 14, 2017 12:47 am
by Matt
All I can think of is to constantly poll with a looping 1-length tic whether ceilingz==floorz. (getzat() is a huge processor hog compared to ceiling/floorz so it is not recommended)

No idea about scrolling floors. Have you tried -noblockmap or +solid?

Re: How to make casings get crushed?

Posted: Tue Mar 14, 2017 12:59 am
by torridgristle
In https://zdoom.org/wiki/Classes:Actor the state that uses the gibs sprite after a corpse is left in a door is GenericCrush, there might be something to that.

Re: How to make casings get crushed?

Posted: Tue Mar 14, 2017 2:45 am
by Graf Zahl
The actual name is 'Crush'. GenericCrush is, as the name implies, just a fallback but it uses a different name so that it doesn't override certain default behavior.

Re: How to make casings get crushed?

Posted: Tue Mar 14, 2017 3:02 am
by Nevander
I tried adding -NOBLOCKMAP as well as +SOLID and no dice. They behave exactly the same prior, not moving on moving floors or being crushed. Wtf.

Re: How to make casings get crushed?

Posted: Sat Apr 08, 2017 8:00 pm
by Nevander
Alright I'm seriously at my wit's end here. I can't get these damn things to crush or move with floors no matter what flags I set. Tried tricking the game to think it's a monster (which I assume is how normal monsters get crushed and move with scrollers) but nothing. Here's what the bullet casing actor looks like now. Any idea what flag(s) are causing this actor not to behave as I want it to?

Code: Select all

ACTOR BulletCasing
{
	Scale 0.25
	Height 4
	Radius 2
	Mass 4
	BounceFactor 0.5
	WallBounceFactor 0.4
	BounceCount 5
	BounceSound "casings/bulletbounces"
	BounceType Doom
	
	//PROJECTILE
	+MISSILE
	+ISMONSTER
	-COUNTKILL
	-NOGRAVITY
	-NOBLOCKMAP
	+MOVEWITHSECTOR
	+BOUNCEONCEILINGS
	-BOUNCEONACTORS
	-CANBOUNCEWATER
	+EXPLODEONWATER
	+NOTELEPORT
	+NOTRIGGER
	-ACTIVATEIMPACT
	-ACTIVATEPCROSS
	+THRUACTORS
	+THRUGHOST
	+THRUSPECIES
	+DROPOFF
	+FLOORCLIP
	-DONTGIB
	+WINDTHRUST
	+PUSHABLE
	+SOLID
	+CLIENTSIDEONLY
	
	States
	{
		Spawn:
			BCAS FGHABCDE 1
			Loop
		Death:
			TNT1 A 0 A_Jump(255, "Death1", "Death2", "Death3", "Death4", "Death5")
			Goto Death1
		Death1:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 1, "DisappearLiquid")
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 2, "Disappear")
			BCAS I -1 A_PlaySound("casings/bulletdeaths")
			Stop
		Death2:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 1, "DisappearLiquid")
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 2, "Disappear")
			BCAS J -1 A_PlaySound("casings/bulletdeaths")
			Stop
		Death3:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 1, "DisappearLiquid")
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 2, "Disappear")
			BCAS K -1 A_PlaySound("casings/bulletdeaths")
			Stop
		Death4:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 1, "DisappearLiquid")
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 2, "Disappear")
			BCAS L -1 A_PlaySound("casings/bulletdeaths")
			Stop
		Death5:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 1, "DisappearLiquid")
			TNT1 A 0 A_JumpIf(CallACS("LiquidCheck") == 2, "Disappear")
			BCAS M -1 A_PlaySound("casings/bulletdeaths")
			Stop
		Disappear:
			TNT1 A 0
			Stop
		DisappearLiquid:
			TNT1 A 0
			TNT1 A 1 A_PlaySound("casings/liquidhits")
			Stop
		Crush:
			TNT1 A 0
			Stop
	}
}

Re: How to make casings get crushed?

Posted: Sun Apr 09, 2017 12:41 am
by Blue Shadow
For crushing, you're missing the CORPSE flag and setting health to 0.

Re: How to make casings get crushed?

Posted: Sun Apr 09, 2017 4:44 am
by Nevander
Ok cool that working for crushing, I was just missing Health apparently and the monster flags aren't needed. However they still won't following a scrolling floor.

There's another weird thing going on too, if you fire them while a lift is going up they will glide across the floor and go through their animation constantly until they bounce against the side walls of the lift 5 times, which is their bouncecount. How do I stop this nonsense?

Re: How to make casings get crushed?

Posted: Sun Apr 09, 2017 4:46 am
by cocka
Does +DROPPED work?

Re: How to make casings get crushed?

Posted: Sun Apr 09, 2017 5:01 am
by Nevander
I think the scrolling floor is the problem here maybe, not the actor. Reason I say is because for some reason only the player is getting carried by the floor in question. If I spawn a monster, they don't get scrolled either. The ones that it isn't working on uses a sector scroller special, and I just tried a map which uses an ACS scroll and guess what! They move! One problem though is that it's possible for the casing to land at the edge and then isn't fully on the scrolling floor but is sitting on it halfway, but that's like... really rare.

And tried +DROPPED but they still glide across the floor, it's like the casing isn't aware it's hit a platform and thinks it's still falling. The first dropoff it reaches it falls and bounces as normal again.

Re: How to make casings get crushed?

Posted: Sun Apr 09, 2017 5:07 am
by cocka
OK, I just suggested the +DROPPED for your "things can't be crushed" problem.

Otherwise for the scrolling floors... Did you set the pusher for the sectors? Normally it is sector special 4096.

Re: How to make casings get crushed?

Posted: Sun Apr 09, 2017 6:04 am
by Nevander
Enabling the pusher does nothing for the casings. I'm going to have to use ACS scrolls in an OPEN script to do it I suppose.

Re: How to make casings get crushed?

Posted: Sun Apr 09, 2017 6:34 am
by cocka
And does it affect the monsters or just the casing?

Re: How to make casings get crushed?

Posted: Sun Apr 09, 2017 6:52 am
by Nevander
It moves both, but apparently "Scroll east (medium)" and the like only carry players, not anything else, even with pusher enabled. Starting to see that pretty much all sector effects are useless, since ACS can do everything they can but better.

Still need to find out why they glide on lifts that are currently going up or down, not sure if that one can be fixed.

Re: How to make casings get crushed?

Posted: Sun Apr 09, 2017 6:58 pm
by Popsoap10
Nevander wrote:Still need to find out why they glide on lifts that are currently going up or down, not sure if that one can be fixed.
This sounds like a case where the casings are spawning close enough to the floor that they aren't technically colliding with the ground. The only way I found to fix this is to have them spawn slightly higher so they will always spawn above ground.