Jump to content

Unable to compile script in script editor


Recommended Posts

Hello,

I am following a video series on how to make a follower mod and I have ran in some issues when I am trying to script a custom follower framework.

 

I use Skyrim SE Creation Kit and I run it with MO.

The code I used is the following:

Scriptname KS01HansonController extends Quest
 
 
 Actor Property PlayerREF Auto
 
ReferenceAlias Property FollowerAlias Auto
 
Faction Property DismissedFollowerFaction Auto
 
Faction Property CurrentHireling Auto
 
Message Property  FollowerDismissMessage Auto
 
Message Property  FollowerDismissMessageWedding Auto
 
Message Property  FollowerDismissMessageCompanions Auto
 
Message Property  FollowerDismissMessageCompanionsMale Auto
 
Message Property  FollowerDismissMessageCompanionsFemale Auto
 
Message Property  FollowerDismissMessageWait Auto
 
SetHirelingRehire Property HirelingRehireScript Auto
 
GlobalVariable Property FollowerRecruited Auto
 
Int Property iFollowerDismiss Auto Conditional
 
 
 
Function SetFollower(ObjectReference FollowerRef)
 
     actor FollowerActor = FollowerRef as Actor
 
     FollowerActor.RemoveFromFaction(DismissedFollowerFaction)
 
     If FollowerActor.GetRelationshipRank(PlayerREF) <3 && FollowerActor.GetRelationshipRank(PlayerREF) >= 0
 
          FollowerActor.SetRelationshipRank(PlayerREF, 3)
 
     EndIf
 
     FollowerActor.SetPlayerTeammate()
 
     FollowerAlias.ForceRefTo(FollowerActor)
 
     FollowerActor.EvaluatePackage()
 
     FollowerRecruited.SetValue(1)
 
EndFunction
 
 
 
Function FollowerWait()
 
     actor FollowerActor = FollowerAlias.GetActorRef() as Actor
 
     FollowerActor.SetActorValue("WaitingForPlayer", 1)
 
     SetObjectiveDisplayed(10, abforce = true)
 
EndFunction
 
 
 
Function FollowerFollow()
 
     actor FollowerActor = FollowerAlias.GetActorRef() as Actor
 
     FollowerActor.SetActorValue("WaitingForPlayer", 0)
 
     SetObjectiveDisplayed(10, abdisplayed = false)
 
     FollowerActor.EvaluatePackage()
 
EndFunction
 
 
 
Function DismissFollower(Int iMessage = 0, Int iSayLine = 1)
 
     If FollowerAlias && FollowerAlias.GetActorReference().IsDead() == False
 
          If iMessage == 0
 
               FollowerDismissMessage.Show()
 
          ElseIf iMessage == 1
 
               FollowerDismissMessageWedding.Show()
 
          ElseIf iMessage == 2
 
               FollowerDismissMessageCompanions.Show()
 
          ElseIf iMessage == 3
 
               FollowerDismissMessageCompanionsMale.Show()
 
          ElseIf iMessage == 4
 
               FollowerDismissMessageCompanionsFemale.Show()
 
          ElseIf iMessage == 5
 
               FollowerDismissMessageWait.Show()
 
          Else
 
              FollowerDismissMessage.Show()
 
          EndIf
 
          actor DismissedFollowerActor = FollowerAlias.GetActorRef() as Actor
 
          DismissedFollowerActor.StopCombatAlarm()
 
          DismissedFollowerActor.AddToFaction(DismissedFollowerFaction)
 
          DismissedFollowerActor.SetPlayerTeammate(false)
 
          DismissedFollowerActor.RemoveFromFaction(CurrentHireling)
 
          DismissedFollowerActor.SetActorValue("WaitingForPlayer", 0)
 
          FollowerRecruited.SetValue(0)
 
          HirelingRehireScript.DismissHireling(DismissedFollowerActor.GetActorBase())
 
          If iSayLine == 1
 
               iFollowerDismiss = 1
 
              DismissedFollowerActor.EvaluatePackage()
 
             Utility.Wait(2)
 
          EndIf
 
             FollowerAlias.Clear()
 
             iFollowerDismiss = 0
 
     EndIf
 
