Possible resurrection kill count exception

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

Ultimate Freedoomer
Posts: 222
Joined: Fri Jan 30, 2015 10:32 pm
Location: Pittman Center

Possible resurrection kill count exception

Post by Ultimate Freedoomer »

So… would it be possible in a future update to add something to the base "actor" class so that enemies resurrected by arch-viles don’t count towards the kill score?
User avatar
Zhs2
Posts: 1273
Joined: Fri Nov 07, 2008 3:29 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Location: Maryland, USA, but probably also in someone's mod somewhere

Re: Possible resurrection kill count exception

Post by Zhs2 »

Haven't tested this myself, but maybe this can be easily DIY'd if you set bCOUNTKILL to false on e.thing in a WorldThingRevived event?
Ultimate Freedoomer
Posts: 222
Joined: Fri Jan 30, 2015 10:32 pm
Location: Pittman Center

Re: Possible resurrection kill count exception

Post by Ultimate Freedoomer »

is that like an event handler thing for MAPINFO?
User avatar
Xeotroid
Posts: 438
Joined: Sat Jun 23, 2012 7:44 am
Graphics Processor: nVidia with Vulkan support
Location: Czech Rep.

Re: Possible resurrection kill count exception

Post by Xeotroid »

Zhs2 wrote: Fri Dec 01, 2023 11:01 am Haven't tested this myself, but maybe this can be easily DIY'd if you set bCOUNTKILL to false on e.thing in a WorldThingRevived event?
That doesn't work - the resurrected monster still increases the total monster count, but it then doesn't get counted as a kill when it is killed, making 100% kills impossible. The flag is unset probably after the Revive function is called, which increases the total monster count if bCountKill is set. I've tried using WorldThingDestroyed() instead, but that doesn't seem to do anything at all - monster count increases upon resurrection, and kill count increases upon re-killing.

Edit: LevelLocals.Total_Monsters is editable, so a DIY is actually very simple:

Code: Select all

override void WorldThingRevived(WorldEvent e) {
	e.Thing.bCountKill = false;
	Level.Total_Monsters -= 1;
}
Put this in a custom event handler, add it in MAPINFO, and voilá, killing a monster increases the kill count, an Archvile reviving it doesn't increase the monster count, and killing the revived monster doesn't increase the kill count.
User avatar
Zhs2
Posts: 1273
Joined: Fri Nov 07, 2008 3:29 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Location: Maryland, USA, but probably also in someone's mod somewhere

Re: Possible resurrection kill count exception

Post by Zhs2 »

Ah, I figured as much. But I can also think of no better way to intercept this aside from the CanResurrect virtual, which would involve rolling your own monsters in the first place.
Ultimate Freedoomer
Posts: 222
Joined: Fri Jan 30, 2015 10:32 pm
Location: Pittman Center

Re: Possible resurrection kill count exception

Post by Ultimate Freedoomer »

I tested it, & it works like a charm! Now if only we can get this to work with EVERYTHING that screws up the kill counter, like respawns & summons
User avatar
Xeotroid
Posts: 438
Joined: Sat Jun 23, 2012 7:44 am
Graphics Processor: nVidia with Vulkan support
Location: Czech Rep.

Re: Possible resurrection kill count exception

Post by Xeotroid »

I don't know what else you mean by respawns except possibly for directly setting a dead monster's state to Spawn or something (sounds very rare and probably not worth considering for cases where this kill count reverting is desired, like UV-maxing a map), but this should work for any kind of summons including those from the Icon of Sin and from the summon command. The map time check is there to not prevent pre-defined spawns from adding to the kill counter. I don't think there is another way to check if an actor is placed in the map file or spawned during playtime.

Code: Select all

class KillCountHandler : EventHandler {
	override void WorldThingSpawned(WorldEvent e) {
		if (Level.MapTime > 0) {
			RevertCounter(e);
		}
	}
	
	override void WorldThingRevived(WorldEvent e) {
		RevertCounter(e);
	}
	
