OK - unrealscript error I don't understand:  (Read 11470 times)

Piglet

  • 1337
  • *
  • Posts: 3248
  • Country: gb
OK - unrealscript error I don't understand:
« on: April 10, 2020, 21:57 »
error:

Code: [Select]
OLCTFSquadAI VCTF4-Interstellar_Oasis.OLCTFSquadAI (Function OLTeamGames.OLCTFSquadAI.CheckVehicle:0066) Accessed None 'Holder'
OLCTFSquadAI VCTF4-Interstellar_Oasis.OLCTFSquadAI (Function OLTeamGames.OLCTFSquadAI.CheckVehicle:0066) Accessed None 'Holder'
OLCTFSquadAI VCTF4-Interstellar_Oasis.OLCTFSquadAI (Function OLTeamGames.OLCTFSquadAI.CheckVehicle:0066) Accessed None 'Holder'
OLCTFSquadAI VCTF4-Interstellar_Oasis.OLCTFSquadAI (Function OLTeamGames.OLCTFSquadAI.CheckVehicle:0066) Accessed None 'Holder'
OLCTFSquadAI VCTF4-Interstellar_Oasis.OLCTFSquadAI (Function OLTeamGames.OLCTFSquadAI.CheckVehicle:0066) Accessed None 'Holder'
OLCTFSquadAI VCTF4-Interstellar_Oasis.OLCTFSquadAI (Function OLTeamGames.OLCTFSquadAI.CheckVehicle:0066) Accessed None 'Holder'
OLCTFSquadAI VCTF4-Interstellar_Oasis.OLCTFSquadAI (Function OLTeamGames.OLCTFSquadAI.CheckVehicle:0066) Accessed None 'Holder'
OLCTFSquadAI VCTF4-Interstellar_Oasis.OLCTFSquadAI (Function OLTeamGames.OLCTFSquadAI.CheckVehicle:0066) Accessed None 'Holder'
OLCTFSquadAI VCTF4-Interstellar_Oasis.OLCTFSquadAI (Function OLTeamGames.OLCTFSquadAI.CheckVehicle:0066) Accessed None 'Holder'

Code - one mention of "Holder" - and that is to check whether it's None or not!:

Code: [Select]
function bool CheckVehicle(Bot B)
{
    local int i;

    for(i=0;i<EnemyFlags.Length;i++)
    {
        if ( (EnemyFlags[i].Holder == None) && (VSize(B.Pawn.Location - EnemyFlags[i].Position().Location) < 1600) && CanCaptureFlag(B, EnemyFlags[i]) )
            return false;
    }

    if ( (B.PlayerReplicationInfo.HasFlag != None) && (VSize(B.Pawn.Location - FriendlyFlag.HomeBase.Location) < 1600) )
        return false;

    return Super.CheckVehicle(B);
}

zeus

  • Full MemberĀ 
  • *
  • Posts: 86
  • Country: um
Re: OK - unrealscript error I don't understand:
« Reply #1 on: April 10, 2020, 22:24 »
PEOPLE AT THE MOUNTAIN BELIEVE THIS PART TO BE FAULTY IN THE FOR LOOP
Quote
EnemyFlags ( i ) .Holder

IT SEEMS TO ASSUME THAT EnemyFlags ( i ) IS NOT NONE EVENTUALLY ARRIVING TO None.Holder

Piglet

  • 1337
  • *
  • Posts: 3248
  • Country: gb
Re: OK - unrealscript error I don't understand:
« Reply #2 on: April 10, 2020, 22:29 »
You're allowed to check if Holder is 'none'...but you can't use it in any other way if it is.

This error should not be possible from the code in the function....

zeus

  • Full MemberĀ 
  • *
  • Posts: 86
  • Country: um
Re: OK - unrealscript error I don't understand:
« Reply #3 on: April 10, 2020, 22:32 »
NONO, THE IF IS INCOMPLETE - IT ASSUMES THAT EnemyFlags IS ALWAYS SOME LEGIT OBJECT
(EnemyFlags ( i )  != None) &&

( PROBABLY THE IF BLOCK BELOW IS SOMEWHAT FAULTY, BUT TO GET THE IDEA )

Code: [Select]
function bool CheckVehicle(Bot B)
{
    local int i;

    for(i=0;i<EnemyFlags.Length;i++)
    {
        if ( (EnemyFlags[i] != None) && (EnemyFlags[i].Holder == None) && (VSize(B.Pawn.Location - EnemyFlags[i].Position().Location) < 1600) && CanCaptureFlag(B, EnemyFlags[i]) )
            return false;
    }

    if ( (B.PlayerReplicationInfo.HasFlag != None) && (VSize(B.Pawn.Location - FriendlyFlag.HomeBase.Location) < 1600) )
        return false;

    return Super.CheckVehicle(B);
}

Piglet

  • 1337
  • *
  • Posts: 3248
  • Country: gb
Re: OK - unrealscript error I don't understand:
« Reply #4 on: April 10, 2020, 22:59 »
The if block is complete. Enemyflags is always legit, otherwise the error would be "Accessed None 'EnemyFlags'"


Absolute_Madness

  • 1337
  • *
  • Posts: 600
  • Country: fr
Re: OK - unrealscript error I don't understand:
« Reply #5 on: April 12, 2020, 10:30 »
does this happens when there are no bots in game?

Piglet

  • 1337
  • *
  • Posts: 3248
  • Country: gb
Re: OK - unrealscript error I don't understand:
« Reply #6 on: April 12, 2020, 11:34 »
I don't know. I very much doubt it