PostBeginPlay erroneously called upon loading a save

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 a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: PostBeginPlay erroneously called upon loading a save

Re: PostBeginPlay erroneously called upon loading a save

by Player701 » Sat Jan 26, 2019 9:25 am

I guess this was closed due to the recent rollback. Can confirm this bug does not occur in the latest master.

PostBeginPlay erroneously called upon loading a save

by Player701 » Fri Jan 18, 2019 1:09 pm

When a save game is loaded, PostBeginPlay will be called for all actors present in the map. This is probably unintended, since PostBeginPlay usually performs first-time initialization, and calling it more than once can lead to unexpected behavior. It used to work correctly until one of these three commits. (the exact one cannot be determined because some of them cannot be checked due to errors / crashes)

Here's a script to reproduce this bug easily (also attached to this report):

Code: Select all

class TestZombie : ZombieMan replaces ZombieMan
{
    Default
    {
        RenderStyle "Translucent";
    }
    
    override void PostBeginPlay()
    {
        Super.PostBeginPlay();
        Console.Printf("TestZombie::PostBeginPlay");
        Alpha = 0.1;
    }
    
    override void Tick()
    {
        Super.Tick();
        
        if (Alpha < 1)
        {
            Alpha += 0.01;
        }
    }
}
At the start of the game, all zombies are initially translucent, but they will soon turn opaque. Saving and reloading the game, however, will make them translucent again. This didn't happen in older versions. Note that this bug is also reproducible when revisiting a map within a hub.

Upd: Here is another proof that the current behavior is wrong: if a SecretTrigger actor is placed in a map, it will increase the total number of secrets with each subsequent save-load cycle. This is definitely not how it's supposed to work...
Attachments
zscript.txt
(434 Bytes) Downloaded 22 times

Top