Jump to content

[LE] Help with some basic scripting


Recommended Posts

Could I have some help with a little script I wrote? I added the script to the quest. Here's the quest:

 

Scriptname BSEDreamStart extends Quest
Quest Property MainQuestE Auto
Event OnInit()
RegisterForSleep()
EndEvent
Event OnSleepStop(bool abInterrupted)
Debug.MessageBox("I have had a disturbing dream: there were grasslands and dusty steppes beneath the Moons and I heard a Khajiit woman crying. I cannot shake a sensation of doom and fear. Maybe I should talk to someone about it.")
MainQuestE.SetObjectiveDisplayed(10)
MainQuestE.SetStage(10)
EndEvent
The message box triggers, yet the quest doesn't want to change its stage or display a new stage. Do any of you know why this could be?
Link to comment
Share on other sites

  On 12/1/2018 at 3:49 AM, Johny5134234 said:

 

Could I have some help with a little script I wrote? I added the script to the quest. Here's the quest:

 

Scriptname BSEDreamStart extends Quest
Quest Property MainQuestE Auto
Event OnInit()
RegisterForSleep()
EndEvent
Event OnSleepStop(bool abInterrupted)
Debug.MessageBox("I have had a disturbing dream: there were grasslands and dusty steppes beneath the Moons and I heard a Khajiit woman crying. I cannot shake a sensation of doom and fear. Maybe I should talk to someone about it.")
MainQuestE.SetObjectiveDisplayed(10)
MainQuestE.SetStage(10)
EndEvent
The message box triggers, yet the quest doesn't want to change its stage or display a new stage. Do any of you know why this could be?

 

 

Check your aliases, make sure they're all filled. Console command 'sqv'.

Link to comment
Share on other sites

Difficult to know the context that you have placed this script in as you talk about it not starting a quest when the stage 10 is set, if this is the case the problem could be with what is being done at stage 10 (is it starting another quest?).

 

I would generally run sleep scripts on the player alias, testing for stage already at and then set to a stage. I would also place the message and set objective as a quest fragment in the stage that was set. This makes it much easier to see what's happening in quest stages and the script is generic so it can be used again.

 

eg in your sleep event:

 

If GetOwningQuest().GetStage() == StageToTest
GetOwningQuest().SetStage(StageToSet)

EndIff

Link to comment
Share on other sites

probably an issue with understanding:

   self.SetObjectiveDisplayed(10)
   self.setStage(10)

sleep is located in form.psc

; Registers this form to receive events when the player sleeps and wakes up
Function RegisterForSleep() native

; Unregisters this form to receive events when the player sleeps and wakes up
Function UnregisterForSleep() native

; Received when the player sleeps. Start and desired end time are in game time days (after registering)
Event OnSleepStart(float afSleepStartTime, float afDesiredSleepEndTime)
EndEvent

; Received when the player stops sleeping - whether naturally or interrupted (after registering)
Event OnSleepStop(bool abInterrupted)
EndEvent

vanilla refalias sample:

  Reveal hidden contents


vanilla quest sample: two scripts attached to same quest, here does not exist a call of UnregisterForSleep()

  Reveal hidden contents

 

Edited by ReDragon2013
Link to comment
Share on other sites

  • Recently Browsing   0 members

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