Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
I have been experiencing an odd issue with RandomSpawners. One of my spawners may spawn either a mine item, that can be picked up or used or an active mine that is a trap.
Thing is, if a trap is spawned in a slightly "crampped" area, it will fail to spawn, but only if it is spawned from a subsequent spawner.
Actor Mine 12059
{
Radius 8
Height 5
Mass 10
Health 20
Damage (1)
//DONTHURTSHOOTER
Speed 4
BounceFactor 0.2
+NOBLOOD
-SHOOTABLE
+MISSILE
+DOOMBOUNCE
+THRUGHOST
-CANBLAST
States
{
Spawn:
MINE A 0 A_Gravity
MINE AAABBB 4
Loop
Death:
MINE A 0 A_SpawnItemEx("MineBase")
Stop
}
}
If I put the MineSpawner list into the first spawner, it will spawn correctly. Removing the "missile" flag from the mine will also cause it to spawn. A good place to see this behavior is the start of MAP02 - where if a trap is chosen, it will fail to spawn.
The question is: Why is it behaving that way? Is this a bug on my side, or on the GZDoom's side?
(For me this is not a big deal, but it might be problematic in the future)
CheckMissileSpawn realizes that the MineSpawner is too big to fit in (note that an actor's default height and radius are 16 and 20 respectively), and tries to explode the MineSpawner. Since the spawner does not have a nice explosion animation like your Mine probably does, it just disappears instead.
Your best bet right now would probably be to set the radius and height for MineSpawner to the same values that you've set for your Mine actor. It fixes the problem on my end, too.
The scenario itself (a RandomSpawner spawning another RandomSpawner spawning a missile) is probably bugged. This particular case can be rectified by not calling CheckMissileRange if newmobj is a RandomSpawner. There is another code block succeptible to this bug, which is executed when the missile is an actual missile shot by someone, and not just spawned in place of some item, a similar check should probably be added there as well.
I do have several work arounds for this, including removing missile flag and setting it back on frame "0" of the mine, or even editing the RandomSpawner itself. But the RandomSpawner spawning RandomSpawner spawning missile behavior was weird.