Jump to content

Help - Reference not defined


Recommended Posts

Hey there guys

 

I'm very new to scripting, so I was wondering if anyone could help me with the issue I'm having here:

Scriptname TIF__0502E6E0 Extends TopicInfo Hidden

Quest Property SKHG01  Auto  
ObjectReference Property FellglowKeepRef  Auto  

Function Fragment_0(ObjectReference akSpeakerRef)

Actor akSpeaker = akSpeakerRef as Actor

SKHG01.SetStage(10)

akSpeaker.PathToReference(FellglowKeepRef(), 1)

EndFunction

I'm being told that FellglowKeepRef is not defined, but I'm pretty sure it is. Any help would be appreciated :)

 

Thanks in advance

Link to comment
Share on other sites

Thanks for the quick reply! Now I'm getting this:

TIF__0502E6E0.psc(23,0): missing EOF at 'Scriptname'

And this is what my script currently looks like:

Scriptname TIF__0502E6E0 Extends TopicInfo Hidden

Quest Property SKHG01  Auto  
ObjectReference Property FellglowKeepRef  Auto  

Function Fragment_0(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor

BeginFunction

SKHG01.SetStage(10)

akSpeaker.PathToReference(FellglowKeepRef)

;END CODE
EndFunction
;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment
;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 1
Scriptname TIF__0502E6E0 Extends TopicInfo Hidden

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

Any thoughts?

 

Thanks again, I really can't express how grateful I am for your help!

Link to comment
Share on other sites

So after making the suggested changes, everything compiles, but the NPC still isn't going anywhere. I've turned off all sandbox-related things involved with him, but no luck.

Scriptname TIF__0502E6E0 Extends TopicInfo Hidden

Quest Property SKHG01  Auto  

ObjectReference Property FellglowKeepRef  Auto  

Alias Property SKHGHoldGuideWhiterun Auto 

Function Fragment_0(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor

SKHG01.SetStage(10)

akSpeaker.PathToReference(FellglowKeepRef, 1)

EndFunction

Does anything stick out to you there that I'm missing?

Link to comment
Share on other sites

Not sure what the Alias Property SKHGHoldGuideWhiterun is for, but it's harmless.

 

PathToReference() is actually a Bool function which returns true or false depending on whether or not the actor can find a path to the target. You could test the value returned.

Bool bSuccess = akSpeaker.PathToReference(FellglowKeepRef, 1)
Debug.Notification("Path Success "+bSuccess)

and see what you get in-game.

Link to comment
Share on other sites

Ah yes, I was attempting to use an Alias instead of Actor to see if that was my issue. Forgot to get rid of it.

 

So does it not actually set the target to travel to that location?

 

Anyway, I tried this and nothing happens still. I've checked the objective, which it turns out isn't updating, so pretty much nothing is happening here.

 

I have all of this script in the general script in a topic info window (as opposed to the begin/end parts), have tried putting bits of it into "end" and messing about with those, but to absolutely no avail.

 

By the way, I'm going to thank you yet again, I'm sure you're getting a bit sick of basically making this for me. I'm going to give you a bunch of credit if/when I publish this mod if you're not against that. I'm still learning, but I thought I'd be able to teach myself mostly. It's turning out to be trickier than I first assumed.

Link to comment
Share on other sites

It's okay, I don't mind helping.

 

It's not enough to just attach the script to the topic. You need to get it into either the begin or end fragment because thats how the game engine connects the speaking of the topic with the running of the script.

 

Copy the SetStage and PathToReference lines into the OnEnd fragment window and hit compile. Then close the topic, close the quest, save the esp, close the CK and use notepad to look at the source code. With luck, it will now have two functions - your original fragment_0 and a new one called, maybe, fragment_1. Inside the esp, it will have recorded data for that topic info to the effect that OnEnd, it should call fragment_1 in the script. Or fragment_2, or whatever number it has reached. It stores the scriptname and fragment number explicitly inside the esp with the other data for that topic info.

 

Hope this makes sense.

Link to comment
Share on other sites

He's still not on his way. The quest stage is updating but he's not going anywhere and the debug message isn't showing.

 

(Also, for anyone who might stumble across this in the future, I had to get rid of a second "Scriptname TIF__0502E6E0 Extends TopicInfo Hidden" that it added in to get it to compile).

Scriptname TIF__0502E6E0 Extends TopicInfo Hidden

Quest Property SKHG01  Auto  

ObjectReference Property FellglowKeepRef  Auto  

Function Fragment_0(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor

SKHG01.SetStage(10)

akSpeaker.PathToReference(FellglowKeepRef, 1)

Bool bSuccess = akSpeaker.PathToReference(FellglowKeepRef, 1)
Debug.Notification("Path Success "+bSuccess)

EndFunction
;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 6

;BEGIN FRAGMENT Fragment_5
Function Fragment_5(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor
;BEGIN CODE
SKHG01.SetStage(10)

akSpeaker.PathToReference(FellglowKeepRef, 1)

Bool bSuccess = akSpeaker.PathToReference(FellglowKeepRef, 1)
Debug.Notification("Path Success "+bSuccess)

;END CODE
EndFunction
;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

Really thought this would work - it would have been the third time since I started scripting a week ago that the solution was "turn it off and on again" :P

Link to comment
Share on other sites

  • Recently Browsing   0 members

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