Interesting. Where is this flag (un)set and what part of startup is covered by it? I didn't find anything in the sources.
class'LevelInfo'.bStartUp
-
- Godlike
- Posts: 2911
- Joined: Fri Sep 25, 2015 9:01 pm
- Location: moved without proper hashing
class'LevelInfo'.bStartUp
"If Origin not in center it be not in center." --Buggie
-
- Godlike
- Posts: 3130
- Joined: Sat Mar 21, 2020 5:32 am
Re: class'LevelInfo'.bStartUp
Set in native part. It is guard flag during map load.
It set to true. After that start call chain of events for actors placed on map:
Wanna mention chain of events done for all actors in each part, before start next part.
This mean All actors called eventPreBeginPlay only after that come eventBeginPlay.
unlike spawn on runtime where this events goes one after another.
It set to true. After that start call chain of events for actors placed on map:
- eventInitGame
- eventPreBeginPlay
- eventBeginPlay
- SetActorZone
- eventPostBeginPlay
- eventSetInitialState
- SetBase
Wanna mention chain of events done for all actors in each part, before start next part.
This mean All actors called eventPreBeginPlay only after that come eventBeginPlay.
unlike spawn on runtime where this events goes one after another.
-
- Novice
- Posts: 10
- Joined: Sat Nov 05, 2022 9:45 pm
Re: class'LevelInfo'.bStartUp
Could you explain each part of the chain in a couple of sentences? When it starts and what happens. I think it will be helpful for all of us.
-
- Godlike
- Posts: 3130
- Joined: Sat Mar 21, 2020 5:32 am
Re: class'LevelInfo'.bStartUp
When: Each part start after previous done. In general it start on level load, as part of load sequence.
What: Called appropriate event in UnrealScript (eventPreBeginPlay call event PreBeginPlay in UnrealScript) or do some action (SetActorZone - Set Actor Zone )
It is already described pretty well here: https://wiki.beyondunreal.com/Legacy:Ch ... el_Startup
What: Called appropriate event in UnrealScript (eventPreBeginPlay call event PreBeginPlay in UnrealScript) or do some action (SetActorZone - Set Actor Zone )
It is already described pretty well here: https://wiki.beyondunreal.com/Legacy:Ch ... el_Startup
-
- Godlike
- Posts: 6435
- Joined: Sun May 09, 2010 6:15 pm
- Location: On the roof.
Re: class'LevelInfo'.bStartUp
Okay, allow me to explain what's up. Some dude with experience in scripting and servers was writing something for tweaking whatever problem. My "weak" point is that I'm used to look at codes done by those with some experience especially if their content does what it says. I realized later that this is one of methods for applying "Once-Only" tasks. Of course methods for "once-only" tasks are doable in many formats - it depends on your needs or various logic aspects of tweaks applied. You can use a function called in a tick a single time, you can use a timer, auto state, another actor living a short life, etc.
If you can find some resources (they are on Internet) there all code is exposed. If you don't have access to look at them, then chain of events and said variable is probably similar to this old code
Spoiler
Code: Select all
// Init scripting.
for( i=0; i<GLevel->Actors.Num(); i++ )
if( GLevel->Actors(i) )
GLevel->Actors(i)->InitExecution();
// Enable actor script calls.
Info->bBegunPlay = 1;
Info->bStartup = 1; // exposed to UScript as boolean
// Init the game.
if( Info->Game )
Info->Game->eventInitGame( Options, Error );
// Send PreBeginPlay.
for( i=0; i<GLevel->Actors.Num(); i++ )
if( GLevel->Actors(i) )
GLevel->Actors(i)->eventPreBeginPlay();
// Set BeginPlay.
for( i=0; i<GLevel->Actors.Num(); i++ )
if( GLevel->Actors(i) )
GLevel->Actors(i)->eventBeginPlay();
// Set zones.
for( i=0; i<GLevel->Actors.Num(); i++ )
if( GLevel->Actors(i) )
GLevel->SetActorZone( GLevel->Actors(i), 1, 1 );
// Post begin play.
for( i=0; i<GLevel->Actors.Num(); i++ )
if( GLevel->Actors(i) )
GLevel->Actors(i)->eventPostBeginPlay();
// Begin scripting.
for( i=0; i<GLevel->Actors.Num(); i++ )
if( GLevel->Actors(i) )
GLevel->Actors(i)->eventSetInitialState();
// Find bases
for( i=0; i<GLevel->Actors.Num(); i++ )
{
if( GLevel->Actors(i) )
{
if ( GLevel->Actors(i)->AttachTag != NAME_None )
{
//find actor to attach self onto
for( INT j=0; j<GLevel->Actors.Num(); j++ )
{
if( GLevel->Actors(j) && (GLevel->Actors(j)->Tag == GLevel->Actors(i)->AttachTag) )
{
GLevel->Actors(i)->SetBase(GLevel->Actors(j), 0);
break;
}
}
}
else if( !GLevel->Actors(i)->Base && GLevel->Actors(i)->bCollideWorld
&& (GLevel->Actors(i)->IsA(ADecoration::StaticClass()) || GLevel->Actors(i)->IsA(AInventory::StaticClass()) || GLevel->Actors(i)->IsA(APawn::StaticClass()))
&& ((GLevel->Actors(i)->Physics == PHYS_None) || (GLevel->Actors(i)->Physics == PHYS_Rotating)) )
{
GLevel->Actors(i)->FindBase();
if ( GLevel->Actors(i)->Base == Info )
GLevel->Actors(i)->SetBase(NULL, 0);
}
}
}
Info->bStartup = 0; //intialization ends here
}