	private void RevertCounter(WorldEvent e) {
		if (e.Thing.bCountKill) {
			e.Thing.bCountKill = false;
			Level.Total_Monsters -= 1;			
		}
	}
}
Ultimate Freedoomer
Posts: 222
Joined: Fri Jan 30, 2015 10:32 pm
Location: Pittman Center

Re: Possible resurrection kill count exception

Post by Ultimate Freedoomer »

With respawns, I was referring to things like Nightmare difficulty. As to summons, the Icon isn’t too much of a problem since you can just set its death to kill all its spawns. I’m more concerned with things like Pain Elementals. Basically, anything that’d cause the kill counter to go above 100% in the original DOS executable but doesn’t really have a proper built-in way of accounting for that in GZDoom is my main concern as far as what I’m trying to make the kill count ignore here. Also,with this setup, will enemies that teleport in still count as kills?
User avatar
Xeotroid
Posts: 438
Joined: Sat Jun 23, 2012 7:44 am
Graphics Processor: nVidia with Vulkan support
Location: Czech Rep.

Re: Possible resurrection kill count exception

Post by Xeotroid »

You can just test it in two minutes on your own, you know. Yes, it prevents Pain Elementals' Lost Souls and Nightmare respawns from increasing the kill counter. I haven't checked ACS-spawned monsters, but I see no reason why they wouldn't be affected by the handler. Enemies that teleport in vanilla-style are already in the map at the start.
Ultimate Freedoomer
Posts: 222
Joined: Fri Jan 30, 2015 10:32 pm
Location: Pittman Center

Re: Possible resurrection kill count exception

Post by Ultimate Freedoomer »

I’ll test it when I’m at my computer. & when you mention ACS-spawned monsters, are you referring to the Hexen monster spawning system? & I didn’t know enemies that teleport in are already in the map. Are there dummy sectors that hold the monsters in prep for teleporting?
User avatar
Xeotroid
Posts: 438
Joined: Sat Jun 23, 2012 7:44 am
Graphics Processor: nVidia with Vulkan support
Location: Czech Rep.

Re: Possible resurrection kill count exception

Post by Xeotroid »

Ultimate Freedoomer wrote: Wed Dec 13, 2023 9:52 pm are you referring to the Hexen monster spawning system?
Yeah, monsters in Hexen respawn through a simple repeating OPEN script with a delay and a chance to spawn a given monster at a given spot. The same spawning functionality can be used for spawning enemies into the map via scripts from triggers for regular progression, traps etc. I never liked mappers using this too much, as the kill count at the start of a map means pretty much nothing and easily balloons up.
The ACS spawn functions are affected by the handler, so monsters spawned this way don't add to the kill count.
Ultimate Freedoomer wrote: Wed Dec 13, 2023 9:52 pm Are there dummy sectors that hold the monsters in prep for teleporting?
Vanilla, Boom, MBF etc. maps can't spawn in a monster that's not already present in the map somewhere, so dummy sectors are used. Usually the dummy sector is merged with a sector inside the playable area (or a small physical connection is made, like in E1M9 or MAP16) for sound to propagate to wake the monsters and have them walk over a teleporting linedef.
The monsters are there at the start of the map, so they count for the kill count, and them teleporting in is them just being moved around the map.
Ultimate Freedoomer
Posts: 222
Joined: Fri Jan 30, 2015 10:32 pm
Location: Pittman Center

Re: Possible resurrection kill count exception

Post by Ultimate Freedoomer »

Hopefully this won’t screw with things like Doom 64's teleport ambush or — assuming UDMF can — cases where it DOES spawn a monster that isn’t already present in such situations. Anyway, I’ll test it tomorrow
Ultimate Freedoomer
Posts: 222
Joined: Fri Jan 30, 2015 10:32 pm
Location: Pittman Center

Re: Possible resurrection kill count exception

Post by Ultimate Freedoomer »

Regarding this: the main thing I’m concerned about are things like respawns (Hexen's scripted monster spawning system, Nightmare difficulty), resurrects (enemy's raise states being invoked), & summons (Icon of Sin, Pain Elemental lost souls). Stuff like a monster that isn’t already on the map somewhere being spawned in WITHOUT such being on an endless loop I still want to count towards the kills, though.

Return to “Feature Suggestions [GZDoom]”