Page 1 of 1

Allow Level Compatibility to remove COUNTKILLS/COUNTITEMS

Posted: Tue Apr 21, 2020 9:06 pm
by 3saster
As far as I know, the level postprocessor does not have any way to remove the COUNTKILL or COUNTITEM from a thing. The use case for removing COUNTKILL is to allow maxkills when monsters are used for "scripting purposes"; for example, Memento Mori 2 MAP25 contains an unkillable imp used to trigger a lift; Hell Revealed MAP26 contains 4 unkillable archviles used to create the ghost monster army at the end. The use case for removing COUNTITEM is for different reasons; maps like 50 Shades of Graytall MAP06 and 50 Monsters MAP29 use unreachable items for decorative purposes; maps likes Speed of Doom MAP14 use item choices (picking one item prevents getting the other one). In both cases (especially the COUNTKILL case), the things cannot be removed without either changing visuals at best, to breaking gameplay at worst. In which case, the best way to allow maxkills/items would be to allow the level postprocessor to remove these flags (or introduce a similar mechanism).

Re: Allow Level Compatibility to remove COUNTKILLS/COUNTITEM

Posted: Wed Apr 22, 2020 1:25 am
by _mental_
Both flags are properties of corresponding classes, it's not something loaded from maps.

A workaround for COUNTKILL can be MTF_FRIENDLY flag set on monsters. There is no such thing for COUNTITEM.
If you really need this, consider to use an event handler that does Actor.ClearCounters() during the first tic instead of postprocessor.

Re: Allow Level Compatibility to remove COUNTKILLS/COUNTITEM

Posted: Wed Apr 22, 2020 1:38 am
by Graf Zahl
This would surely require two new thing spawn flags to be added, because at the point where compatibility scripts run, no actor has been spawned yet. But that's not an impossibility.

Re: Allow Level Compatibility to remove COUNTKILLS/COUNTITEM

Posted: Wed Apr 22, 2020 2:26 am
by Rachael
_mental_ wrote: A workaround for COUNTKILL can be MTF_FRIENDLY flag set on monsters.
This would not work well for the archvile rez traps. The archvile would produce friendly monsters in this case.

Re: Allow Level Compatibility to remove COUNTKILLS/COUNTITEM

Posted: Wed Apr 22, 2020 2:51 am
by 3saster
_mental_ wrote: If you really need this, consider to use an event handler that does Actor.ClearCounters() during the first tic instead of postprocessor.
The point of this is for compatibility reasons to do engine-side; If I'm gonna use an event handler anyway for personal use, I might as well just edit the map directly.
Graf Zahl wrote:This would surely require two new thing spawn flags to be added, because at the point where compatibility scripts run, no actor has been spawned yet. But that's not an impossibility.
That's what I figured, but I wasn't sure if there was a better way. Seems there are more than enough bits left in the EMapThingFlags enum, and as far as I can tell, all that really needs to be done is handle the new flags in AActor::HandleSpawnFlags(). In any case, should this functionality be added, I already provided a number of use cases it could be immediately applied to.

Re: Allow Level Compatibility to remove COUNTKILLS/COUNTITEM

Posted: Mon Apr 27, 2020 12:49 am
by 3saster
Had a go at it, PR. Thanks to Skepticist from Doomworld, who provided me quite the number of maps that could benefit from this feature.