Jump to content

Recommended Posts

Posted (edited)
Hello. I am working on a mod that adds the chance for a player to have a dream or nightmare after they sleep. For now, the mod will simply display a message after the player sleeps describing the dream. However, I am planning on adding lingering effects based on the specific dreams in the future. So, I am attempting to accomplish this through a scripted quest. This is what I have so far, any help would be greatly appreciated.


I created a quest that has the following properties:


Start Game Enabled

Quest Stage 0: Start Up Stage

Quest Alias: Reference Alias, Specific Reference (PlayerRef 'Player')


And, the following script:


Scriptname DD_TestDialogueQuest extends ReferenceAlias


Quest Property DD_QuestDialogue Auto


Function SomeFunction()

RegisterForSleep();

EndFunction


Event OnSleepStop(bool abInterrupted)

Debug.MessageBox("This is a test dream.");

endEvent


This should display the message after a player wakes up. Currently, nothing happens. After this works, I was planning on using the following script, to display a random dream.


Scriptname DD_TestDialogueQuest extends ReferenceAlias



Quest Property DD_QuestDialogue Auto


Function SomeFunction()

RegisterForSleep();

EndFunction


Event OnSleepStop(bool abInterrupted)

int random = Utility.RandomInt(0, 13);

If(random < 5)

Debug.MessageBox("text01");

ElseIf(random < 9)

Debug.MessageBox("text02");

ElseIf(random < 11)

Debug.MessageBox("text03");

ElseIf(random == 11)

Debug.MessageBox("text04");

ElseIf(random == 12)

Debug.MessageBox("text05");

Else

Debug.MessageBox("text06");

EndIf

endEvent


Any help as to why this is not working would be appreciated.
Edited by SouthernBoar
Posted (edited)

When putting the registerforsleep in a custom function, the function needs to be called from any event in your script, or from another script. I can't see this ...

 

Replace...

Function SomeFunction()
RegisterForSleep();
EndFunction

...with...

Event OnInit()
RegisterForSleep()
EndEvent

...and see if that works. Test it with a clean save (a save you made without your mod being activated).

 

 

edit: could also be a problem with the quest not starting or the alias not filling for some reason. Did you check this?

 

Edited by Ghaunadaur
Posted

Thanks for the reply. I will test out the new script.

 

I have not checked out these other issues. I assume to check that the quest started, I should just check the quest log in game? I currently have the type of quest set to "NONE" instead of "SIDE", but I assume that shouldnt be an issue, right? How would I know if the alias is filing or not?

Posted
  On 6/11/2016 at 1:22 PM, SouthernBoar said:

Thanks for the reply. I will test out the new script.

 

I have not checked out these other issues. I assume to check that the quest started, I should just check the quest log in game? I currently have the type of quest set to "NONE" instead of "SIDE", but I assume that shouldnt be an issue, right? How would I know if the alias is filing or not?

Go in game, open the console and type sqv yourquestname and hit enter. It will let you know if the quest is running and at what stage. also using the page up key you should be able to see all your quest aliases and variables. If any of your Aliases have <NONE> after them they have not filled. Of course if your quest is not running, the aliases won't fill either.

 

If you have any dialogue, and your quest is start game enabled, make sure you generate an seq file or the dialogue may not work properly.

Posted

So, I updated the script and checked to see if the quest is running and the alias is filled; however, still nothing is happening.

 

This is the updated script:

 

Scriptname TOS_DreamMechanic extends ReferenceAlias
Quest Property TOS_SleepQuest Auto
Event OnInit()
RegisterForSleep()
EndEvent
Event OnSleepStop(bool abInterrupted)
Debug.MessageBox("This is a test dream.");
endEvent

 

This is the quest data output from the in game console:

 

sqv TOS_SleepQuest

--- Papyrus ------------------------------------

No papyrus scripts attached

- 1 Aliases for quest 'TOS_SleepQuest' (19000D62) -

REF 'Player' -> " (00000014)

--- Quest state -------------------------------

Enabled? Yes

State: Running

Current stage: 0

Priority: 0

Posted
  On 6/12/2016 at 3:56 AM, SouthernBoar said:

This is the quest data output from the in game console:

 

sqv TOS_SleepQuest

--- Papyrus ------------------------------------

No papyrus scripts attached

- 1 Aliases for quest 'TOS_SleepQuest' (19000D62) -

REF 'Player' -> " (00000014)

--- Quest state -------------------------------

Enabled? Yes

State: Running

Current stage: 0

Priority: 0

This tells me that the script is not attached to the quest. It should at least have

QF_TOS_SleepQuest_xxxxxxxx (which is the name of your quest) and should be there.

 

Try this for testing.Create a trigger box and using the DefaultSetStageTrigger, and place it somewhere on a road, say outside of Whiterun. Set the properties for the set stage trigger for your quest and stage to set as 10.

Also set the Priority of your quest to 60. Make sure you have attached your script to the Player _Alias. Also generate an seq file for your quest. The easiest way is with TES5Edit. If you don't know how,

Load your mod only in XEdit, and after it has finished loading, right click on your esp, then left click and an options window will open, all the way at the bottom, mouse over Other, and then select Generate SEQ File. If your mod needs one it will generate it and place it in your Skyrim/Data/seq folder with the name of your esp. Takes only a few seconds. Of course if you do not need one, Xedit will tell you so.

 

After passing through the trigger, use the sqv command and check again.

 

IIRC setting the stage to 0 is just like the quest not actually running even though it is a start game enabled quest.

Posted
  On 6/12/2016 at 3:27 PM, Aragorn58 said:

 

  On 6/12/2016 at 3:56 AM, SouthernBoar said:

This is the quest data output from the in game console:

 

sqv TOS_SleepQuest

--- Papyrus ------------------------------------

No papyrus scripts attached

- 1 Aliases for quest 'TOS_SleepQuest' (19000D62) -

REF 'Player' -> " (00000014)

--- Quest state -------------------------------

Enabled? Yes

State: Running

Current stage: 0

Priority: 0

This tells me that the script is not attached to the quest. It should at least have

QF_TOS_SleepQuest_xxxxxxxx (which is the name of your quest) and should be there.

 

Try this for testing.Create a trigger box and using the DefaultSetStageTrigger, and place it somewhere on a road, say outside of Whiterun. Set the properties for the set stage trigger for your quest and stage to set as 10.

Also set the Priority of your quest to 60. Make sure you have attached your script to the Player _Alias. Also generate an seq file for your quest. The easiest way is with TES5Edit. If you don't know how,

Load your mod only in XEdit, and after it has finished loading, right click on your esp, then left click and an options window will open, all the way at the bottom, mouse over Other, and then select Generate SEQ File. If your mod needs one it will generate it and place it in your Skyrim/Data/seq folder with the name of your esp. Takes only a few seconds. Of course if you do not need one, Xedit will tell you so.

 

After passing through the trigger, use the sqv command and check again.

 

IIRC setting the stage to 0 is just like the quest not actually running even though it is a start game enabled quest.

 

 

I forgot to attach the script to the ReferenceAlias. I also updated the stage and priority as you recommend to be sure, and it works. Awesome, thanks for the help.

 

This is the final quest data output from the in game console:
sqv TOS_SleepQuest
--- Papyrus ------------------------------------
No papyrus scripts attached
- 1 Aliases for quest 'TOS_SleepQuest' (19000D62) -
REF 'Player' -> " (00000014)
--- Quest state -------------------------------
Enabled? Yes
State: Running
Current stage: 10
Priority: 60
I will work on getting the random message box to appear and spell effects cast. Thanks again for the help :)
  • Recently Browsing   0 members

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