[ZScript] Projectile PostBeginPlay bug

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
User avatar
Cherepoc
Posts: 60
Joined: Wed Sep 08, 2004 1:26 pm
Location: Russia

[ZScript] Projectile PostBeginPlay bug

Post by Cherepoc »

PostBeginPlay is expected to be executed before any of actor frame actions, right? But if you stand in front of a wall and fire a projectile, then the code in it's first death frame action is executed before PostBeginPlay.
Use the code below. Start the game, change you weapon to plasmagun, run to nearby wall as close as you can, fire the projectile. You will see "Death" message appear before "PostBeginPlay".

Code: Select all

class BuggedPlasmaBall : PlasmaBall replaces PlasmaBall
{
	States
	{
	Death:
		TNT1 A 0 BugDeath;
		goto Super::Death;
	}
	
	override void PostBeginPlay()
	{
		A_Log("PostBeginPlay");
	}
	
	void BugDeath()
	{
		A_Log("Death");
	}
}
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49071
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [ZScript] Projectile PostBeginPlay bug

Post by Graf Zahl »

Careful: PostBeginPlay is "called before the thinker ticks for the first time". Read this sentence very carefully to understand your mistake. This does not say "is called before the actor does anything else". In your case the missile is exploded right in the spawning function, and that happens BEFORE it can tick for the first time.
Post Reply

Return to “Closed Bugs [GZDoom]”