Less Crashing Code

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
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Less Crashing Code

Post by XutaWoo »

Code: Select all

actor Lakitu 10003
{
  health 50
  painchance 256
  speed 32
  floatspeed 73
  radius 32
  height 48
  mass 0
  MONSTER
  +FLOAT
  +NOGRAVITY
  +NOLIFTDROP
  +NOBLOCKMONST
  +SPAWNFLOAT
  +SYNCHRONIZED
  +FASTER
  states
  {
  Spawn:
   LAKI A 1 A_Look
   loop
  See:
   LAKI A 1 A_FastChase
   loop
  Missile:
   LAKI B 22 A_FastChase
   LAKI A 1 A_FastChase
   LAKI A 6 A_ThrowGrenade (SpinyEgg, 0, 55, 0)
   goto See
  Pain:
   LAKI B 6
   LAKI B 6 A_Pain
   goto See
  Death:
   LAKI C 10 A_Scream
   LAKI D 10 A_NoBlocking
   LAKI EFGH 10
   LAKI I -1
   stop
   }
}

actor SpinyEgg
{
  Speed 1
  radius 28
  height 32
  PROJECTILE
  -NOGRAVITY
  states
  {
  Spawn:
   SEGG AB 9
   loop
  Death:
   TNT1 A 0 A_SpawnItem (Spiny, 0, 0, 0)
   stop
  }
}

actor Spiny
{
  speed 3
  radius 32
  height 30
  mass 80
  damage 20
  painchance 0
  health 100
  MONSTER
  +SYNCHRONIZED
  +FASTER
  states
  {
  Spawn:
   STRL A 1 A_Look
   loop
  See:
   STRL AB 8 A_Chase
   loop
  Missile:
   SEGG AB 10 ThrustThingZ (0, 36, 0, 0)
   SEGG ABABABABABABAB 7 A_FaceTarget
   SEGG ABABABABABABABABABAB 8 A_SkullAttack
   STRL AAAAAAA 3
   goto See
  Death:
   EXLD A 7 bright A_Explode (3, 16, 0)
   EXLD B 7 bright A_Explode (6, 26, 0)
   EXLD D 7 bright A_Explode (12, 32, 0)
   TNT1 A -1
   stop
   }
}
The code above always causes a crash, whether it dies, finds it's target, or tosses an egg.

I can't figure out what causes these fast crashes (they give a very fatal error or just shuts down ZDoom), so I can't tweak it to cause less crashes.

Also, anyone know where to find some monster sounds?
User avatar
Ryan Cordell
Posts: 4349
Joined: Sun Feb 06, 2005 6:39 am
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia (Modern GZDoom)
Location: Capital of Explodistan

Post by Ryan Cordell »

one small nitpick, the "Spiny"'s in A_ThrowGrenade and A_SpawnItem should be in quotation marks ( "" ), otherwise..
User avatar
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey

Post by Zippy »

Well, the missile state crashes because you are using A_FastChase in it. I forget if you just aren't supposed to be doing that to begin with, though. Not sure about the other crashes.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

A_Chase and its variants can not be placed in the first state of an attack sequence. These states are directly called from A_Chase and if they call A_Chase itself they will cause an infinite recursion.
User avatar
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey

Post by Zippy »

Ah, that's it. Well then, I'll just put a little scribble on the [wiki=A_Chase]wiki[/wiki]...
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Post by XutaWoo »

Thanks. One question: can I have a 0 delay state before A_FastChase? Or do I have to remove it all together.
User avatar
Snarboo
Posts: 2599
Joined: Tue Nov 29, 2005 4:37 am

Post by Snarboo »

Remove it all together. It will still be called with a frame duration of O. Infinite loops are the fastest way to crash G/ZDoom.

Here's something fun to try*: Put Goto Death in a monsters raise states and watch as the game crashes when an Archvile tries to resurrect it. I found this out the hard way. :lol:




*or not!
Locked

Return to “Editing (Archive)”