EndFunction

The errors I receive are:

 

Starting 1 compile threads for 1 files...
Compiling "KS01HansonController"...
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(0,0): unable to locate script Quest
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(5,15): unknown type actor
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(7,24): unknown type referencealias
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(9,17): unknown type faction
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(11,17): unknown type faction
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(13,18): unknown type message
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(15,18): unknown type message
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(17,18): unknown type message
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(19,18): unknown type message
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(21,18): unknown type message
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(23,18): unknown type message
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(25,27): unknown type sethirelingrehire
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(27,24): unknown type globalvariable
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(33,37): unknown type objectreference
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(35,39): cannot convert to unknown type actor
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(35,39): cannot cast a objectreference to a actor, types are incompatible
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(35,11): unknown type actor
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(37,19): actor is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(39,22): actor is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(39,53): cannot compare a none to a int (cast missing or types unrelated)
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(39,53): cannot relatively compare variables to None
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(39,73): actor is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(39,104): cannot compare a none to a int (cast missing or types unrelated)
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(39,104): cannot relatively compare variables to None
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(41,24): actor is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(45,19): actor is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(47,19): referencealias is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(49,19): actor is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(51,23): globalvariable is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(59,41): referencealias is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(59,55): cannot cast a none to a actor, types are incompatible
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(59,11): unknown type actor
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(61,19): actor is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(63,5): SetObjectiveDisplayed is not a function or does not exist
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(71,41): referencealias is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(71,55): cannot cast a none to a actor, types are incompatible
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(71,11): unknown type actor
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(73,19): actor is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(75,5): SetObjectiveDisplayed is not a function or does not exist
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(77,19): actor is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(85,39): referencealias is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(85,59): none is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(85,68): cannot compare a none to a bool (cast missing or types unrelated)
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(89,38): message is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(93,45): message is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(97,48): message is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(101,52): message is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(105,54): message is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(109,42): message is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(113,37): message is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(117,55): referencealias is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(117,69): cannot cast a none to a actor, types are incompatible
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(117,16): unknown type actor
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(119,33): actor is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(121,33): actor is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(123,33): actor is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(125,33): actor is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(127,33): actor is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(129,28): globalvariable is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(131,70): actor is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(131,31): sethirelingrehire is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(137,37): actor is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(139,13): variable Utility is undefined
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(139,21): none is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\KS01HansonController.psc(143,27): referencealias is not a known user-defined type
No output generated for KS01HansonController, compilation failed.
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on KS01HansonController
Someone knows what's going on?
Link to comment
Share on other sites

The following compiles just fine. The issue that you had were some erroneous spaces in your script. I cleaned all those up removing the extra line breaks and replacing the 5-6 spaces with tabs, and voila. I'm sure you would of caught it, but I'd had scripting headaches before. Use Notepad++ to help you out significantly as it will give you line numbers, so if your script is having particular issues you can go find out that section faster.

Scriptname KS01HansonController extends Quest

Actor Property PlayerREF Auto
ReferenceAlias Property FollowerAlias Auto
Faction Property DismissedFollowerFaction Auto
Faction Property CurrentHireling Auto
Message Property  FollowerDismissMessage Auto
Message Property  FollowerDismissMessageWedding Auto
Message Property  FollowerDismissMessageCompanions Auto
Message Property  FollowerDismissMessageCompanionsMale Auto
Message Property  FollowerDismissMessageCompanionsFemale Auto
Message Property  FollowerDismissMessageWait Auto
SetHirelingRehire Property HirelingRehireScript Auto
GlobalVariable Property FollowerRecruited Auto
Int Property iFollowerDismiss Auto Conditional
 
