[Not a bug] [ZScript] Projectile PostBeginPlay bug

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

[ZScript] Projectile PostBeginPlay bug

Postby Cherepoc » Mon Dec 19, 2016 5:53 am

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 allExpand view
class BuggedPlasmaBall : PlasmaBall replaces PlasmaBall
      TNT1 A 0 BugDeath;
      goto Super::Death;
   override void PostBeginPlay()
   void BugDeath()
User avatar
Joined: 08 Sep 2004
Location: Russia

Re: [ZScript] Projectile PostBeginPlay bug

Postby Graf Zahl » Mon Dec 19, 2016 5:57 am

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Joined: 19 Jul 2003
Location: Germany

Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 0 guests