×
Меню
Индекс

MSFD Player sleeping

 
[no fix] ShowRestMenu
 
Brings up rest menu, and allows the player to sleep. This is used e.g. for beds in cells where it is otherwise illegal to sleep.
 
Sample Script: This is the standard script for beds:
begin Bed_Standard
 
;used for standard beds the player can activate and sleep in
 
if ( MenuMode == 0 )
     if ( OnActivate == 1 )
          ShowRestMenu
     endif
endif
 
end
 
 
[no fix] GetPCSleep          (returns Boolean/short)
 
     if ( GetPCSleep == 0 )
 
Returns true (1) if pc is sleeping. Note: The sleep selector and counter you see while sleeping counts as a menu. So be aware of that, if you want to use this function, and the MenuMode function in the same script!
The example script seems to come from a fairly useless item, but it demonstrates the use…
Begin pillowScript
 
short comfy
 
if ( PCVampire == 1 )
     return
endif
 
if ( comfy == -1 )
     if ( player->GetItemCount "misc_uni_pillow_unique" > 0 )
          if ( GetPCSleep == 0 )
               set comfy to 0
               return
          endif
     endif
endif
 
 
if ( comfy == 0 )
     if ( player->GetItemCount "misc_uni_pillow_unique" > 0 )
          if ( GetPCSleep == 1 )
               MessageBox "Your sleep is very restful on your Extra-Comfy Pillow"
               set comfy to -1
               return
          endif
     endif
endif
 
 
End pillowScript
 
[no fix] WakeUpPC
 
Makes the PC wake up before the selected sleeping time is over. Sometimes creates a monster if the player was sleeping outside. This always happens if they try to sleep for only one hour, with longer times it may or may not happen (Thanks to Manauser for this info). WakeUpPC interrupts the rest only when you actually *sleep*. It does not affect loitering in places where resting is forbidden (Forum info / Kir).
 
Sample script: This is an edited excerpt from the lengthy "sleepers" script by Bethesda. It is responsible for giving you the dreams about Dagoth Ur that plague the player during the main quest. It shows how GetPCSleep and WakeUpPC can be used:
if ( GetPCSleep == 0 )
     return
endif
 
Set dream to 0
 
if ( GetPCCell "Balmora" == 1 )
     Set dream to 1
endif
 
if ( GetPCCell "Ald-ruhn" == 1 )
     Set dream to 2
endif
[…]
if ( dream == 0 )
     Set doOnce to 0
     ;this makes sure you have to leave the city and come back for another attack to occur
     return
endif
 
AddTopic "Disturbing Dreams"
;add this topic, doesn't matter if you do it over and over
 
;THE FIRST DREAM...
 
if ( GetJournalIndex A1_2_AntabolisInformant >= 10 )
     if ( GetJournalIndex A1_Dreams < 1 )
          WakeUpPC
          MessageBox "You had a disturbing dream. Bla bla bla", "Ok"
          Journal A1_Dreams 1
          return
     endif
endif