Can someone help me? A script is on an item that follows the player around. It uses fose commands GetFirstRef / GetNextRef and Label to do its job of adding weapons to raiders and talon company. At first it works, but after a while it crashes the game after probably 10 minutes of testing.
scn EAGLEAshtrayActivatorScriptref EAGLErefshort EAGLErandomBegin GameMode If ( Player.IsInInterior == 0 ) && ( GetCurrentTime > 5.5 ) && ( GetCurrentTime < 18.5 ) Set EAGLEref to GetFirstRef 200 1 0 Label 10 If ( EAGLEref.GetDisabled == 0 ) && ( EAGLEref.IsEssential == 0 ) && ( EAGLEref.GetInFaction RaiderFaction == 1 ) && ( EAGLEref.GetIsCreature == 0 ) && ( EAGLEref.GetDead == 0 ) && ( EAGLEref.IsInInterior == 0 ) Set EAGLErandom to GetRandomPercent If ( EAGLEref.GetItemCount EAGLEMolotovDriver == 0 ) && ( EAGLEref.GetItemCount EAGLEMolotovAmmo == 0 ) && ( EAGLErandom < 20 ) EAGLEref.AddItem EAGLEMolotovDriver 1 EAGLEref.AddItem EAGLEMolotovAmmo 16; EAGLEref.AddItem EAGLEMordino 1 EAGLEref.EquipItem EAGLEMolotovDriver 1 Set EAGLEref to Pencil01 Set EAGLEref to GetNextRef; Goto 10 EndIf ElseIf ( EAGLEref.GetDisabled == 0 ) && ( EAGLEref.IsEssential == 0 ) && ( EAGLEref.GetInFaction TalonCompany == 1 ) && ( EAGLEref.GetIsCreature == 0 ) && ( EAGLEref.GetDead == 0 ) && ( EAGLEref.IsInInterior == 0 ) Set EAGLErandom to GetRandomPercent If ( EAGLEref.GetItemCount EAGLEGrenadeLauncher == 0 ) && ( EAGLEref.GetItemCount Morphine == 0 ) && ( EAGLErandom < 20 ); EAGLEref.AddItem EAGLESmokeGrenade 4 EAGLEref.AddItem EAGLEGrenadeLauncher 1 EAGLEref.AddItem AmmoShotgunShell 16 EAGLEref.AddItem Morphine 1 EAGLEref.EquipItem EAGLEGrenadeLauncher 1 Set EAGLEref to Pencil01 Set EAGLEref to GetNextRef; Goto 10 EndIf ElseIf ( EAGLEref == Player ) Set EAGLErandom to GetRandomPercent Set EAGLEref to Pencil01 Set EAGLEref to GetNextRef Goto 10 EndIf EndIfEnd
The only thing I can see is when GetNextRef returns 0 because all the actors have been scanned. But wouldn't that change to something when the player changes cells and more actors are available?