Help dissecting and using a timer script

Post » Thu Jun 21, 2012 3:39 am

Basically what I'm trying to do is set up various objects to be enabled or disabled at certain times in my mod. I've found a basic script that I believe does exactly what I need to do, but would like a little help in picking it apart and also help in controlling the number of days it takes to enable or disable references.

Here's the vanilla script in its entirety:

Spoiler
scriptName dunPostHelgenEnableScript extends ObjectReferencefloat property myDaysPassed autoGlobalVariable property gGameDaysPassed autoLocation property myLocation autoObjectReference property myBridgeDebris autoObjectReference property myBridge autoObjectReference myLink;****************************Event onLoad()	myLink = getLinkedRef() as ObjectReference	if (myDaysPassed <= gGameDaysPassed.getValue()) && (game.getPlayer().IsInLocation(myLocation) == false)		myLink.enable()		myBridge.disable()		myBridgeDebris.disable()		disable()	endifendEvent;****************************

This script is attached to a marker located way up in the air in Whiterun, and it is linked to another marker way up in the air in the Helgen Exterior cell. The marker in Helgen has a number of other references attached to it that are enabled or disabled when the marker itself is enabled.

I understand almost everything in this script except for the “if (myDaysPassed <= gGameDaysPassed.getValue()) && (game.getPlayer().IsInLocation(myLocation) == false)” part.

I'm wondering about the getValue() and the IsInLocarion(myLocation)==false bits.

