Another headshot zombie

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
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:

Another headshot zombie

Post by Matt »

Code: Select all

actor HeadZombie : ZombieMan replaces ZombieMan
{
	health 60
	height 40
	radius 16
	states
	{
	spawn:
		POSS E 0
		POSS A 0 A_SpawnItemEx ("ZombieHead", 6, 0, 40, 0, 0, 0, 0, 16)
		POSS A 4 A_Look
		POSS A 0 A_SpawnItemEx ("ZombieHead", 6, 0, 40, 0, 0, 0, 0, 16)
		POSS A 4 A_Look
		POSS B 0 A_SpawnItemEx ("ZombieHead", 6, 0, 40, 0, 0, 0, 0, 16)
		POSS B 4 A_Look
		POSS B 0 A_SpawnItemEx ("ZombieHead", 6, 0, 40, 0, 0, 0, 0, 16)
		POSS B 4 A_Look
		loop
	missile:
		POSS E 0 A_SpawnItemEx ("ZombieHead", -2, 0, 40, 0, 0, 0, 0, 16)
		POSS E 4 A_FaceTarget
		POSS E 0 A_SpawnItemEx ("ZombieHead", -2, 0, 40, 0, 0, 0, 0, 16)
		POSS E 4 A_FaceTarget
		POSS E 0 A_SpawnItemEx ("ZombieHead", -2, 0, 40, 0, 0, 0, 0, 16)
		POSS E 4 A_FaceTarget
		POSS F 0 A_SpawnItemEx ("ZombieHead", -2, 0, 40, 0, 0, 0, 0, 16)
		POSS F 4 bright A_PosAttack
		POSS E 0 A_SpawnItemEx ("ZombieHead", -2, 0, 40, 0, 0, 0, 0, 16)
		POSS E 4
		POSS E 0 A_SpawnItemEx ("ZombieHead", -2, 0, 40, 0, 0, 0, 0, 16)
		POSS E 4
		goto see
	pain:
		POSS E 0 A_SpawnItemEx ("ZombieHead", -2, 0, 40, 0, 0, 0, 0, 16)
		POSS E 4 HealThing (999)
		POSS E 0 A_SpawnItemEx ("ZombieHead", -2, 0, 40, 0, 0, 0, 0, 16)
		POSS E 4 A_Pain
		goto see
	see:
		POSS A 0 A_SpawnItemEx ("ZombieHead", 6, 0, 40, 2, 0, 0, 0, 16)
		POSS A 4 A_Chase
		POSS B 0 A_SpawnItemEx ("ZombieHead", 6, 0, 40, 2, 0, 0, 0, 16)
		POSS B 4 A_Chase
		POSS C 0 A_SpawnItemEx ("ZombieHead", 6, 0, 40, 2, 0, 0, 0, 16)
		POSS C 4 A_Chase
		POSS D 0 A_SpawnItemEx ("ZombieHead", 6, 0, 40, 2, 0, 0, 0, 16)
		POSS D 4 A_Chase
		loop
	}
}
actor ZombieHead
{
	+ismonster
	-countkill
	+shootable
	+nogravity
	+nodamagethrust
	+noradiusdmg
	health 10
	height 14
	radius 10
	states
	{
	spawn:
		TNT1 A 4
		stop
	death:
		TNT1 A 0 A_KillMaster
		TNT1 AAAAA 1 A_SpawnItemEx ("Blood", random(-2,2),random(-2,2),random(-4,6), random(-2,2),random(-2,2),random(2,6))
		stop
	}
}
Last edited by Matt on Thu May 31, 2007 1:23 am, edited 1 time in total.
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Post by XutaWoo »

Niiiice.
User avatar
Nash
 
 
Posts: 17484
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Post by Nash »

Nice. The Z coordinate has to be adjusted a bit, but still nice.
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:

Post by Matt »

I'm more concerned about the X myself... testing this out in freeze mode I notice a few situations where the target area is a little behind where the head is on the sprite... nothing a 6-8-unit shift forward shouldn't fix though.
User avatar
Nash
 
 
Posts: 17484
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Post by Nash »

How well would this work for much faster monsters?
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:

Post by Matt »

I haven't tried, though it shouldn't be much more than creating a shorter-lived head actor and repeating the spawn more often. And possibly increasing the forward momentum given to the head in the see state...

Also, I've just edited the original to make it a little easier. Still not easy, but better than spraying with the chaingun hoping one will land...
User avatar
TheDarkArchon
Posts: 7656
Joined: Sat Aug 07, 2004 5:14 am
Location: Some cold place

Post by TheDarkArchon »

However, Caligari (I think) did headshots by a similar method ages ago. http://forum.zdoom.org/potato.php?t=6905&start=0
User avatar
Nash
 
 
Posts: 17484
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Post by Nash »

Caligari's method wasn't too fancy becaused it required TIDs.

