OldUnreal / UnrealTournamentPatches

Other
999 stars 29 forks source link

[469b] Nalis dont raise their event when they fade out #384

Open SeriousBarbie opened 3 years ago

SeriousBarbie commented 3 years ago

When a Nali is in state "FadeOut" it simply gets destroyed and therefore does not raise its event: https://github.com/Slipyx/UT99/blob/master/UnrealShare/Nali.uc#L907

Bug exists in all versions AFAIK.

SeriousBuggie commented 3 years ago

Reproduce:

  1. Start DM-!!!!!nali_bug.zip
  2. Wait until Nali not teleported.

Expected result: SpecialEvent1 fired. Actual result: SpecialEvent1 not fired.

Fix: https://github.com/Slipyx/UT99/blob/f2ebd703845075a2d667e8e3f2f71a5e7f187610/UnrealShare/Nali.uc#L907

    function Tick(float DeltaTime)
    {
        local int NewFatness; 

        if ( !bFading )
        {
            NewFatness = fatness + 50 * DeltaTime;
            bFading = ( NewFatness > 160 );
        }
        else if ( Style == STY_Translucent )
        {
            ScaleGlow -= 3 * DeltaTime;
            if ( ScaleGlow < 0.3 )
            {
                PlaySound(sound'Teleport1',, 2.0);
                Destroy();

change to

    function Tick(float DeltaTime)
    {
        local int NewFatness; 
        local actor A;

        if ( !bFading )
        {
            NewFatness = fatness + 50 * DeltaTime;
            bFading = ( NewFatness > 160 );
        }
        else if ( Style == STY_Translucent )
        {
            ScaleGlow -= 3 * DeltaTime;
            if ( ScaleGlow < 0.3 )
            {
                PlaySound(sound'Teleport1',, 2.0);
                if( Event != '' )
                    foreach AllActors( class 'Actor', A, Event )
                        A.Trigger( self, self );
                Destroy();
SeriousBarbie commented 3 years ago

Better remove event after it has been risen to avoid double rising caused by other existing fixes.


class NaliSB extends Nali;
...
event Destroyed() {
local Actor A;

    if (IsInState('FadeOut'))
        if (Event != '')
            foreach AllActors(Class'Actor', A, Event)
                A.Trigger(Self, Self);
}
SeriousBuggie commented 3 years ago

Not sure about that. Some code can be written in assumption Event not changed. For example used custom nali which do some stuff in Destroyed(). Like your code. Why need nullify Event for make compatible with your code but not leave Event same as some other code assume?