Reliability of GetDisabled and PlayerRef - CTD Help with scr

Post » Fri May 04, 2012 8:45 am

So I have a script, and every so often it seems to be causing a crash. According to one of my users, the crashes stopped when the following lines of code was commented out:

elseif vActor.GetDetectionLevel PlayerRef == 3 && vActor.GetLineOfSight PlayerRef == 1  let vCastYN := 0

His research further indicated the following:
When called on a disabled actor, it crashes the game. May CTD if GetLOS is called by an actor that was disabled in the previous frame. A delay of a few frames after the actor is enabled will solve this issue.

However, only a few lines up, I already check to see if the calling actor is disabled, and then the script is supposed to exit out early:
; Early Exits if NPC ref falls into following categoriesBegin GameMode    if IsFormValid vActor != 1 || vIni != 1 || vActor.IsActor == 0 || vActor.GetDead == 1 || vActor.GetDisabled == 1 || vActor.GetProcessLevel > 0        return    endifEnd

So I'm trying to figure out what might going on, and could use some help here. A couple of possibilities come to mind:
1. I have different chunks of code, each in their own separate GameMode blocks. "Return" is only exiting out of that block not the script, although the description I have of "Return" is that it halts further processing of the entire script, not just the block. So maybe the description is wrong.
2. The crash was happening when the player was leaving the IC Market district and going to the exterior road/path that leads to the prison. Presumably there was something hanging around outside that was disabled. However, according to my code above, the script should have exited out early. Is it possible that the PlayerRef was temporarily disabled during the transition, and that caused the crash? Should I add in something like "PlayerRef.GetDisabled == 1" into the very beginning of the script header so that if the player is disabled for some reason, the NPCs don't do anything? Is something like that even possible?

This is a real head scratcher, because it *seems* like I've already done everything right and I'd love to solve this ASAP before more reports of crashing come down the turnpike. But I don't want to guess wrong and just make something up and cause more problems. So any help would be greatly appreciated.
User avatar
Chelsea Head
 
Posts: 3433
Joined: Thu Mar 08, 2007 6:38 am

Post » Fri May 04, 2012 2:09 pm

You are checking if the actor is disabled THIS frame and, according to your quote, the CTD may happen if he was disabled last frame.

If this is the cause, waiting a few frames should fix it
 If vActor.GetDisabled == 1    Let FrameCount := 3    ReturnElseif FrameCount  > 0    FrameCount -= 1    Returnendif

Just checked: Return exists the whole script.
User avatar
Kanaoka
 
Posts: 3416
Joined: Fri Jun 16, 2006 2:24 pm

Post » Fri May 04, 2012 8:01 am

Okay, I'll try that. Thanks!
User avatar
loste juliana
 
Posts: 3417
Joined: Sun Mar 18, 2007 7:37 pm


Return to IV - Oblivion