As I've been running around with my latest Luggage beta, I noticed buggy things start happening when this script starts acting up. Its state gets stuck at 2, and the timer gets stuck at 0. When this happens, the Luggage stops appearing when summoned and even turned invisisble. Seriously, I went back to where I'd left the Luggage after it failed to appear, and I couldn't see it, but I could mouse over it. I disabled/enabled it in the console, which fixed the invisibility problem, but it still wouldn't come when called until I'd stopped this script in the console. I can't fix the stuck variables in the console though because it's a targeted global script.
; targeted global script to reset the AI of a companion if needed
Short state
Float timer
If ( MenuMode )
Return
Elseif ( GetHealth < 1 ) ;in case the script loses its targeting.
Set state to -1
Elseif ( state == -1 )
Set state to 0
Set timer to 0
StopScript AATL_AIFix
Return
Elseif ( state == 0 )
Set timer to ( timer + GetSecondsPassed )
Elseif ( timer < 1 )
Return
Endif
Set timer to 0
Set state to 1
Elseif ( state == 1 )
If ( GetCurrentAIPackage != -1 ) ;AI is no longer invalid, we are done
Set state to -1
Return
Endif
If ( AATL_portflw > 0 )
AIFollow Player 0 0 0 0
Else
AIWander 0 0 0 0 100 0 0 0
Endif
Set state to 2
Elseif ( state == 2 ) ;this is where it's getting stuck. Why?
Set timer to ( timer + GetSecondsPassed )
If ( timer < 1 )
Return
Endif
If ( GetCurrentAIPackage == 3 )
Set state to -1
Return
Elseif ( GetCurrentAiPackage != -1 )
If ( AATL_portflw < 1 )
Set state to -1
Return
Endif
Elseif ( GetDistance Player > 9999 ) ;check for different cell
Set state to -1
Return
Endif
Set timer to 0
StartCombat Player
Set state to 3
Elseif ( state == 3 )
Set timer to ( timer + GetSecondsPassed )
If ( timer < 1 )
Return
Endif
StopCombat
Set state to 1
Endif
End
Anyone have any idea why the script is sticking there?
Edit: I tried commenting out everything except "set state to 3" in the ( state == 2 ) if block, and it's STILL stuck on state 2. This is after I deleted the script in EE in my save to make sure the next thing I did started it fresh.
Edit2: Ok, this is weird. Rewriting the script like this makes the state get stuck at 1.
; targeted global script to reset the AI of a companion if needed
Short state
Float timer
If ( MenuMode )
Return
Elseif ( GetHealth < 1 ) ;in case the script loses its targeting.
Set state to -1
Elseif ( state == -1 )
Set state to 0
Set timer to 0
StopScript AATL_AIFix
Return
Elseif ( state == 0 )
Set timer to ( timer + GetSecondsPassed )
Elseif ( timer < 1 )
Return
Endif
Set timer to 0
Set state to 1
Return
Elseif ( state == 1 )
If ( GetCurrentAIPackage != -1 ) ;AI is no longer invalid, we are done
Set state to -1
Return
Endif
If ( AATL_portflw > 0 )
AIFollow Player 0 0 0 0
Else
AIWander 0 0 0 0 100 0 0 0
Endif
Set state to 2
Return
Elseif ( state == 2 ) ;this is where it's getting stuck. Why?
Set timer to ( timer + GetSecondsPassed )
If ( timer < 1 )
Return
Endif
If ( GetCurrentAIPackage == 3 )
Set state to -1
Return
Elseif ( GetCurrentAiPackage != -1 )
If ( AATL_portflw < 1 )
Set state to -1
Return
Endif
Elseif ( GetDistance Player > 9999 ) ;check for different cell
Set state to -1
Return
Endif
Set timer to 0
StartCombat Player
Set state to 3
Return
Elseif ( state == 3 )
Set timer to ( timer + GetSecondsPassed )
If ( timer < 1 )
Return
Endif
StopCombat
Set state to 1
Endif
End
And rewriting it like this makes the state get stuck at 3.
; targeted global script to reset the AI of a companion if needed
Short state
Float timer
If ( MenuMode )
Return
Elseif ( GetHealth < 1 ) ;in case the script loses its targeting.
Set state to -1
Elseif ( state == -1 )
Set state to 0
Set timer to 0
StopScript AATL_AIFix
Return
Elseif ( state == 0 )
Set timer to ( timer + GetSecondsPassed )
Elseif ( timer < 1 )
Return
Endif
Set timer to 0
Set state to 1
Elseif ( state == 1 )
If ( GetCurrentAIPackage != -1 ) ;AI is no longer invalid, we are done
Set state to -1
Return
Endif
If ( AATL_portflw > 0 )
AIFollow Player 0 0 0 0
Else
AIWander 0 0 0 0 100 0 0 0
Endif
Set state to 2
Endif
If ( state == 2 ) ;this is where it's getting stuck. Why?
Set timer to ( timer + GetSecondsPassed )
If ( timer < 1 )
Return
Endif
If ( GetCurrentAIPackage == 3 )
Set state to -1
Return
Elseif ( GetCurrentAiPackage != -1 )
If ( AATL_portflw < 1 )
Set state to -1
Return
Endif
Elseif ( GetDistance Player > 9999 ) ;check for different cell
Set state to -1
Return
Endif
Set timer to 0
StartCombat Player
Set state to 3
Elseif ( state == 3 )
Set timer to ( timer + GetSecondsPassed )
If ( timer < 1 )
Return
Endif
StopCombat
Set state to 1
Endif
End
And rewriting it like this makes it stuck at 1 again.
; targeted global script to reset the AI of a companion if needed
Short state
Float timer
If ( MenuMode )
Return
Elseif ( GetHealth < 1 ) ;in case the script loses its targeting.
Set state to -1
Elseif ( state == -1 )
Set state to 0
Set timer to 0
StopScript AATL_AIFix
Return
Elseif ( state == 0 )
Set timer to ( timer + GetSecondsPassed )
Elseif ( timer < 1 )
Return
Endif
Set timer to 0
Set state to 1
Endif
If ( state == 1 )
If ( GetCurrentAIPackage != -1 ) ;AI is no longer invalid, we are done
Set state to -1
Return
Endif
If ( AATL_portflw > 0 )
AIFollow Player 0 0 0 0
Else
AIWander 0 0 0 0 100 0 0 0
Endif
Set state to 2
Endif
If ( state == 2 ) ;this is where it's getting stuck. Why?
Set timer to ( timer + GetSecondsPassed )
If ( timer < 1 )
Return
Endif
If ( GetCurrentAIPackage == 3 )
Set state to -1
Return
Elseif ( GetCurrentAiPackage != -1 )
If ( AATL_portflw < 1 )
Set state to -1
Return
Endif
Elseif ( GetDistance Player > 9999 ) ;check for different cell
Set state to -1
Return
Endif
Set timer to 0
StartCombat Player
Set state to 3
Endif
If ( state == 3 )
Set timer to ( timer + GetSecondsPassed )
If ( timer < 1 )
Return
Endif
StopCombat
Set state to 1
Endif
End
What is going on here?