Problem with A_SpawnItemEx

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Tormentor667
Posts: 13554
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany
Contact:

Problem with A_SpawnItemEx

Post by Tormentor667 »

I thought this is an GZDoom bug but most likely, it isn't so I just ask here for a solution.

This is my actor:

Code: Select all

actor AntBoss 12345
{
  obituary "%o was killed by a giant ant."
  health 200
  radius 32
  height 32
  mass 1000
  speed 12
  painchance 96
  maxtargetrange 128
  meleerange 32
  seesound "ant/active"
  attacksound "ant/attack"
  painsound "ant/pain"
  deathsound "ant/death"
  activesound "ant/active"
  dropitem "0" 256
  MONSTER
  +FLOORCLIP
  states
  {
  Spawn:
    POSS A 50 A_Look
    POSS ABCDEFGHIJKLMNOPQRSTU 2 A_Look
    SPOS ABCDEFGHIJKLMNOPQRSTU 2 A_Look
    BOS2 ABCDEFGHI 2 A_Look
    loop
  See:
    BOSS EF 8 A_Chase
    BOSS G 0 A_PlaySound("ant/step")
    BOSS GH 8 A_Chase
    BOSS E 0 A_PlaySound("ant/step")
    loop
  Melee:
    TROO ABCD 4 A_FaceTarget
    TNT1 A 0 A_SpawnItemEx("FreezeDummy",32,0,0,0,0,0,0,32)
    TROO EFGH 4 
    TNT1 A 0 A_CustomMeleeAttack(10,"ant/bite",0,0,1) 
    TROO IJKLMNOPQRSTU 3
    goto See
  Missile:
    TROO ABCDEF 2 A_FaceTarget
    TNT0 A 0 A_CustomMissile("AntFire",32,0, random(10,-10), 0, random(170,190))
    TROO GH 2 A_FaceTarget
    TNT0 A 0 A_CustomMissile("AntFire",32,0, random(10,-10), 0, random(170,190))
    TROO IJ 2 A_FaceTarget
    TNT0 A 0 A_CustomMissile("AntFire",32,0, random(10,-10), 0, random(170,190))
    TROO KL 2 A_FaceTarget
    TNT0 A 0 A_CustomMissile("AntFire",32,0, random(10,-10), 0, random(170,190))
    TROO MNO 3
    goto See
  Pain:
    TROO A 0 A_Pain
    TROO BCDEDCBA 2
    goto See
  Death:
    TNT1 A 0 A_Scream
    TNT1 A 0 A_NoBlocking
    TNT1 A 0 A_Jump(160,5)
    TNT1 AAAA 0 A_SpawnItemEx("AntSmall", random(-128,128), random(-128,128), 0, 0, 0, 0, random(0,359), 0)    <-------------------
    SKEL ABCDE 8
    SKEL F 8 A_Playsound("ant/fall")
    SKEL GH 8 
    SKEL I -1    
    stop
  }
}
The important line is in its death state: After the ant dies, it should spawn several little ants. For some reason, if the player looks as it is now, nothing gets spawned at all, absolutely nothing. It doesn't even make a difference if I change the code pointer to force the spawn (flag 32) or if I enlarge the random positions even more.

The only difference that makes the actor spawn the ants is when I inherit the AntBoss from the Zombieman (and most likely from other actors as well). I already double checked if the AntBoss is missing something, but everything that is present in the Zombieman decorate is also in my AntBoss decorate. Bug?

*EDIT*
I found out that the code is able to spawn PROJECTILES but no MONSTERS (DoomImp and Demon doesn't work, but DoomImpBall works for example) if I do not add the inherited Zombieman to the head of the actor.

*EDIT2*'
If I remove the "MONSTER" flag from the AntSmall, it works as well... so to summarize:

Inheriting from Zombieman
Projectiles work
Monsters work

Without Inheriting from Zombieman
Projectiles Work
Monsters do not work
Monsters work if they have no MONSTER flag

*EDIT3*
Ok got it, for some reason the ISMONSTER flag causes the problem... if I remove that from the MONSTER combo, the monsters get spawned... bug? Or did I set up anything wrong?
User avatar
Enjay
 
 
Posts: 26938
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Problem with A_SpawnItemEx

Post by Enjay »

Are you sure you haven't just been unlucky with your A_Jumps jumping past the spawning when you have tested it? I commented out that line and got spawning to happen every time. Here's some proof. I made the AntSmall actor by simply inheriting from the DoomImp. I summoned an AntBoss and killed it with MDK bound to a button. As you can see, the boss died and was immediately surrounded by imps.

http://www.rowand.myzen.co.uk/antboss.wmv

[edit] I haven't changed any flags so I think your "ismonster" theory is wrong. If you look at my vid, you can see the monster count go up when the antboss spawns and when the imps are spawned.[/edit]
User avatar
Tormentor667
Posts: 13554
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany
Contact:

Okay..

Post by Tormentor667 »

...that's what I did:

- Removed the A_Jump completely
- Removed the chance in the A_SpawnItemEx
- Changed "AntSmall" into "DoomImp"
- Retried

...and nothing happened, nothing got spawned. That's when I got curious...

- Removed the MODELDEF completely
- Retried

...also no difference, nothing get spawned. To be sure that I didn't do something wrong, I tried the projectiles again...

- Changed "DoomImp" into "DoomImpBall"
- Retried

...works like a charm, with all different kinds of Jumps and Chances. The last thing I've tried was exactly what you did...

- Creating a new clean DECORATE with the actor
- Changing "DoomImpBall" into "DoomImp" back again
- Running the DECORATE

...and that did really work... I have no idea what's wrong with that code or where my bug actually is placed. Could I send you the pack?
User avatar
Enjay
 
 
Posts: 26938
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Okay..

Post by Enjay »

Tormentor667 wrote:Could I send you the pack?
If you like. I can take a look at least. No guarantees that I'll find anything of course.
User avatar
Tormentor667
Posts: 13554
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany
Contact:

Re: Problem with A_SpawnItemEx

Post by Tormentor667 »

Okay, not needed anymore, I found the solution by accident ;) To test my death animations, I always used a binded hotkey for "Kill Monsters". When I use this, none of the A_SpawnItemEx monster get spawned. If I kill them with a weapon, everything works fine. Quite funny... is this a bug?
User avatar
Enjay
 
 
Posts: 26938
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Problem with A_SpawnItemEx

Post by Enjay »

No, it's actually quite intentional. Kill monsters deliberately kills everything and stops the spawning of additional monsters that might be spawned during a monsters death phase (like the pain elemental). I found this out the hard way too with one of my own DECORATE monsters a while back.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Problem with A_SpawnItemEx

Post by Graf Zahl »

Any monster that dies by damage type 'massacre' is blocked from spawning additional monsters so that 'kill monsters' can do what it is supposed to do: Clean the level of all monsters that are not dormant.
User avatar
Enjay
 
 
Posts: 26938
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Problem with A_SpawnItemEx

Post by Enjay »

Heh, 1 year and 4 days ago I got almost exactly the same answer. :biggrin:
Graf Zahl wrote:

Code: Select all

	// Don't spawn monsters if this actor has been massacred
	if (self->DamageType == NAME_Massacre && GetDefaultByType(missile)->flags3&MF3_ISMONSTER) return;
It was an intentional change so that the 'kill monsters' cheat doesn't result in needless new monsters being spawned. It is supposed to empty the level as thoroughly as possible.
User avatar
Tormentor667
Posts: 13554
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany
Contact:

Re: Problem with A_SpawnItemEx

Post by Tormentor667 »

Okay, thanks :)
Locked

Return to “Editing (Archive)”