Jump to content

[LE] Adding a script to the scripts tab in quests - script is failing to compile


sornan

Recommended Posts

Hello

 

I've been through the tutorials, and now and wanting to start creating lengthy scripts for quests, and I am really failing at the task right off the bat here.

 

I want to just add a large script to the 'Scripts' tab area in a quest, where I assume the script runs in loops consistently and does the code checks.

 

Here is the code I put into the script :

Scriptname GaladrielDream extends Quest


ObjectReference Property XMarkerDreamStart Auto
ObjectReference Property XMarkerPlayerLoc_A Auto
ObjectReference Property XMarkerGaladriel_1 Auto

Int DreamPhase1 = 0


Event OnInit()

if (Fotr_A_Weakness.GetStage() == 10)

	if (IsPCSleeping == 1 && DreamPhase1 == 0)

	Utility.Wait(1.0)

		if (IsPCSleeping == 1)

		DreamPhase1 = 1
		Fotr_A_Weakness.SetStage(20)
          	XMarkerPlayerLoc.MoveTo(PlayerRef, 10)	
          	PlayerRef.MoveTo(XMarkerDreamStart)		             
          	Game.DisablePlayerControls(true, true, true, false, true, true, true, false)		
          	Debug.Notification("Scene would be here...")		              
          	Utility.Wait(5.0)		      
          	PlayerRef.MoveTo(XMarkerPlayerLoc)                       
          	Game.EnablePlayerControls()	      
		Debug.Notification("Dream ended.")

		Endif


	Endif

Endif

EndEvent

 

And then here is the endless errors upon trying to save :

Starting 1 compile threads for 1 files...
Compiling "GaladrielDream"...
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\GaladrielDream.psc(13,4): variable Fotr_A_Weakness is undefined
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\GaladrielDream.psc(13,20): none is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\GaladrielDream.psc(13,31): cannot compare a none to a int (cast missing or types 

unrelated)
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\GaladrielDream.psc(15,5): variable IsPCSleeping is undefined
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\GaladrielDream.psc(15,18): cannot compare a none to a int (cast missing or types 

unrelated)
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\GaladrielDream.psc(19,6): variable IsPCSleeping is undefined
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\GaladrielDream.psc(19,19): cannot compare a none to a int (cast missing or types 

unrelated)
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\GaladrielDream.psc(22,2): variable Fotr_A_Weakness is undefined
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\GaladrielDream.psc(22,18): none is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\GaladrielDream.psc(23,11): variable XMarkerPlayerLoc is undefined
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\GaladrielDream.psc(23,35): variable PlayerRef is undefined
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\GaladrielDream.psc(23,28): none is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\GaladrielDream.psc(24,11): variable PlayerRef is undefined
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\GaladrielDream.psc(24,21): none is not a known user-defined type
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\GaladrielDream.psc(28,11): variable PlayerRef is undefined
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\GaladrielDream.psc(28,28): variable XMarkerPlayerLoc is undefined
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\GaladrielDream.psc(28,21): none is not a known user-defined type
No output generated for GaladrielDream, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on GaladrielDream

 

Sorry for the lengthy mess of errors there..

 

I also am surprised that the code did not create any properties automatically, like some of the code I did in the tutorials did. Here, it is just causing errors and producing nothing.

 

In the past, I have gotten into doing big scripts for Oblivion and Armed Assault 3, which covered most of the quest/mission content, and I really could use some help as to how to do this with Skyrim - as I really do not want to do coding that scatters script allover different objects and quest stage scripts.

 

I really would appreciate any help, having poured tons of hours into getting this far, seems I have ran into a wall with the scripting and really want to get things to work.

 

Thanks

 

 

 

 

 

Link to comment
Share on other sites

You haven't defined Fotr_A_Weakness as a Quest property.

You haven't defined PlayerREF as anything.

IsPCSleeping is not a valid function. Use Game.GetPlayer().GetSleepState() == 3

 

The OnInit() event only runs once, ever.

Link to comment
Share on other sites

You haven't defined Fotr_A_Weakness as a Quest property.

You haven't defined PlayerREF as anything.

IsPCSleeping is not a valid function. Use Game.GetPlayer().GetSleepState() == 3

 

The OnInit() event only runs once, ever.

 

Thanks Steve40

 

 

I appreciate the help there.

 

PlayerREF was at least something I thought it would pick up, as the quest has that Alias, but it looks like it still needs to be added, and the other quest I should have added (I saw it added to the main script and assumed it would recognize it.. nope..)

 

 

I have a question though - if I use something other an Oninit, then how do I input the code like this where it will be checked regularly as the script code loops? I had No event set before, and just tried to run the code and it caused a fault upon trying to save that seemed (through web search) to indicate there was no event set..

 

Can I assume that at least quest scripts do indeed loop, and continue to re-run? If so, I'm not sure how to get code to execute in each loop without an event being set (and events seem to be pretty limited).

Edited by sornan
Link to comment
Share on other sites

Papyrus scripts do not loop. Unlike other games where the script might be read from the top down and running the first valid thing it finds and then starting over from the top again until the next valid thing. Papyrus scripts sit there waiting for an event or function to be called. When such event or function is called then the code will execute. If you need something that loops, then register for a single update in the OnInit event, use the OnUpdate event to run your code and then register for another single update afterwards.

Link to comment
Share on other sites

Papyrus scripts do not loop. Unlike other games where the script might be read from the top down and running the first valid thing it finds and then starting over from the top again until the next valid thing. Papyrus scripts sit there waiting for an event or function to be called. When such event or function is called then the code will execute. If you need something that loops, then register for a single update in the OnInit event, use the OnUpdate event to run your code and then register for another single update afterwards.

 

Thanks IsharaMeradin

 

 

That looks about right, and the Bethesda Description of the Event provides a really simple way of doing what you just described, heck with a timer per check too!

 

Awesome.. Thanks guys! :smile:

Edited by sornan
Link to comment
Share on other sites

Finally got the script to compile, thanks to everyone's help :)

 

 

I do have a question regarding quest aliases -

 

Can I safely use the same alias name in multiple quests that are running at the same time for identical actors?

 

(Example - I'm using PlayerRef as an alias pointing to the player in two quests running at the same time.)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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