Jump to content

[LE] GetReference() Stopped working?


vicyntae

Recommended Posts

I have no idea what happened, but for some reason, a part of my mod, an actor scanner, stopped working for me. I managed to pinpoint the error down to the line, and the issue is that GetReference(), along with GetActorReference(), stopped working, It's not that they are not returning what's there, they aren't returning at all, leaving my scripts stuck. Has any one else had this issue? I've tried deleting my skyrim installation and reinstalling SKSE, but that didn't help.

 

Here's the function that's not working:

 

Form[] Function getActors()
Notice("Getting current actor list...")
Int i
Int NumAlias = SCX_MonitorManagerQuest.GetNumAliases()
Note("NumAliases = " + NumAlias)
Int k
Form[] ReturnArray = Utility.CreateFormArray(NumAlias, None)
While i < NumAlias
ReferenceAlias LoadedAlias = SCX_MonitorManagerQuest.GetNthAlias(i) as ReferenceAlias
Note("Found alias " + i + ": " + LoadedAlias as bool)
Actor Target = LoadedAlias.GetReference() as Actor This line isn't returning.
If Target
Notice("Loaded actor " + i + " = " + nameGet(Target))
ReturnArray = Target
k += 1
Else
Note("Alias " + i + " empty...")
EndIf
i += 1
EndWhile
Note("Num actors found: " + k)
Return ReturnArray
EndFunction

 

Link to comment
Share on other sites

Are you sure it isn't returning at all, and have you checked the debug logs?

Debug logs show nothing from my scripts nor from the game in regards to GetReference, and when I delete the actual function call, the script continues normally. I've waited several minutes for the script to show the next message, but it doesn't.

 

EDIT: I also checked to see if the OnInit block was completing on the manager quest, and it finished before anything was called to it.

Edited by vicyntae
Link to comment
Share on other sites

 

Are you sure it isn't returning at all, and have you checked the debug logs?

Debug logs show nothing from my scripts nor from the game in regards to GetReference, and when I delete the actual function call, the script continues normally. I've waited several minutes for the script to show the next message, but it doesn't.

 

EDIT: I also checked to see if the OnInit block was completing on the manager quest, and it finished before anything was called to it.

 

 

What does the Note function do, and does it work elsewhere? Have you tried Debug.Trace statements to check the script's state? Do you or any of the scripts in the inheritance chain override GetReference()?

Link to comment
Share on other sites

Ugh, found it. I replaced the oninit block on the alias itself inself instead of the quest, and it started working. Now to find out why the oninit block wasn't working.

 

Thanks for your help guys.

 

OnInit blocks will delay execution of any functions called on that script object that are not, themselves, in an OnInit block. If you had some kind of infinite loop processing on the alias's OnInit, it might do it?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...