Trying to set a quest variable from a magic effect

Post » Thu Jun 21, 2012 3:08 pm

Ok so I'm trying to set a quest variable called Sleepnvde, from my magic effect. It calls a menu which I am trying to configure sleep options for my see you sleep mod. For those who don't want to read all the code below, The command I am using is:
UpdateSeeYouSleepQuest.Sleepnvde = 0
UpdateSeeYouSleepQuest is the name of my quest, Sleepnvde is the name of my variable. Is there a problem using a magic effect for this?


Scriptname SeeYouSleepMenuEffectScript extends activemagiceffect  UpdateSeeYouSleepQuestScript Property UpdateSeeYouSleepQuest AutoMessage Property SeeYouSleepMenu AutoEvent OnEffectStart (Actor akTarget, Actor akCaster)	SeeYouSleepMenuFunction()EndEventFunction SeeYouSleepMenuFunction(Bool abMenu = True, Int aiButton = 0)	While abMenu		If (aiButton != -1) ; Wait for input			aiButton = SeeYouSleepMenu.Show() ; Main Menu			abMenu = False ; End the function			If (aiButton == 0) ; Sleep Wear Options			debug.notification("Player set to sleep nvde")			UpdateSeeYouSleepQuest.Sleepnvde = 1			;endif				;aiButton = SleepWearOptions.Show()				;If (aiButton == 0) ; Default. Nothing Changes.					UpdateSeeYouSleepQuest.Sleepnvde = 0				;ElseIf (aiButton == 1) ; Sleep in the nvde.					;UpdateSeeYouSleepQuest.Sleepnvde = 1				;ElseIf (aiButton == 2) ; Take off helmet and weapons.					;UpdateSeeYouSleepQuest.Sleepnvde = 3				;ElseIf (aiButton == 3) ; Wear Special Outfit.				;EndIf			ElseIf (aiButton == 1) ; Followers Sleep Undressed?							debug.notification("Button 2 pressed")				;aiButton = LunchMESG.Show()				;If (aiButton == 0) ;  Glazed Turkey Sandwich				;ElseIf (aiButton == 1) ; Grilled Ham Sandwich				;ElseIf (aiButton == 2) ; Shredded Pony Sandwich				;EndIf			ElseIf (aiButton == 2) ; How long to lay in bed before getting up?							debug.notification("Button 3 pressed")				;aiButton = DinnerMESG.Show()				;If (aiButton == 0) ; Filet Mignon				;ElseIf (aiButton == 1) ; Pony Fajitas				;ElseIf (aiButton == 2) ; Lobster				;EndIf					ElseIf (aiButton == 3) ; Exit					debug.notification("Button 4 pressed")				;aiButton = DinnerMESG.Show()				;If (aiButton == 0) ; Filet Mignon				;ElseIf (aiButton == 1) ; Pony Fajitas				;ElseIf (aiButton == 2) ; Lobster				;EndIf			EndIf		EndIf	EndWhileEndFunction
WHen I click the button, I see my debug notification just fine, yet my debug text in my quest, keeps reporting the value of Sleepnvde at 0.

Here is the script on my Quest:
Scriptname UpdateSeeYouSleepQuestScript  extends Quest ConditionalQuest Property SeeYouSleepQuest AutoInt Property Sleepnvde Auto ConditionalInt Property DoOnce AutoSpell Property SeeYouSleepMenuSpell AutoEvent OnInit()	RegisterForSingleUpdate(5)EndEventEvent OnUpdate()	Debug.Notification("Sleepnvde variable is " +Sleepnvde)	SeeYouSleepQuest.Stop()	SeeYouSleepQuest.Start()	RegisterForSingleUpdate(5)	If DoOnce == 0		Game.GetPlayer().AddSpell(SeeYouSleepMenuSpell)		DoOnce = 1	EndifEndEvent
User avatar
Joie Perez
 
Posts: 3410
Joined: Fri Sep 15, 2006 3:25 pm

Post » Thu Jun 21, 2012 7:16 am

I don't know if this is the 'right' way (probably not...) but what I've been doing is this:

I have a quest script with a bunch of variables, some update-y stuff, and a bunch of functions.
My magic effect script calls one of the functions on the quest script, and the function does all the variable updating from inside the quest script.
User avatar
Ana
 
Posts: 3445
Joined: Sat Jul 01, 2006 4:29 am

Post » Thu Jun 21, 2012 11:01 am

You forgot to put a ; before
UpdateSeeYouSleepQuest.Sleepnvde = 0


Immediately after it is set to 1, your script sets it to 0 again.

				UpdateSeeYouSleepQuest.Sleepnvde = 1						;endif								;aiButton = SleepWearOptions.Show()								;If (aiButton == 0) ; Default. Nothing Changes.RIGHT HERE you forgot a ; -------->>					    UpdateSeeYouSleepQuest.Sleepnvde = 0								;ElseIf (aiButton == 1) ; Sleep in the nvde.										;UpdateSeeYouSleepQuest.Sleepnvde = 1								;ElseIf (aiButton == 2) ; Take off helmet and weapons.										;UpdateSeeYouSleepQuest.Sleepnvde = 3								;ElseIf (aiButton == 3) ; Wear Special Outfit.								;EndIf
User avatar
Vahpie
 
Posts: 3447
Joined: Sat Aug 26, 2006 5:07 pm

Post » Thu Jun 21, 2012 8:50 pm

You forgot to put a ; before
UpdateSeeYouSleepQuest.Sleepnvde = 0


Immediately after it is set to 1, your script sets it to 0 again.

				UpdateSeeYouSleepQuest.Sleepnvde = 1						;endif								;aiButton = SleepWearOptions.Show()								;If (aiButton == 0) ; Default. Nothing Changes.RIGHT HERE you forgot a ; -------->>						UpdateSeeYouSleepQuest.Sleepnvde = 0								;ElseIf (aiButton == 1) ; Sleep in the nvde.										;UpdateSeeYouSleepQuest.Sleepnvde = 1								;ElseIf (aiButton == 2) ; Take off helmet and weapons.										;UpdateSeeYouSleepQuest.Sleepnvde = 3								;ElseIf (aiButton == 3) ; Wear Special Outfit.								;EndIf

Oh I feel so stupid now! lol. Thanks... I hadn't completed the menu script yet so it was processing the restore to default command! I'm like wow I've double checked my properties and done this 1000 times, what the heck is wrong? Thanks again!!
User avatar
Ashley Hill
 
Posts: 3516
Joined: Tue Jul 04, 2006 5:27 am


Return to V - Skyrim