If I changed getValue() to getValue(4) would that make it so that 4 game days would have to pass before the objects you linked to would enable or disable? This is what I need to control – the number of days after a quest stage is set (or perhaps other events) before various objects get enabled. (This stuff clearly takes a couple of days to enable in game, but I don't see here where anything tells it how long to wait to enable the stuff.)

I'm also wondering why they set it to enable only when the player was NOT in the same location as the marker? The marker is in Whiterun, but the stuff it enables is in and around Helgen. So in order for the marker to load, the player HAS to enter Whiterun, but isin't the code saying the player cannot be in Whiterun by the ==false part? (Or am I not understanding that bit correctly?)

Or by using myLink = getLinkedRef() as ObjectReference it's checking that that player is NOT in the cell where the LINKED reference is (Helgen, NOT the marker itself in Whiterun), so that the stuff will enable while the player is not near Helgen?

Also, I don't know if this will help or not, but with the GECK I used the following script attached to a quest that was not set to run when the game started. I could then trigger my quest to start by various dialog, other quest stages or whatever, and it worked flawlessly. I'm needing to do the same thing with Papyrus/Skyrim.

Spoiler
scn BalokTimerQuestSCRIPTshort DoOncefloat MyTimerBegin GameMode		If DoOnce == 0				Set DoOnce to 1				Set MyTimer to GameDaysPassed		EndIf		If GameDaysPassed >= (MyTimer + 1) && DoOnce == 1				Set DoOnce to 2				;do all my cool stuff here				 stopquest BalokTimerQuest		EndIfEnd

Thanks!
User avatar
Matthew Warren
 
Posts: 3463
Joined: Fri Oct 19, 2007 11:37 pm

Post » Thu Jun 21, 2012 3:20 am

http://www.creationkit.com/GetValue_-_GlobalVariable is just a function to get the value of a global variable. It doesn't take any parameters, and trying to use GetValue(4) would only make the compiler throw out an error.

The "IsInLocarion(myLocation)==false" does seem weird if myLocation == WhiterunLocation. But is it really referring to that, or is it referring to the location around Helgen? I think it's the latter, but I haven't checked the property values so I don't know.

Anyway, if you really want to use this script, you would need to do some things in your quest result script. First, add a property to your quest result script (eg ObjectReference Property MyMarker Auto) and a property for the GameDaysPassed global variable (eg GlobalVariable Property GameDaysPassed Auto).

Then in the quest stage fragment, you need to use this:

(MyMarker as dunPostHelgenEnableScript).myDaysPassed = GameDaysPassed.Value + 4.0
User avatar
Elina
 
Posts: 3411
Joined: Wed Jun 21, 2006 10:09 pm

Post » Thu Jun 21, 2012 12:26 pm

http://www.creationkit.com/GetValue_-_GlobalVariable is just a function to get the value of a global variable. It doesn't take any parameters, and trying to use GetValue(4) would only make the compiler throw out an error.

Yeah, that's what I figured, but I'm such a novice scripter I don't assume anything until I ask, lol.

The "IsInLocarion(myLocation)==false" does seem weird if myLocation == WhiterunLocation. But is it really referring to that, or is it referring to the location around Helgen? I think it's the latter, but I haven't checked the property values so I don't know.

Yeah, it's referring to "MyLink" which is the marker in Helgen. I tested this in game several different ways, and entering Whiterun is the only way to trigger this script, but the stuff will NOT enable unless the player is away from Helgen. Presumably, this is so a bunch of statics and bandits don't just pop in right in front of the player. (This script enabled the "PostHelgenEncounters" stuff.)


Anyway, if you really want to use this script, you would need to do some things in your quest result script. First, add a property to your quest result script (eg ObjectReference Property MyMarker Auto) and a property for the GameDaysPassed global variable (eg GlobalVariable Property GameDaysPassed Auto). Then in the quest stage fragment, you need to use this:
(MyMarker as dunPostHelgenEnableScript).myDaysPassed = GameDaysPassed.Value + 4.0

I'm definitely not married to this particular script. I will need to do this same setup over and over and over as there will be a ton of stuff that gets enabled and disabled, all set up on timers to simulate the clean up and reconstruction of Helgen. So if there is a simpler way to do it, I'm all ears, and would love to see other suggestions. I just picked that script because I'm such a novice, I have to sort of find something doing something similar to what I want to do, pick it apart, and try to adapt it to my scenario. Sort of monkey see, monkey do if you know what I mean? LOL!

Thanks for the help.

BTW, as I posted earlier, I did this same thing over and over in GECK by setting up quests with a timer script on them, started the quest when I wanted to start the timer, and when the timer hit the right time, enabled my stuff and killed the quest. If possible, I would like to do it the same way, but with all this new stuff I don't know if it works like that anymore.
User avatar
Maya Maya
 
Posts: 3511
Joined: Wed Jul 05, 2006 7:35 pm

Post » Thu Jun 21, 2012 3:27 am

Sounds like you might need something more like this if you plan on having multiple "construction" stages:

Scriptname EnableDisableOnQuestStage extends ObjectReferenceQuest Property MyQuest Auto{The quest controlling the enable/disable.}Int Property MinStage Auto{The minimum stage of the quest that enables the object.}Int Property MaxStage Auto{The maximum stage of the quest that enables the object.}Event OnLoad()    if (IsDisabled())        if (MyQuest.GetStage() >= MinStage && MyQuest.GetStage() <= MaxStage)            Enable()        endif    elseif (MyQuest.GetStage() < MinStage || MyQuest.GetStage() > MaxStage)        Disable()    endifEndEvent
User avatar
Nadia Nad
 
Posts: 3391
Joined: Thu Aug 31, 2006 3:17 pm

Post » Thu Jun 21, 2012 12:14 am

Sounds like you might need something more like this if you plan on having multiple "construction" stages...

Thanks again for the help, it's really appreciated. However, I don't think I need anything that complex do I? I was planning on using either a dialog fragment or stage fragment to start the quest for the timer. All the timers will be their own little quests that I can start and stop when needed. See if this is headed in the right direction. If so, I just need the line of code for the actual timer to check if 3 days have passed since the timer quest started, and what I need to use to kill the timer quest after the enable marker has been enabled. it should be pretty simple, and I've done it a dozen times with the GECK, I just dont know how to do it with this new stuff.

Scriptname QF_BalokTimer01 Extends Quest HiddenObjectReference property myEnableMarker01 autoGlobalVariable property gGameDaysPassed auto ;I assume I'll need this and the float for the timer below?float property myDaysPassed autoEvent OnInit()if ;3 days have passed since this quest started then do everything below, this is what I dont know how to domyEnableMarker01.enableBalokTimer01.Stop() ;not sure if this is right for stopping the timer quest but I found it on the wikiendifEndEvent
User avatar
!beef
 
Posts: 3497
Joined: Wed Aug 16, 2006 4:41 pm

Post » Wed Jun 20, 2012 11:56 pm

Well, you don't need a quest to constantly keep track of what time it is. Like I said earlier, if you want to do this type of script, then all you have to do is set the myDaysPassed variable from your quest fragment script.
User avatar
Lizs
 
Posts: 3497
Joined: Mon Jul 17, 2006 11:45 pm

Post » Thu Jun 21, 2012 6:41 am

Well, you don't need a quest to constantly keep track of what time it is. Like I said earlier, if you want to do this type of script, then all you have to do is set the myDaysPassed variable from your quest fragment script.

I hate to be so ignorant, and I seem to be more confused now but let me see if I follow you.

1) I need to set an object reference property in my main quest script for my Xmarker and a global variable property for GameDaysPassed, right?

