Talk:Bethesda Tutorial Scenes

Revision as of 00:16, 30 January 2015 by imported>Lmstearn (→‎Extra Credit)

Extra Credit

Can someone hint without too much spoilers how to make Bendu greet Gilfre different depending on time of day? Guess one way is placing timer check with GetCurrentTime, but would require 3 different phases in the scene which seems wrong? Another way I guess might be with a scene where the greet only trigger if they should come within a specific distance (with package template of some kind). --Nemesis 09:16, 15 February 2012 (EST)

I would like to know this as well. GetCurrentTime does seem like the way to go, but it is unclear to me what the range is of the variable that is returned. Is time a number between 1-24? 0-1? And should the function be ran on Subject? --Mr6 10:22, 16 February 2012 (EST)
GetCurrentTime should return a value between 0 and 24, although I'm not sure which of those two values should be returned at midnight. It's not a reference function, so it doesn't need to be called on anything.
-- Cipscis 15:52, 16 February 2012 (EST)

Values 0 and 24 would both come back as midnight. Also if you use 25 you get 1am, 26 2am ect. --SoaringChris137 16:53, 3 March 2012 (EST)

Spoiler Alert!!! Using [this] we can try:
 string Function GetGreeting() 
   
   string Greet = ""
   float Time = Utility.GetCurrentGameTime()
   Time -= Math.Floor(Time) ; Remove "previous in-game days passed" bit
   ;From MSDN math.floor returns the largest integer less than or equal to the specified decimal number
   Time *= 24 ; Convert from fraction of a day to number of hours
   if Time < 13
   Greet = "Good Morning"
   elseif Time > 17
   Greet = "Good Evening"    
   else
   Greet = "Good Afternoon"
   endif
   Return Greet

 EndFunction 

Rather more long winded than just using the condition function GetCurrentTime above as we create a variable in the Papyrus script box at the beginning of the scene:

   timescript myvariable = GetOwningQuest() as timescript
   Debug.MessageBox myvariable.getgreeting()

This turns out fairly useless unless the script is modified with:

   ScriptName Greetingscript extends ObjectReference Conditional
   String Property Greet Auto Conditional

to use it as a condition, but we are really jumping ahead as all this stuff is covered in scripting and in Papyrus_Introduction#Writing_Custom_Functions --Lmstearn (talk) 2015-01-27T07:21:07 (EST)

Return to "Bethesda Tutorial Scenes" page.