Lilwhitemouse's, while much nicer, required using ACS and if I'm not mistaken, also TIDs.

Vaecrius' is nice but it does look a little tedious because of all the spawning in between.
User avatar
Ryan Cordell
Posts: 4349
Joined: Sun Feb 06, 2005 6:39 am
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia (Modern GZDoom)
Location: Capital of Explodistan

Post by Ryan Cordell »

Although nice, I still plan on staying with ACS, since I'm a bit of a supporter for the 'clean and effective' style of coding, and looking at the way the actor is jumbled with A_SpawnItemEx -es for it, I'll go through the ACS routine, but it was a nice take on it.
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:

Post by Matt »

The vastly cleaner alternative I originally had in mind was to give TIDs to the zombies which spawn a single head with the same TID + 1000, then have the head repeatedly jump to the zombie's location.

This was just a lot easier to type up in ten minutes in the middle of the night. :mrgreen:
User avatar
Ryan Cordell
Posts: 4349
Joined: Sun Feb 06, 2005 6:39 am
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia (Modern GZDoom)
Location: Capital of Explodistan

Post by Ryan Cordell »

Wouldn't it be better (and cleaner) to just write it like this?

Code: Select all

   spawn:
      POSS A 0
      POSS AABB 4 A_Look
      POSS AABB 0 A_SpawnItemEx ("ZombieHead", 6, 0, 40, 0, 0, 0, 0, 16)
      loop
   missile:
      POSS EEE 4 A_FaceTarget
      POSS EEE 0 A_SpawnItemEx ("ZombieHead", -2, 0, 40, 0, 0, 0, 0, 16)
      POSS F 4 bright A_PosAttack
      POSS F 0 A_SpawnItemEx ("ZombieHead", -2, 0, 40, 0, 0, 0, 0, 16)
      POSS EE 4 A_SpawnItemEx ("ZombieHead", -2, 0, 40, 0, 0, 0, 0, 16)
      goto see
   pain:
      POSS E 0 A_SpawnItemEx ("ZombieHead", -2, 0, 40, 0, 0, 0, 0, 16)
      POSS E 4 HealThing (999)
      POSS E 0 A_SpawnItemEx ("ZombieHead", -2, 0, 40, 0, 0, 0, 0, 16)
      POSS E 4 A_Pain
      goto see
   see:
      POSS ABCD 4 A_Chase
      POSS ABCD 0 A_SpawnItemEx ("ZombieHead", 6, 0, 40, 2, 0, 0, 0, 16)
      loop
User avatar
masterofpsi
Posts: 73
Joined: Sun Jan 16, 2005 9:13 am
Location: Rocking on.
Contact:

Post by masterofpsi »

This would be great for a survival kind of mod. Civilian weapons, really powerful zombies that only take damage to the head... It would be awesome.
User avatar
Ryan Cordell
Posts: 4349
Joined: Sun Feb 06, 2005 6:39 am
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia (Modern GZDoom)
Location: Capital of Explodistan

Post by Ryan Cordell »

However easy this would be, this could bring up the amusing sight of gunning a Zombie to the crotch. :)
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

Blade Nightflame wrote:Wouldn't it be better (and cleaner) to just write it like this?

Code: Select all

   spawn:
      POSS A 0
      POSS AABB 4 A_Look
      POSS AABB 0 A_SpawnItemEx ("ZombieHead", 6, 0, 40, 0, 0, 0, 0, 16)
      loop
That's not how Decorate works.

The original version does this:

1: Spawn a head target.
2: Immediately display frame A for 4 tics, and look for a player to start chasing.
3: Repeat steps 1 & 2.
4: Spawn a head target.
5: Immediately display frame B for 4 tics, and look for a player to start chasing.
6: Repeat steps 4 and 5.
7: Loop.

Your version does this:

1: Display frame A for 4 tics, and look for a player to start chasing.
2: Repeat step 1.
3: Display frame B for 4 tics, and look for a player to start chasing.
4: Repeat step 3.
5: Spawn 4 head targets in the same tic.
6: Loop.

The original version has the effect that each frame is shown for 8 tics, however the enemy looks for a target to chase twice per frame (every 4 tics). Since the head target only lives for 4 tics, two head targets are also spawned per frame.

Your See state is even worse, since the enemy would chase after the player for 16 tics before spawning 4 heads at its location and repeating the process. As a result, the head target would lag well behind the moving enemy.
Last edited by HotWax on Thu May 31, 2007 12:54 pm, edited 1 time in total.
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:

Post by Matt »

I just noticed that this method needs a slight overlap between each new head or you'd get a gap between frames where a headshot is impossible... so in the above example the head's first spawn frame should be 5 rather than 4.

What was Caligari's method anyway? According to his OP it only worked for one angle...
Post Reply

Return to “General”