MantisBT - Zandronum
View Issue Details
0004103Zandronum[All Projects] Suggestionpublic2023-02-13 03:572024-04-09 03:01
arkore 
Kaminsky 
normalmajoralways
resolvedfixed 
Windows 64-bitWindows 101903
3.1 
3.23.2 
0004103: GAMEEVENT_ACTOR_SPAWNED (3.2-alpha): arg1 true if spawned by the level for RandomSpawners
The ''arg1'' value (of ''EVENT'') is false when map monsters are replaced by ''RandomSpawner''

The engine appears to be forgiving with how ''RandomSpawner'' operates on map things, such as monsters, weapons, etc.

It assumed that the engine is doing some magic to handle these replacements so well--replacing a ZombieMan with a RandomSpawner that spawns any one of several monsters, and those monsters remain intact as map monsters, contributing to the map's monster count, and so on.

Many monster mods will typically include a Spawners.txt DECORATE file with RandomSpawners for each of the 18 monster classes in doom2.

Therefore, it is then expected that ''arg1'' should be true in the case of a spawned monster from a RandomSpawner.

Dev quote:
> Actually, by default any ''RandomSpawner'' class shouldn't be triggering ''GAMEEVENT_ACTOR_SPAWNED'' since it has both the ''NOBLOCKMAP'' and ''NOSECTOR'' flags.

Player quote:
> i can only guess that engine changes those flags during the replacement.
- Create new folder: TEST
- Copy zandronum (3.2) and DOOM2.WAD to TEST
- Download sample wad (above), and test.bat, and save to TEST
- Run test.bat
- See console for ''ShotgunGuy (or ACZombieMan) arg1 = false'' (should be ''true'')
DECORATE:
<code c>
ACTOR ACZombieMan : ZombieMan { }

ACTOR ZombiemanSpawner : RandomSpawner Replaces ZombieMan {
    DropItem "ACZombieMan", 256, 50
    DropItem "ShotgunGuy", 256, 50
}
</code>

ACS:
<code c>
#library "TEST"
#include "zcommon.acs"

script "Event" (int type, int arg1, int arg2) EVENT {
    if (type == GAMEEVENT_ACTOR_SPAWNED) {
        if ((ClassifyActor(0) & ACTOR_MONSTER)) {
            Log(s:GetActorClass(0), s:" arg1 = ",i:arg1);
        }
    }
}
</code>
No tags attached.
? TEST.wad (3,585) 2023-02-13 03:58
/tracker/file_download.php?file_id=2840&type=bug
? test.bat (57) 2023-02-13 03:59
/tracker/file_download.php?file_id=2841&type=bug
Issue History
2023-02-13 03:57arkoreNew Issue
2023-02-13 03:58arkoreFile Added: TEST.wad
2023-02-13 03:59arkoreFile Added: test.bat
2023-02-21 01:12arkoreNote Added: 0022778
2024-03-11 22:18StrikerMan780Note Added: 0023365
2024-03-11 22:24StrikerMan780Note Edited: 0023365bug_revision_view_page.php?bugnote_id=23365#r14121
2024-03-12 02:14KaminskyNote Added: 0023366
2024-03-12 02:14KaminskyAssigned To => Kaminsky
2024-03-12 02:14KaminskyStatusnew => needs review
2024-03-12 02:14KaminskyTarget Version => 3.2
2024-03-17 12:12KaminskyNote Added: 0023415
2024-03-17 12:12KaminskyStatusneeds review => needs testing
2024-04-09 03:01Ru5tK1ngNote Added: 0023567
2024-04-09 03:01Ru5tK1ngStatusneeds testing => resolved
2024-04-09 03:01Ru5tK1ngResolutionopen => fixed
2024-04-09 03:01Ru5tK1ngFixed in Version => 3.2

Notes
(0022778)
arkore   
2023-02-21 01:12   
Belphegor raised a good point, in that some mods use replacement solutions as well, which is essentially an actor that is designed for the sole purpose to choose a random monster to spawn, either by A_JumpIf logic, or ACS, etc. Complex Doom does this, and I also have a recent project doing this.

So, perhaps this arg1=true functionality can check for that, or go beyond the scope of it's design and be expanded to check for anything spawned(or "existing") within 0(or 1?) tics of a map starting
(0023365)
StrikerMan780   
2024-03-11 22:18   
(edited on: 2024-03-11 22:24)
Ran into this issue myself. I'm trying to write an enemy multiplier, but since it doesn't work for randomspawners, I'm stuck.

EDIT: Hmm, a temporary workaround is forcing USESPAWNEVENTSCRIPT on the spawner, but that doesn't count for any randomspawners that aren't part of the mod itself.

(0023366)
Kaminsky   
2024-03-12 02:14   
I created a new merge request:'https://foss.heptapod.net/zandronum/zandronum-stable/-/merge_requests/53 [^]'
(0023415)
Kaminsky   
2024-03-17 12:12   
This has been merged in:'https://foss.heptapod.net/zandronum/zandronum-stable/-/commit/b4dc5854a3a082f4bff307bec3d8bf48dcc0dfe3 [^]'

This also changes arg1 of GAMEEVENT_ACTOR_SPAWNED to a bitfield, which can now be used to check if an actor was spawned by the level and/or a random spawner using the flags:

- GAMEEVENT_SPAWN_LEVELSPAWNED (1)
- GAMEEVENT_SPAWN_RANDOMSPAWNED (2)
(0023567)
Ru5tK1ng   
2024-04-09 03:01   
Tested the example wad with the latest 3.2 beta online. The event script fired correctly and the arg1 was printed properly.