How to make casings get crushed?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

How to make casings get crushed?

Post 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
	}
}
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: How to make casings get crushed?

Post 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?
User avatar
torridgristle
Posts: 684
Joined: Fri Aug 23, 2013 9:34 am

Re: How to make casings get crushed?

Post 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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: How to make casings get crushed?

Post 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.
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: How to make casings get crushed?

Post 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.
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: How to make casings get crushed?

Post 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
	}
}
Blue Shadow
Posts: 5039
Joined: Sun Nov 14, 2010 12:59 am

Re: How to make casings get crushed?

Post by Blue Shadow »

For crushing, you're missing the CORPSE flag and setting health to 0.
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: How to make casings get crushed?

Post 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?
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

Re: How to make casings get crushed?

Post by cocka »

Does +DROPPED work?
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: How to make casings get crushed?

Post 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.
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

Re: How to make casings get crushed?

Post 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.
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: How to make casings get crushed?

Post 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.
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

Re: How to make casings get crushed?

Post by cocka »

And does it affect the monsters or just the casing?
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: How to make casings get crushed?

Post 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.
User avatar
Popsoap10
Posts: 60
Joined: Thu May 26, 2016 6:47 pm

Re: How to make casings get crushed?

Post 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.
Locked

Return to “Editing (Archive)”