A_SpawnItemEX bug/odd behavior with flying monsters

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

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!)
User avatar
Amuscaria
Posts: 6634
Joined: Mon Jul 26, 2004 12:59 pm
Location: Growing from mycelium near you.

A_SpawnItemEX bug/odd behavior with flying monsters

Post by Amuscaria »

I'm not sure if this is a bug or I'm doing something wrong with the decorate code. When I have a projectile that uses A_SpawnItemEX to spawn a flying enemy, if the enemy spawns on the ground, it sticks to the ground and won't change elevation, essentially acting like a non-flying monster. But if it's spawned above the ground (i.e. when it's summoned above an enemy) it behaves normally and can change its elevation. Not sure what is up.

Here's the projectile & monster code:

Code: Select all

ACTOR SentinelSpawner : CacodemonBall
{
   Radius 16
   Height 32
   Speed 25
   Damage 10
   ALPHA 0.90
   +THRUGHOST   
   +FORCEXYBILLBOARD
   +SEEKERMISSILE
   -NOGRAVITY
   Seesound "weapons/magic4"
   deathsound "vile/firecrk"
   Translation "112:127 = 176:191"
   States
   {
   Spawn:
      SEF2 ABCD 2 Bright
      loop
   Death:
      FIRG A 0 A_SpawnItemEX("Guardian",0,0,0,0,0,0,0,SXF_SETMASTER)
      FIRG ABABCBCBCDCDCDEDEDEFEFEFGHGHGH 2 Bright 
      stop
   }
}

ACTOR Guardian 30102 
{ 
Health 100 
Radius 24 
Height 58 
Mass 150 
Speed 9 
PainChance 32 
MONSTER
DropItem FireAmmo
Obituary "%o got fried by a Guardian."
+NOGRAVITY 
+FLOAT
+DONTFALL
+NOBLOOD
+DONTHURTSPECIES
+NOICEDEATH
+DONTRIP
+LOOKALLAROUND
SeeSound "guardian/see" 
PainSound "weapons/bounc1"
activesound "guardian/active"
DeathSound "guardian/death"
States 
   { 
   Spawn: 
       GARD ABCDEF 3 A_Look 
       Loop 
   See: 
       GARD ABCDEF 3 A_Chase
       Loop 
   Missile: 
       GARD G 8 Bright A_FaceTarget 
       GARD H 4 Bright A_FaceTarget
	   GARD I 0 Bright A_PlaySound("weapons/magic1",0,2.0)
       GARD I 0 BRIGHT A_CustomMissile("GuardShot",32,4,0,1)
       GARD I 4 BRIGHT A_CustomMissile("GuardShot",32,-4,0,1)
       GARD H 4 Bright A_FaceTarget
	   GARD I 0 Bright A_PlaySound("weapons/magic1",0,2.0)
       GARD I 0 BRIGHT A_CustomMissile("GuardShot",32,4,0,1)
       GARD I 4 BRIGHT A_CustomMissile("GuardShot",32,-4,0,1)
       GARD H 4 Bright A_FaceTarget 
	   GARD I 0 Bright A_PlaySound("weapons/magic1",0,2.0)
       GARD I 0 BRIGHT A_CustomMissile("GuardShot",32,4,0,1)
       GARD I 4 BRIGHT A_CustomMissile("GuardShot",32,-4,0,1)
	   GARD H 4 Bright A_FaceTarget 
       GARD G 8 Bright A_FaceTarget
       Goto See 
   Pain: 
       GARD J 3 
       GARD J 3 A_Pain 
       Goto See 
   Death:
       GARD K 0 Bright A_NoBlocking
       GARD K 0 Bright A_SetFloorClip
       GARD K 4 Bright A_Scream 
       GARD LMNOP 4 Bright
       GARD Q 4 Bright A_Die
       Stop 
   } 
}
Blue Shadow
Posts: 5032
Joined: Sun Nov 14, 2010 12:59 am

Re: A_SpawnItemEX bug/odd behavior with flying monsters

Post by Blue Shadow »

It could be acting like it is stuck in the floor? Try giving it a bit of a z-offset so that it spawns above the floor.
User avatar
Amuscaria
Posts: 6634
Joined: Mon Jul 26, 2004 12:59 pm
Location: Growing from mycelium near you.

Re: A_SpawnItemEX bug/odd behavior with flying monsters

Post by Amuscaria »

I'll give that a try. Can actors actually be stuck in the floor, though? I though the game engine automatically pushes things above the floor no matter what.
Blue Shadow
Posts: 5032
Joined: Sun Nov 14, 2010 12:59 am

Re: A_SpawnItemEX bug/odd behavior with flying monsters

Post by Blue Shadow »

It might not be. That's why I said "acting". In a test a did, I observed two things:
  • Upon spawn, the monster's z-height is the same as the floor's, which means the monster is standing on the floor (not stuck in it).
  • If there happens to be a platform between the monster and its target, the monster will have no problem "climbing" it. And from that point onward, the monster acts like any other flying monster.
ZzZombo
Posts: 317
Joined: Mon Jul 16, 2012 2:02 am

Re: A_SpawnItemEX bug/odd behavior with flying monsters

Post by ZzZombo »

Flying monsters can only reach altitude they have reached previously, unless there is an obstacle between them and their target.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49182
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A_SpawnItemEX bug/odd behavior with flying monsters

Post by Graf Zahl »

That explanation is not really particularly good, even though the core details may be somewhat correct.
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: A_SpawnItemEX bug/odd behavior with flying monsters

Post by Apeirogon »

Try make him a_skullattack-ed and then fly with noclip2 somewhere high.
ZzZombo
Posts: 317
Joined: Mon Jul 16, 2012 2:02 am

Re: A_SpawnItemEX bug/odd behavior with flying monsters

Post by ZzZombo »

Err... wrong thread/response/universe? What you said makes no sense in context of this thread, and frankly, any other I could imagine regarding Doom modding.
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: A_SpawnItemEX bug/odd behavior with flying monsters

Post by Apeirogon »

If it attack as lost soul than it means monster not stuck in floor, just conventions of game mechanics. If no, then it trully stuck in floor and they need add in spawn function height check.
Or you have better idea how check it without catching value in memory with debugger?
User avatar
Ichor
Posts: 1783
Joined: Wed Jul 23, 2003 9:22 pm

Re: A_SpawnItemEX bug/odd behavior with flying monsters

Post by Ichor »

Maybe add something like A_SentinelBob so that it won't stay on the floor.

Return to “Scripting”