Function SetFollower(ObjectReference FollowerRef)
	actor FollowerActor = FollowerRef as Actor
	FollowerActor.RemoveFromFaction(DismissedFollowerFaction)
	If FollowerActor.GetRelationshipRank(PlayerREF) <3 && FollowerActor.GetRelationshipRank(PlayerREF) >= 0
		FollowerActor.SetRelationshipRank(PlayerREF, 3)
	EndIf
	FollowerActor.SetPlayerTeammate()
	FollowerAlias.ForceRefTo(FollowerActor)
	FollowerActor.EvaluatePackage()
	FollowerRecruited.SetValue(1)
EndFunction

Function FollowerWait()
	actor FollowerActor = FollowerAlias.GetActorRef() as Actor
	FollowerActor.SetActorValue("WaitingForPlayer", 1)
	SetObjectiveDisplayed(10, abforce = true)
EndFunction

Function FollowerFollow()
	actor FollowerActor = FollowerAlias.GetActorRef() as Actor
	FollowerActor.SetActorValue("WaitingForPlayer", 0)
	SetObjectiveDisplayed(10, abdisplayed = false)
	FollowerActor.EvaluatePackage()
EndFunction

Function DismissFollower(Int iMessage = 0, Int iSayLine = 1)
If FollowerAlias && FollowerAlias.GetActorReference().IsDead() == False 
	If iMessage == 0
		FollowerDismissMessage.Show()
	ElseIf iMessage == 1
		FollowerDismissMessageWedding.Show()
	ElseIf iMessage == 2
		FollowerDismissMessageCompanions.Show()
	ElseIf iMessage == 3
		FollowerDismissMessageCompanionsMale.Show()
	ElseIf iMessage == 4
		FollowerDismissMessageCompanionsFemale.Show()
	ElseIf iMessage == 5
		FollowerDismissMessageWait.Show()
	Else
		FollowerDismissMessage.Show()
	EndIf
	actor DismissedFollowerActor = FollowerAlias.GetActorRef() as Actor
	DismissedFollowerActor.StopCombatAlarm()
	DismissedFollowerActor.AddToFaction(DismissedFollowerFaction)
	DismissedFollowerActor.SetPlayerTeammate(false)
	DismissedFollowerActor.RemoveFromFaction(CurrentHireling)
	DismissedFollowerActor.SetActorValue("WaitingForPlayer", 0)
	FollowerRecruited.SetValue(0)
	HirelingRehireScript.DismissHireling(DismissedFollowerActor.GetActorBase())
	If iSayLine == 1
		iFollowerDismiss = 1
		DismissedFollowerActor.EvaluatePackage()
		Utility.Wait(2)
	EndIf
	FollowerAlias.Clear()
	iFollowerDismiss = 0
EndIf
EndFunction

Fra en Hanson til en annen.

Link to comment
Share on other sites

Those compiler errors will not be resolved by fixing a few spacing issues. The compiler cannot locate the script(s) containing the various events and functions in use. To resolve this make sure that your scripts.zip / scripts.rar file found in the Data folder is extracted. The SSE CK should have asked to do that when you first started it up. But it is always possible that the files were removed since then.

 

When extracting the scripts.zip / scripts.rar file, choose to extract in the current location as the archive contains all necessary folders for the default setup.

Link to comment
Share on other sites

Those compiler errors will not be resolved by fixing a few spacing issues. The compiler cannot locate the script(s) containing the various events and functions in use. To resolve this make sure that your scripts.zip / scripts.rar file found in the Data folder is extracted. The SSE CK should have asked to do that when you first started it up. But it is always possible that the files were removed since then.

 

When extracting the scripts.zip / scripts.rar file, choose to extract in the current location as the archive contains all necessary folders for the default setup.

I reinstalled CK because I noticed that indeed the files were removed. Now everything works fine! Thanks a lot!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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