Getting a Quest Script to read Global Variables: Do I Need a

Post » Mon Jun 18, 2012 8:14 am

After about a day and a half of confusion, I've finally narrowed down the problem with my script to the Global Variables, after finding out about the debug commands. Specifically, the problem is that the get value commands are returning zeroes even when they shouldn't, which for this specific script is every single global variable involved besides "PlayerIsWerewolf" (which is returning zero even for a game in which the player is in fact a werewolf). I'm almost certain I set the properties correctly in the script and in the properties window, and the only idea I have is that the "Event OnInit()" event in the script is causing it to start up independently of the quest or something, and that I'd need a papyrus fragment to start it. Unfortunately the fragment I tried didn't compile, and I'm at a loss as to what i should do. I've copied both the script and the properties window below, in case anyone has any idea's what's wrong.

scriptname cohTransformTiming extends Quest{Controls the Timing for transformation.};calling properties, spells, globals, and importing the maths.        import Math    float property cohGetMoonPhase auto    float property cohPhaseDay auto    bool property cohCanTransform auto    bool property cohbmvar auto    bool property IsFirstChange auto    Spell property WerewolfChange auto    GlobalVariable Property GameHour auto    GlobalVariable Property GameDaysPassed auto    GlobalVariable Property PlayerIsWerewolf auto    GlobalVariable Property PlayerWerewolfShiftbacktime auto    MagicEffect Property WerewolfChangeEffect auto    ; The script should run once every in game minute in this state, otherwise the flavor texts could be desychronized.Event OnInit()RegisterForUpdate(1)EndEvent    Event OnUpdate(); Determining Moon Phase Below...Not yet implimented.    int timeOfDay = GameHour.GetValueint()    int DaysPassed = GameDaysPassed.GetValueint(); Ignore PhaseDay, not functioning in this iteration of the script.;/List of moon phases returned by cohGetMoonPhase.0 = full moon1 = 3/4 waning2 = half waning3 = 1/4 waning4 = new moon5 = 1/4 waxing6 = half waxing7 = 3/4 waxing/;;Not sure what cohPhaseDay should return, though one is an adequete placeholder.debug.Notification(TimeOfDay)    If TimeOfDay >= 20 || TimeOfDay < 6 || TimeOfDay == 0Utility.WaitGameTime ( 0.05 )    cohCanTransform == trueelse	    cohCanTransform == falseendif; Hell, it's morphing time!            if ( PlayerIsWerewolf.GetValue() == 1 && cohCanTransform == true ) && IsFirstChange == true && game.getplayer().HasMagicEffect(WerewolfChangeEffect) == 0    debug.notification("The player can transform!!!")    PlayerWerewolfShiftbacktime.SetValue(10000)    WerewolfChange.Cast(Game.GetPlayer(), Game.GetPlayer())    Utility.WaitGameTime ( 0.05 )    Debug.Notification ("Generic Flavor Text")        elseif PlayerIsWerewolf.GetValue() == 1 && cohCanTransform == true && IsFirstChange == false && game.getplayer().HasMagicEffect(WerewolfChangeEffect) == 0    PlayerWerewolfShiftbacktime.SetValue(10000)    WerewolfChange.Cast(Game.GetPlayer(), Game.GetPlayer())    Utility.WaitGameTime ( 0.05 )    Debug.MessageBox ("First Post Transform Flavor Text")    elseif PlayerIsWerewolf.GetValue() == 1 && game.getplayer().HasMagicEffect(WerewolfChangeEffect) == 1 && cohCanTransform == false    PlayerWerewolfShiftbacktime.SetValue(1)endifEndEvent

The properties window for said script is here:

[img]http://i1173.photobucket.com/albums/r593/InfinityArch/NewBitmapImage3.jpg[/img]



The first time I made a papyrus fragment, I put in a debug flag, and for whatever reason, it didn't even run, which was pretty disappointing, though the script was basically "RegisterForUpdate(1)" and the debug flags. Before you ask, the quest is start game enabled and the stage this fragment was attached to was defined as the "startup" stage. Kmyquest was also set to the correct script.

After I found out about OnInit(), which is how I got the script proper to start running,I tried to put an event in the payrus fragment that would make it run on the start of the game...(after which I would return the main script to an OnUpdate() event.

Event OnInit()RegisterForUpdate(1)debug.notification("Script Initiated")EndEvent

But it returned an error.

Starting 1 compile threads for 1 files...Compiling "QF_cohTimingQuest_01001562"...c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_cohTimingQuest_01001562.psc(12,0): mismatched input 'Event' expecting ENDFUNCTIONc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_cohTimingQuest_01001562.psc(17,0): missing EOF at 'EndFunction'No output generated for QF_cohTimingQuest_01001562, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on QF_cohTimingQuest_01001562


I'm not even sure I need the Papyrus Fragment, but I have literally no other ideas as to why the script isn't returning the global variables properly. If anyone has any insight on this problem, I'd be very grateful if you would share it.
User avatar
Roddy
 
Posts: 3564
Joined: Fri Jun 15, 2007 11:50 pm

Post » Mon Jun 18, 2012 1:11 am

hmm, and no errors then? interesting stuff
User avatar
Judy Lynch
 
Posts: 3504
Joined: Fri Oct 20, 2006 8:31 am


Return to V - Skyrim