2) (MyMarker as dunPostHelgenEnableScript).myDaysPassed = GameDaysPassed.Value + 4.0 Put this in my result script fragment of the stage I want to start the timer?

What is the "dunPostHelgenEnableScript" in there for? Am I actually using that script to run the timer or something? If so, I guess I don't understand how that will work as that script controls an object that gets disabled in the script. And where in there is my xmarker getting enabled. I'll also need to disable it later on when another set of objects gets enabled.
User avatar
Lifee Mccaslin
 
Posts: 3369
Joined: Fri Jun 01, 2007 1:03 am

Post » Wed Jun 20, 2012 11:31 pm

You substitute in the name of the script you have on your Xmarker. For example, if you have this script on your Xmarker:

Scriptname TimedEnableScript extends ObjectReferenceGlobalVariable Property GameDaysPassed AutoInt Property EnableDay AutoEvent OnLoad()    if (EnableDay < GameDaysPassed.Value)        Enable()        GoToState("DoNothing")    endifEndEventState DoNothingEndState

You would use "(MyMarker as TimedEnableScript).EnableDay = GameDaysPassed.Value + 4.0".
User avatar
Jesus Duran
 
Posts: 3444
Joined: Wed Aug 15, 2007 12:16 am

Post » Wed Jun 20, 2012 10:13 pm

OK, so I started myself a new plugin to figure this out. I did exactly as you said, and I'm getting this error on the Papyrus Fragment for my stage 10 when I try to add the code you posted: "(BalokTestMarker as TimedEnableScript).EnableDay = GameDaysPassed.Value + 4.0"

Starting 1 compile threads for 1 files...Compiling "Balo_QF_BalokTimerTest_010012C9"...c:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Balo_QF_BalokTimerTest_010012C9.psc(14,36): required (...)+ loop did not match anything at input ')'No output generated for Balo_QF_BalokTimerTest_010012C9, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on Balo_QF_BalokTimerTest_010012C9

All I did was make a new cell with an NPC that I talk to and his dialog sets the stage to stage 10 like he should because I used a debug.notification to test it before I tried adding the timer bit. I set up my xmarker and a lamp attached to it via enable parent and the xmarker is initially disabled, and that works as well.

Here's the script on my xmarker:

Scriptname TimedEnableScript extends ObjectReferenceGlobalVariable Property GameDaysPassed AutoInt Property EnableDay AutoEvent OnLoad()	if (EnableDay < GameDaysPassed.Value)		Enable()		GoToState("DoNothing")	endifEndEventState DoNothingEndState

What am I missing?

Oh, here's the script on my quest:

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment;NEXT FRAGMENT INDEX 3Scriptname Balo_QF_BalokTimerTest_010012C9 Extends Quest Hidden;BEGIN ALIAS PROPERTY BalokTestMarker;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_BalokTestMarker Auto;END ALIAS PROPERTY;BEGIN FRAGMENT Fragment_0Function Fragment_0();BEGIN CODEDebug.Notification("Set Stage to 10");END CODEEndFunction;END FRAGMENT;END FRAGMENT CODE - Do not edit anything between this and the begin commentObjectReference Property BalokTestMarker  Auto  GlobalVariable Property GameDaysPassed  Auto
User avatar
Gemma Flanagan
 
Posts: 3432
Joined: Sun Aug 13, 2006 6:34 pm

Post » Thu Jun 21, 2012 4:29 am

Oops, try changing this

Int Property EnableDay Auto

to

Float Property EnableDay Auto
User avatar
Paula Ramos
 
Posts: 3384
Joined: Sun Jul 16, 2006 5:43 am

Post » Thu Jun 21, 2012 5:51 am

OK, that complies now, but the xmarker doesn't seem to enable. I changed the time to 2 days, and added "Debug.Notification("Xmarker has been enabled")" to the script on my xmarker just after the enable() and before the GoToState, coc to my cell from the main menu, and set the stage when I talk to my NPC just fine. Then wait for 2 days, 3 days and 4 days and nothing happens. Will the "Event OnLoad()" run on my xmarker even if it's initially disabled?
User avatar
Jinx Sykes
 
Posts: 3501
Joined: Sat Jan 20, 2007 11:12 pm

Post » Thu Jun 21, 2012 6:45 am

You're right, I guess it won't. Use OnCellAttach instead.
User avatar
Loane
 
Posts: 3411
Joined: Wed Apr 04, 2007 6:35 am

Post » Thu Jun 21, 2012 8:27 am

Yeah, I saw that one used here and there by the devs and began wondering if that was what I was going to have to use as well. That totally svcks however, because it will force me have to railroad the player to a specific cell to get that marker to load and actually start the timer. If this is the only way to do what I’m trying to do I will have to decide if it’s worth it to force the player into a railroaded linear path, or just enable stuff without a timer. Neither option is really acceptable to me though and BOTH are terribly immersion breaking. TBH, I’m kind of pissed and a little discouraged right now.

If anyone has any other suggestions or ideas on how I can do what I want to do in a better manner (like it used to be before this Papyrus stuff) PLEASE help a brother out!
User avatar
Mario Alcantar
 
Posts: 3416
Joined: Sat Aug 18, 2007 8:26 am

Post » Thu Jun 21, 2012 12:15 pm

You don't have to be in the actual cell for OnCellAttach to fire. It'll occur whenever the cell gets loaded. I'm not sure when exactly a cell gets loaded, but I know it depends on your ini settings for uGridsToLoad and the cell buffers.

Anyway, why would you need to force the player to go to a specific cell? You can just put the Xmarker in the cell with all the stuff you're enabling/disabling.
User avatar
FLYBOYLEAK
 
Posts: 3440
Joined: Tue Oct 30, 2007 6:41 am

Post » Wed Jun 20, 2012 10:47 pm

For the most part, I think many of my quest stages will get advanced forward and/or update through dialog with my 2 main characters while in Helgen Keep. Most of the objects and xmarkers will obviously be in and around the Helgen Exterior cells as that’s what I’m rebuilding. (could be as many as 4 or 5 different cells) And there will be a LOT of stuff enabling and disabling as the settlement gets rebuilt and expanded.

However, there are 2 ways a player could leave the Keep. First through the doors into the courtyard area, OR down through the cave that you escape in the opening of the game. Those are 2 different exterior cells, and there is no way I can be sure which way they leave the Keep unless I force them through one or the other ways out of the Keep.

I suppose it’s possible to somehow script in a check that looks to be sure the markers are enabled that I need to be enabled before the next ones are able to enable, but that only makes things more confusing on my end. I’m already a novice at best with scripting, but the more I have to cram in what used to be a very simple script the more margin I have for error. But without some sort of assurance that these things get enabled and disabled in the exact sequence they need to be in, could cause some really stupid looking stuff to take place in my mod.
User avatar
Leilene Nessel
 
Posts: 3428
Joined: Sun Apr 15, 2007 2:11 am

Post » Thu Jun 21, 2012 12:56 am

Unless I'm totally screwing something up, or I've completely missed something I don't think this is going to work like we've been working on. The problem is that I'm using "(BalokTestMarker as TimedEnableScript).EnableDay = GameDaysPassed.Value + 4.0" on "BalokTestMarker" that's set to initially disabled, and the script TimedEnableScript attached to BalokTestMarker that's initially disabled is not running until the object gets enabled, therefore the timer is not working. That's the best explanation I can figure out so far, and why OnLoad and OnCellAttach neither one worked.

Since all my other stuff is set up to enable off of BalokTestMarker ONLY after the timer runs, enabling it to allow the timer to run likewise enables my other stuff, thereby making the timer useless. I've got to figure out a way to run the timer that does not use a script attached to to the enabling marker. That's why I mentioned doing it like I did in New Vegas by starting a separate quest that ran the timer, and enabled the marker when it ran out.

I've greatly appreciated your help so far, but do you or anyone else have any other suggestions? What I'm doing ain't working, and if I can't figure out how to make something work this project might be dead.
User avatar
Baylea Isaacs
 
Posts: 3436
Joined: Mon Dec 25, 2006 11:58 am

Post » Thu Jun 21, 2012 11:58 am

I don't think that's the problem. You can test it by having your Xmarker initially enabled, with all the objects that have the Xmarker as an enable parent set to have their enable state opposite of their parent, and then script the Xmarker to disable itself.
User avatar
Charlotte Buckley
 
Posts: 3532
Joined: Fri Oct 27, 2006 11:29 am

Post » Thu Jun 21, 2012 8:37 am

Since all my other stuff is set up to enable off of BalokTestMarker ONLY after the timer runs, enabling it to allow the timer to run likewise enables my other stuff, thereby making the timer useless. I've got to figure out a way to run the timer that does not use a script attached to to the enabling marker. That's why I mentioned doing it like I did in New Vegas by starting a separate quest that ran the timer, and enabled the marker when it ran out.

I've greatly appreciated your help so far, but do you or anyone else have any other suggestions? What I'm doing ain't working, and if I can't figure out how to make something work this project might be dead.

If you want a different approach, can you just use RegisterForSingleUpdateGameTime(96) -- you could attach that to a quest script, and then in the OnUpdateGameTime event enable the marker and stop the quest. If you also want to test that the player isn't in the same location, that would be another step, but could be accomplished in various ways.
User avatar
Donald Richards
 
Posts: 3378
Joined: Sat Jun 30, 2007 3:59 am

Post » Thu Jun 21, 2012 11:43 am

I don't think that's the problem. You can test it by having your Xmarker initially enabled, with all the objects that have the Xmarker as an enable parent set to have their enable state opposite of their parent, and then script the Xmarker to disable itself.

OK, done. I even tested the script with both OnLoad and OnCellAttach as well as the marker initially enabled and disabled and it still doesn't work. I know the enable parent on my linked object is working because I set up an alias for the xmarker and used the stage to enable the alias and that worked perfectly.

Is it in this line below, possibly the "less than"? Does it need to be >, or => or <=? Won't EnableDay always be less than my gameDaysPassed whoch is in the stage fragment? I'm grasping for straws here. I can also post screenies if you wish.

if (EnableDay < GameDaysPassed.Value)
User avatar
sally R
 
Posts: 3503
Joined: Mon Sep 25, 2006 10:34 pm

Post » Wed Jun 20, 2012 9:08 pm

If you want a different approach, can you just use RegisterForSingleUpdateGameTime(96) -- you could attach that to a quest script, and then in the OnUpdateGameTime event enable the marker and stop the quest. If you also want to test that the player isn't in the same location, that would be another step, but could be accomplished in various ways.

I believe this is EXACTLY how I want to do it. It's the same way I did it in New Vegas in a quest I made about 8 times. I just don't know exactly how to do it with Skyrim. In NV I just made a quest that was not enabled and had the timer script I posted in my first post attached to it. When you hit the right stage or dialog, it triggered the quest and it ran the timer, enabled my stuff and killed itself when the timer finished. I just don't know how to script it. Is it something likr this:

Scriptname BalokTimer01 extends Quest  ObjectReference property BalokTestMarker autoFunction RegisterForSingleUpdateGameTime(96)EndFunctionEvent OnUpdateGameTime()			    BalokTestMarker.enable()EndEvent
User avatar
Mark Churchman
 
Posts: 3363
Joined: Sun Aug 05, 2007 5:58 am

Post » Thu Jun 21, 2012 4:43 am

if (EnableDay < GameDaysPassed.Value)

The line makes sense. In your quest stage, you set EnableDay to GameDaysPassed + 4. That means if GameDaysPassed is 10, then EnableDay is 14. So EnableDay would only be less than GameDaysPassed after another 4.00000000000000000000000001 (or however small the increments can get) days.

Screenies might help to find the problem.

EDIT:

Yes, that's exactly how you use RegisterForUpdateGameTime. But you're going to have to create a new quest for every marker you're going to enable/disable.
User avatar
Tinkerbells
 
Posts: 3432
Joined: Sat Jun 24, 2006 10:22 pm

Post » Wed Jun 20, 2012 9:37 pm

Yes, that's exactly how you use RegisterForUpdateGameTime. But you're going to have to create a new quest for every marker you're going to enable/disable.

No problem creating the quests. I put that script in last night just before I went to bed, but unfortunately it wouldn't compile. It had some kind of an error on the 96 and said something was missing. I don't remember exactly what, and I was so tired by then I just needed to go to bed, lol. I'm at the office right now, but when I get home tonight I'll pull it back up and try it again.

I think the other thing I’ll need to know is regarding starting each quest when I need to . The old way was simply “StartQuest BalokTimer01” where BalokTimer01 is the ID of my quest. But it looks like StartQuest is different now. According to the wiki, it gives the example of “MainQuestProperty.Start()”, so would that just be “BalokTimer01.Start()” in my stage fragment? (I’m not exactly sure what “MainQuestProperty” means, and there are no real explanations of this on the wiki. Also, I can set a stage in my quest script after the timer runs with stop() to kill the quest can’t I?
User avatar
Mike Plumley
 
Posts: 3392
Joined: Wed Sep 05, 2007 10:45 pm

Post » Wed Jun 20, 2012 9:15 pm

No problem creating the quests. I put that script in last night just before I went to bed, but unfortunately it wouldn't compile.

Basically you can't create a function named "RegisterForSingleUpdateGameTime" because there is already a function with that name. You'd have to do something like:

Scriptname BalokTimer01 extends QuestObjectReference property BalokTestMarker autoEvent OnInit()    If IsRunning()        RegisterForSingleUpdateGameTime(96)    EndIfEndEventEvent OnUpdateGameTime()    BalokTestMarker.enable()    Stop()EndEvent

Edit: made a tweak to simplify the original script I had posted.

In practice, it might also be good to make the 96 a script property, to make the script more reusable.

If you want to be sure the marker is only enabled when the player is outside of the location, it gets a little more complicated. You'd want to have a reference alias in the quest, allow reserved and optional, and unfilled by default. Add a a script to that alias that tracks the OnLocationChange event and enables the marker and shuts down the quest when the new location isn't the one you care about (Helgen, right?). Then in the OnUpdateGameTime event above, you wouldn't enable the marker; instead you'd force the player into the reference alias with the http://www.creationkit.com/ForceRefTo_-_ReferenceAlias function. The net effect of this would be to say, "after four days pass, start tracking the player's movement; the first time the player changes their location to something other than Helgen, enable the marker."

I think the other thing I’ll need to know is regarding starting each quest when I need to . The old way was simply “StartQuest BalokTimer01” where BalokTimer01 is the ID of my quest. But it looks like StartQuest is different now. According to the wiki, it gives the example of “MainQuestProperty.Start()”, so would that just be “BalokTimer01.Start()” in my stage fragment? (I’m not exactly sure what “MainQuestProperty” means, and there are no real explanations of this on the wiki.

Try http://www.creationkit.com/Bethesda_Tutorial_Papyrus_Introduction_to_Properties_and_Functions at the wiki. Cipscis also made a good post on the subject http://www.gamesas.com/topic/1345130-having-papyrus-trouble-here-are-some-things-to-try/page__view__findpost__p__20277117.
User avatar
Tania Bunic
 
Posts: 3392
Joined: Sun Jun 18, 2006 9:26 am

Post » Thu Jun 21, 2012 12:06 pm

I'm going to do my best Anakin Skywalker impersonation, "It's WORKING, it's WORKING!!!" ( http://www.youtube.com/watch?v=AXwGVXD7qEQ ) :banana:

Well, the first method you posted is working. But I'm going to try to have a go at the second method with the ForceRefTo and OnLocationChange, and I'll try not to make this too painful if I can help it. (Just getting the first one to work is a huge step in the right direction! Thank you for that. Where would you like the hokers and blow to be delivered??!!)

One question though on making the 96 a script property. What type would that be?

Second - On to your 2nd method - OK, so I've created the Alias like you said. I checked allow reserved and optional and didn't add anything else. (Is that what you mean by unfilled I think?)

I added this script to the alias
Scriptname NotInHelgenAliasScript extends ReferenceAliasEvent OnLocationChange(Location akOldLoc, Location akNewLoc)	if (Game.GetPlayer().GetCurrentLocation() == akOldLoc)	BalokTestMarker.enable()	Debug.Notification("Marker should be enabled now")	BalokTimer01Quest.Stop()  endIfendEventQuest Property BalokTimer01Quest  Auto  ObjectReference Property BalokTestMarker  Auto

Looking at the OnLocationChange page on the wiki I wrote that based on what's on that page below. I don't have a clue if that's correct or not but at least it compiles, lol.

Event OnLocationChange(Location akOldLoc, Location akNewLoc)  if (Game.GetPlayer().GetCurrentLocation() == akOldLoc)	Debug.Trace("We have left the player's location!")  endIfendEvent

Now, this is where my brain starts to get a little fuzzy with all this stuff, lol. But do I need to change the "(Location akOldLoc, Location akNewLoc)" to anything or will this somehow keep track of where the player is? (Sorry if that's a totally stupid question, but I'm really trying to learn here.)


Next, on to my quest script, that I'm having more difficulty with. I basically can't get it to compile, so I'm definitely not writing it correctly. I think it's the ForceRefTo bit. I don't know what goes in the () after ForceToRef. I tried "self" and "player" and neither compile, The wiki page don't tell me much I'm afraid, but here's what I have. (don't laugh..., wait, I don't blame you for laughing if you do, lol! But hey, at least my properties are filled correctly!)

Scriptname BalokTimer01 extends QuestObjectReference property BalokTestMarker autoEvent OnInit()	If IsRunning()		RegisterForSingleUpdateGameTime(24)		Debug.Notification("Timer quest is running")	EndIfEndEventEvent OnUpdateGameTime()	Alias_NotInHelgen.ForceRefTo(Player)EndEventAlias Property NotInHelgen  Auto


Here's the error, although you will probably be able to look at it and see what I did wrong.

Starting 1 compile threads for 1 files...Compiling "BalokTimer01"...c:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\BalokTimer01.psc(15,4): variable Alias_NotInHelgen is undefinedc:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\BalokTimer01.psc(15,33): variable Player is undefinedc:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\BalokTimer01.psc(15,22): none is not a known user-defined typeNo output generated for BalokTimer01, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on BalokTimer01

I don't know why the hell it says Alias is undefined though. I go into properties and it shows filled with the correct quest and alias.
Thanks again for the help!
User avatar
Nadia Nad
 
Posts: 3391
Joined: Thu Aug 31, 2006 3:17 pm

Post » Thu Jun 21, 2012 5:18 am

Unlike some of the folks here I'm not good enough that my scripts will always work "blind," so these may need some tweaking, but try these. This one on the quest:

Scriptname BalokTimerScript extends QuestReferenceAlias property NotInHelgen autoFloat property DelayHours autoEvent OnInit()	If IsRunning()		RegisterForSingleUpdateGameTime(DelayHours)	EndIfEndEventEvent OnUpdateGameTime()	NotInHelgen.ForceRefTo(Game.GetPlayer())EndEvent

And this one on the reference alias:

Scriptname NotInHelgenAliasScript extends ReferenceAliasLocation Property HelgenLocation AutoQuest Property BalokQuestToStop  AutoObjectReference Property BalokMarkerToEnable  AutoEvent OnLocationChange(Location akOldLoc, Location akNewLoc)	if akNewLoc != HelgenLocation		BalokMarkerToEnable.enable()		Debug.Notification("Marker should be enabled now")		BalokQuestToStop.Stop()	endIfendEvent

I took the liberty of making some of your property names a little more generic--because if you're going to have a bunch of quests doing something like this, you can reuse both of these scripts, just changing the properties each time. But of course you can keep the names as you had them if you like.

The problem with "Alias" was that it needs to be "ReferenceAlias" to work in this situation.

Because you're forcing the player into the alias in the OnUpdateGameTime block, you don't need to worry about testing whether the actor is the player in the reference alias script. All you need to worry about is checking that their new location isn't Helgen, so that's what my "if" line does.

Anyway, see if that all works... (fingers crossed)
User avatar
Pat RiMsey
 
Posts: 3306
Joined: Fri Oct 19, 2007 1:22 am

Next

Return to V - Skyrim