Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alien slave beams stay forever if they exist during a level change #3104

Open
SamVanheer opened this issue May 6, 2021 · 0 comments
Open

Comments

@SamVanheer
Copy link

If an alien slave's beams exist and the slave is in a transition volume when a changelevel occurs, the slave will transition to the next map but the beams will not.

Beams are set to never transition:

halflife/dlls/effects.h

Lines 107 to 113 in c7240b9

int ObjectCaps( void )
{
int flags = 0;
if ( pev->spawnflags & SF_BEAM_TEMPORARY )
flags = FCAP_DONT_SAVE;
return (CBaseEntity :: ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | flags;
}

So in the next map the slave's beam pointers will be null. When you then transition back to the previous map the beams that still exist there won't be patched up to the slave because the pointers are null now, and the beams will remain forever.
Repeatedly going between transitions while a slave's beams exist will eventually cause the game to run out of edict slots and exit with a fatal error.

To fix this the beams need to be set to be temporary:

m_pBeam[m_iBeams]->pev->spawnflags |= SF_BEAM_TEMPORARY; // Flag these to be destroyed on save/restore or level transition

This needs to be done in 3 places:

m_pBeam[m_iBeams]->SetNoise( 80 );

m_pBeam[m_iBeams]->SetNoise( 80 );

m_pBeam[m_iBeams]->SetNoise( 20 );

This will also cause the beams to disappear if you save during an attack and then load it again. The actual attack still occurs, it's just the beam effects that will disappear.

@SamVanheer SamVanheer changed the title Alien slave beams are stay forever if they exist during a level change Alien slave beams stay forever if they exist during a level change May 6, 2021
SamVanheer added a commit to twhl-community/halflife-updated that referenced this issue Apr 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants