[3.7.1] Very Fatal Error with inherited ZScript actor

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
katori
Posts: 1
Joined: Fri Dec 15, 2017 12:20 pm

[3.7.1] Very Fatal Error with inherited ZScript actor

Post by katori »

Hi, I converted some Strife DECORATE to ZScript as an exercise and to get a basis on friendly behavior. To further customize my friendly peasant I have started to add variants, however, the first of these variants seems to give GZDoom a "Very Fatal Error."

It was suggested in the ZDoom Discord that this could be related to A_Look2(), but I figure even if it is that it's worth reporting a bug since a Very Fatal Error is no good either way. So attached is the bug report and the offending ZScript. If I move the actor around a bit I can sometimes get to see him in game, but it always crashes when there's another FarmPeasant around. Usually crashes within a second or two of starting. I will move away from A_Look2 and see if that yields results, but I wanted to report the bug regardless.

Code: Select all

class FarmPeasant : MHCHumanoid
{
	Default
	{
  Health 31;
  PainChance 200;
  Speed 8;
  Radius 20;
  Height 56;
  Monster;
  Scale 0.65;
  +NEVERTARGET
  -COUNTKILL
  +NOSPLASHALERT
  +FLOORCLIP
  +JUSTHIT
  MinMissileChance 150;
  MaxStepHeight 16;
  MaxDropoffHeight 32;
  SeeSound "peasant/sight";
  AttackSound "peasant/attack";
  PainSound "peasant/pain";
  DeathSound "peasant/death";
  HitObituary "$OB_PEASANT"; // "%o should have never picked a fight with a civilian."
  }
  States
  {
  Spawn:
    VILA A 10 A_Look2();
    Loop;
  See:
    VILA AABBCCDD 5 A_Wander();
    Goto Spawn;
  Melee:
    PEAS E 10 A_FaceTarget();
    PEAS F 8 A_CustomMeleeAttack(2*random[PeasantAttack](1, 5)+2);
    PEAS E 8;
    Goto See;
  Pain:
    PEAS O 3;
    PEAS O 3 A_Pain();
    Goto Melee;
  Wound:
    PEAS G 5;
    PEAS H 10 A_GetHurt();
    PEAS I 6;
    Goto Wound+1;
  Death:
    PEAS G 5;
    PEAS H 5 A_Scream;
    PEAS I 6;
    PEAS J 5 A_NoBlocking();
    PEAS K 5;
    PEAS L 6;
    PEAS M 8;
    PEAS N 1400;
    GIBS U 5;
    GIBS V 1400;
    Stop;
  XDeath:
    GIBS M 5 A_TossGib();
    GIBS N 5 A_XScream();
    GIBS O 5 A_NoBlocking();
    GIBS PQRS 4 A_TossGib();
    Goto Death+8;
  }
}

class VillagerB : FarmPeasant
{
	States
	{
		Spawn:
			VILB A 10 A_Look2();
			Loop;
		See:
			VILB A 5 A_Wander();
			Goto Spawn;
	}
}

class MHCHumanoid : actor
{
	Default
	{
		MaxStepHeight 16;
		MaxDropoffHeight 32;
		CrushPainSound "misc/pcrush";
  }
  States
  {
  Burn:
    BURN A 3 Bright A_PlaySoundEx("human/imonfire", "Voice");
    BURN B 3 Bright A_DropFire();
    BURN C 3 Bright A_Wander();
    BURN D 3 Bright A_NoBlocking();
    BURN E 5 Bright A_DropFire();
    BURN FGH 5 Bright A_Wander();
    BURN I 5 Bright A_DropFire();
    BURN JKL 5 Bright A_Wander();
    BURN M 5 Bright A_DropFire();
    BURN NOPQPQ 5 Bright;
    BURN RSTU 7 Bright;
    BURN V -1;
    Stop;
  Disintegrate:
    DISR A 5 A_PlaySoundEx("misc/disruptordeath", "Voice");
    DISR BC 5;
    DISR D 5 A_NoBlocking();
    DISR EF 5;
    DISR GHIJ 4;
    MEAT D 700;
    Stop;
  }
}
Attachments
CrashReport-01-12-2019.zip
(31.04 KiB) Downloaded 62 times
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [3.7.1] Very Fatal Error with inherited ZScript actor

Post by Graf Zahl »

A_Look2 is a somewhat problematic function because it jumps to the 4 states following it without any good method to validate them. Your VillagerB only has one following state so it will jump to some state beyond that and access random data, interpreting it as a function call. And that will definitely crash. At the very least, you have to use 4 states in your See sequence, but keep in mind that these states are meant to display random standing animations
Post Reply

Return to “Closed Bugs [GZDoom]”