Difference between revisions of "User:Rasikko"

Jump to navigation Jump to search
441 bytes added ,  15:43, 29 March 2020
imported>Rasikko
imported>Rasikko
Line 192: Line 192:
To calculate the current moon phase each day:
To calculate the current moon phase each day:
<source lang="papyrus">
<source lang="papyrus">
Int Function GetCurrentMoonPhase()
String Function GetCurrentMoonPhase()
Float fGameDaysPassed = (Game.GetFormFromFile(0x00000039, "Skyrim.esm") as GlobalVariable).GetValue()
Int iCurrentMoonPhase = (((228 + GameDaysPassed.GetValue() as int) % 24) / 3) as int
 
if iCurrentMoonPhase == 0
return "New Moon"
elseif iCurrentMoonPhase == 1
return "Waxing Crescent"
elseif iCurrentMoonPhase == 2
return "First Quarter"
elseif iCurrentMoonPhase == 3
return "Waxing Gibbous"
elseif iCurrentMoonPhase == 4
return "Full Moon"
elseif iCurrentMoonPhase == 5
return "Waning Crescent"
elseif iCurrentMoonPhase == 6
return "Last Quarter"
elseif iCurrentMoonPhase == 7
return "Waning Gibbous"
else
return "Unable to calculate the moon phase."
endif


return (((228 + fDaysPassed) % 24) / 3) as int
EndFunction
EndFunction
</source>
</source>
Anonymous user

Navigation menu