Difference between revisions of "User:Rasikko"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Rasikko
imported>Rasikko
m
 
(48 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Remove from Array ==
== Race Info ==
{| border="1" style="text-align:right;"
! Race
! Unit Height
! Height Multiplier
! Run Speed
! Sprint Speed
! M / sec
|-
|Altmer M*
|138
|1.08
|399.6
|540
|7.7
|-
|Argonian M
|129
|1.01
| 373.1
| 505
| 7.2
|-
|Argonian F
|128
|1.00
|370
|500
|7.1
|-
|Bosmer M
|125
|0.98
|362.6
|490
|7.0
|-
|Bosmer F
|128
|1.00
|370
|500
|7.1
|-
|Breton M
|128
|1.00
|370
|500
|7.0
|-
|Breton F
|121
|0.95
|351.5
|475
|6.7
|-
|Dunmer/Imperial*
|128
|1.00
|370
|500
|7.1
|-
|Khajiit M
|128
|1.00
|370
|500
|7.1
|-
|Khajiit F
|121
|0.95
|351.5
|475
|6.7
|-
|Nord*
|131
|1.03
|381.1
|515
|7.3
|-
|Orc*
|133
|1.045
|386.6
|522.5
|7.4
|-
|Redguard M
|128.6
|1.005
|371.8
|502.5
|7.1+
|-
|Redguard F
|128
|1.00
|370
|500
|7.1
|}
* = Applies to Females.
Meters/sec is calculated from sprint speed(math may be off as Unit -> real life unit isn't entirely 1:1). Base height is 128, which is also the height of xmarkerheadings. Calculations gained from info on the UESP and tests involving GetMovementSpeed condition function. Altmers are the fastest humanoid race, and can go from one end of a cell to the other end in 7.5 seconds. The fastest land animal in the game is the bear at 638 running speed. Dragons are the fastest animal in Skyrim at 7400 when in flight.
 
Height is a multiplier that determines the running speed for a particular actor base on the base speed associated with its MovementType. The equation for this is roundUp((H / 128) * BaseMovementSpeed))
 
== On working around the fast travel bug that affects GetCurrentGameTime ==
I don't know how many weeks or months I spent on this but I made progress:
<source lang="papyrus">
[04/05/2018 - 04:17:50PM] Game Days Passed: 207 | Actual Game Days Passed: 209 | Game Days unaccounted for: 2
</source>
This involves adding all the total days for every month up to the current month(method is harder than it sounds), and then comparing that total with the game's gamedayspassed value.
:Keep up the good fight! [[User:Scrivener07|Scrivener07]] ([[User talk:Scrivener07|talk]]) 2018-07-07T12:57:04 (EDT)
::I think the fight is over. Considering that I'm finding myself wrong a good amount of time on Nexus(which is hurts my credibility), I may just remove '''all''' my contributions on both wikis. All of them have been under months of testing, by hand, by calculator, and in more than one way, but I'm not confident anymore that I can bring any meaningful information about the games.--[[User:Rasikko|Rasikko]] ([[User talk:Rasikko|talk]]) 2018-07-16T03:16:45 (EDT)
 
==  Misc Functions ==
<source lang="papyrus">
Bool Function IsInPrison()
Form kPrisonMarker = Game.GetFormFromFile(0x00000004, "Skyrim.ESM")
 
if Game.FindClosestReferenceOfTypeFromRef(kPrisonMarker, Game.GetPlayer(), 11500.0) == none
 
    return false
 
else
 
    return true
 
endif
 
EndFunction
</source>
 
== Array Funtions ==
<source lang="papyrus">
<source lang="papyrus">
Int[] Function RemoveFromArray(Int[] array, int startIndex, int numOfElementsToRemove = 1) Global
Int[] Function RemoveFromArray(Int[] array, int startIndex, int numOfElementsToRemove = 1) Global
Line 24: Line 163:
</source>
</source>


== Reverse an Array ==
<source lang="papyrus">
<source lang="papyrus">
Form[] Function ReverseArray(Form[] array) Global
Form[] Function ReverseArray(Form[] array) Global
Line 48: Line 186:
FT = Unit * 0.046875 --[[User:Rasikko|Rasikko]] ([[User talk:Rasikko|talk]]) 2018-01-10T12:18:45 (EST)
FT = Unit * 0.046875 --[[User:Rasikko|Rasikko]] ([[User talk:Rasikko|talk]]) 2018-01-10T12:18:45 (EST)


== Time Functions ==
== Cell Dimensions ==
Various functions for calculating time in skyrim. Most use [[GetCurrentGameTime - Utility]] as it returns the total game days passed. Making it easier for conversions.<br><br>
Each side is 4096 units long. When split diagonally across it forms 2 right isosceles triangles with 2 equal sides(4096) with a hypotenuse of 5792.618751480198 and an area of 8,388,608.
This function has GetCurrentGameTime live up to its name. Will return the in-game time, instead of days passed. At least 1 day has to have passed.  
 
== Calendar Info ==
Months in Skyrim are index based. Meaning Morning Star is Month 0, and Evening Star is Month 11.
Days of the week are also index based, where Sundas is 0, and Loredas is 6. One day passes on Morndas, 18th, Last Seed,4E201. The game starts at 8:00AM, Sundas, 17th Last Seed 4E 201, which is exactly 16 hours til the next day.<br /><br/>
Skyrim's calendar resets(first day of the year starts on middas again) every 6 years, thus the average length of a skyrim year is exactly 365 days(2,190/6).
The years can be broken up into indexes with 201 = 1, 202 = 2, 203 = 3, etc, resetting back to 1 on the year 207. To find the index for the year, divide the last two digits of the year by 6 and take only the remainder. Due to the game beginning on the 17th, a full calendar month thus occurs on the 17th of every month until 20th, First Seed 202 because of Sun's Dawn only having 28 days, from there, the 20th of every month will be a full calendar month.<br><br>
In case I forget: Sun's Dawn and First Seed always begins on the same day of the week, like February and March.
*Finding the day of the week for the first day of the following month: (TotalDaysPreviousMonth + StartingDoWPreviousMonth) % 7
<br/><br />
 
== Moon info ==
Masser appears in the night sky at a fixed time. 8PM - 4AM.<br>
Secunda appears during the day and night at hours that follow a certain pattern.
*First time frame: 4PM - 12AM
*Second time frame: 12PM - 8PM
*Third time frame: 8AM - 4PM
*Forth time frame: 4AM - 12PM
*Final time frame: 12AM - 8AM
*Conjunction: 8PM - 4AM<br>
The final and conjunction(when both moons rise and set together) occur on the same day. <br>
::Will put info here when it's been figured out.::<br>
 
To calculate the current moon phase each day:
<source lang="papyrus">
<source lang="papyrus">
Float Function GetCurrentGameTimeExtended() Global
String Function GetCurrentMoonPhase()
    ; Returns the time displayed in the game.
Int iCurrentMoonPhase = (((228 + GameDaysPassed.GetValue() as int) % 24) / 3) as int
    ; Format is hh.mmssss
 
if iCurrentMoonPhase == 0
    Float currentGameTime = Utility.GetCurrentGameTime()
return "New Moon"
    Float fractionOfDay = currentGameTime - currentGameTime as int
elseif iCurrentMoonPhase == 1
    Float hour = (fractionOfDay * 24) as int
return "Waxing Crescent"
    Float minutes = ((fractionOfDay * 24) - hour) * 60
elseif iCurrentMoonPhase == 2
    Float seconds = (minutes - minutes as int) * 60
return "First Quarter"
elseif iCurrentMoonPhase == 3
    if currentGameTime >= 1.0
return "Waxing Gibbous"
; before adding the hours, we need to turn the minutes into a decimal.
elseif iCurrentMoonPhase == 4
minutes = (minutes as int) / 100.0
return "Full Moon"
elseif iCurrentMoonPhase == 5
; do the same to the seconds
return "Waning Crescent"
seconds = seconds / 10000.0
elseif iCurrentMoonPhase == 6
return "Last Quarter"
elseif iCurrentMoonPhase == 7
return "Waning Gibbous"
else
return "Unable to calculate the moon phase."
endif


return hour + minutes + seconds
    endif
    return -1.0
EndFunction
EndFunction
</source>
</source>
<br/>
This will return a number between 0 and 7, which each presenting a phase. New Moon is 0, and Full Moon is 4 for example. As the phases last 3 days, the return value will reflect this as well. The value of 228 is the number of days from Morning Star 1, 201 to Last Seed 17.
This simple function converts days passed into hours passed.
<br>
<source lang="papyrus">
From 1/1/201 to 7/17/201, 9.513888875 New Moons have occurred. Knowing this, there is a total of 15.208333 New Moons for 4E 201. To get this information, take the number of days passed since the first known new moon(this being 1/1/201) and divide it by the length of the lunar cycle, which is 24. To find out how many days remaining until the next new moon, use the following equation: <source lang=papyrus>DayPassedSinceFirstNewMoon % 24</source>
Float Function GetGameHoursPassed()
 
; Converts the game days passed to game time hours.
== Lunar Functions ==
return Utility.GetCurrentGameTime() * 24
Returns the time Masser rises. If the current time is beyond this, will return how many hours til the next moonrise.
EndFunction
If more than 1 day has not passed, will return the time Masser will rise instead.
</source>
<br />
This function takes the game days passed and converts them into minutes passed.
<source lang="papyrus">
Float Function GetGameMinutesPassed()
    ; Converts the game days passed to game minutes passed.
    return Utility.GetCurrentGameTime() * 24 * 60
EndFunction
</source>
<br/>
To get the total ''real'' minutes passed since the game started, you do the following:<br>
<source lang="papyrus">
Game.GetRealHoursPassed() * 60
</source>
<br/>
To get the number of seconds that have passed since game start. Note at least 1 day has to have passed:
<source lang="papyrus">
<source lang="papyrus">
Float Function GetGameSecondsPassed()
Float Function GetMasserRiseTime() Global
    ; returns the number of game seconds since game start.
     Float gameTime = Utility.GetCurrentGameTime()
     Float gameTime = Utility.GetCurrentGameTime()
    Float riseTime = 20.00 ; 8PM
    Float hoursPerDay = 24.00
    Float currentHour = (gameTime - gameTime as int) * hoursPerDay
     if gameTime >= 1.0
     if (gameTime >= 1.0)
return gameTime / 24.0 * 60 * 60
if currentHour > riseTime
     
    riseTime = currentHour - (riseTime - 12.00)
    return riseTime
else
    return riseTime
endif
     endif
     endif
   
     return -1.0
     return riseTime
EndFunction
EndFuntion
</source>
</source>
<br/>
<br/>
For milliseconds:
Same above, but for Masser's setting time.
<source lang="papyrus">
<source lang="papyrus">
Float Function GetGameMillisecondsPassed()
Float Function GetMasserSetTime() Global
     ; Returns milliseconds passed since game start.
     ; Returns the time that Masser sets. If the current time is passed the moonset time,
 
    ; will return the number of hours til the next moonset.
     Float gameTime = Utility.GetCurrentGameTime()
 
     Float daysPassed = Utility.GetCurrentGameTime()
     if gameTime >= 1.0
    Float hoursPerDay = 24.00
return gameTime / 24.0 * 60.0 * 60.0 * 1000.0
    Float setTime = 4.00 ; 4AM
    Float currentHour = (daysPassed - daysPassed as int) * hoursPerDay
     if daysPassed >= 1.0
if currentHour > setTime
 
  setTime = currentHour - setTime
  return setTime
else
  return setTime
        endif
     endif
     endif
    return -1.0
EndFunction
</source>
Short note about game time: Game time is paused when in a menu. While this is a well known fact, it can be easily forgotten when working with it along side real time, as real time obviously keeps running.
<br><br>
Skyrim has no leap years, and thus has common years, where the first day and last day of the year are on the same day of the week.
== Calendar Functions ==
Various functions for dealing with the months, weeks, or days. Months in Skyrim are index based. Meaning Morning Star is Month 0, and Evening Star is Month 11.
Days of the week are also index based, where Sundas is 0, and Loredas is 6. One day passes on Morndas, 18th, Last Seed. The game starts at 8:00AM, Sundas, 17th Last Seed, which is exactly 17 hours til the next day.
<br>
<source lang="papyrus">
Int Function GetGameMonthTotalDays(int aiGameMonth = 0) Global
; returns the number of days for this month.
Int[] months = new Int[12]
months[0] = 31
months[1] = 28
months[2] = 31
months[3] = 30
months[4] = 31
months[5] = 30
months[6] = 31
months[7] = 31
months[8] = 30
months[9] = 31
months[10]= 30
months[11]= 31
return months[aiGameMonth]
    return setTime
EndFunction
EndFunction
</source>
</source>
Line 158: Line 296:
* When time permits, add another example concerning the Events OnActivate, OnTriggerEnter and OnTriggerLeave.
* When time permits, add another example concerning the Events OnActivate, OnTriggerEnter and OnTriggerLeave.
* Test out function for acquiring the xp for the next level and add it to the condition function page of the same name as an alternative to it.
* Test out function for acquiring the xp for the next level and add it to the condition function page of the same name as an alternative to it.
* Fix syntax/logic issue concerning the Cast to string section in [[Cast Reference]], because it's completely wrong.
* https://www.creationkit.com/index.php?title=Coordinate_Functions
== collision layers ==
Adding or removing a layer will edit all the other layers associated with the collision layer that is being modified. For example if you add L_ACTORZONE to L_DEADACTORZONE, then L_ACTORZONE will have L_DEADACTORZONE added to it as well. This can potentially lead to lots of conflicts and/or weird behaviors with existing triggers.

Latest revision as of 06:30, 3 July 2021

Race Info[edit | edit source]

Race Unit Height Height Multiplier Run Speed Sprint Speed M / sec
Altmer M* 138 1.08 399.6 540 7.7
Argonian M 129 1.01 373.1 505 7.2
Argonian F 128 1.00 370 500 7.1
Bosmer M 125 0.98 362.6 490 7.0
Bosmer F 128 1.00 370 500 7.1
Breton M 128 1.00 370 500 7.0
Breton F 121 0.95 351.5 475 6.7
Dunmer/Imperial* 128 1.00 370 500 7.1
Khajiit M 128 1.00 370 500 7.1
Khajiit F 121 0.95 351.5 475 6.7
Nord* 131 1.03 381.1 515 7.3
Orc* 133 1.045 386.6 522.5 7.4
Redguard M 128.6 1.005 371.8 502.5 7.1+
Redguard F 128 1.00 370 500 7.1
  • = Applies to Females.

Meters/sec is calculated from sprint speed(math may be off as Unit -> real life unit isn't entirely 1:1). Base height is 128, which is also the height of xmarkerheadings. Calculations gained from info on the UESP and tests involving GetMovementSpeed condition function. Altmers are the fastest humanoid race, and can go from one end of a cell to the other end in 7.5 seconds. The fastest land animal in the game is the bear at 638 running speed. Dragons are the fastest animal in Skyrim at 7400 when in flight.

Height is a multiplier that determines the running speed for a particular actor base on the base speed associated with its MovementType. The equation for this is roundUp((H / 128) * BaseMovementSpeed))

On working around the fast travel bug that affects GetCurrentGameTime[edit | edit source]

I don't know how many weeks or months I spent on this but I made progress:

[04/05/2018 - 04:17:50PM] Game Days Passed: 207 | Actual Game Days Passed: 209 | Game Days unaccounted for: 2

This involves adding all the total days for every month up to the current month(method is harder than it sounds), and then comparing that total with the game's gamedayspassed value.

Keep up the good fight! Scrivener07 (talk) 2018-07-07T12:57:04 (EDT)
I think the fight is over. Considering that I'm finding myself wrong a good amount of time on Nexus(which is hurts my credibility), I may just remove all my contributions on both wikis. All of them have been under months of testing, by hand, by calculator, and in more than one way, but I'm not confident anymore that I can bring any meaningful information about the games.--Rasikko (talk) 2018-07-16T03:16:45 (EDT)

Misc Functions[edit | edit source]

Bool Function IsInPrison()
Form kPrisonMarker = Game.GetFormFromFile(0x00000004, "Skyrim.ESM")

if Game.FindClosestReferenceOfTypeFromRef(kPrisonMarker, Game.GetPlayer(), 11500.0) == none

    return false

else

    return true

endif

EndFunction

Array Funtions[edit | edit source]

Int[] Function RemoveFromArray(Int[] array, int startIndex, int numOfElementsToRemove = 1) Global
	; Removes a number of elements from an array from the starting index.
	; Change the return, parameter, and variable type to suit the array type you are using.
	
	int arrayLength = array.length
	
	if (startIndex == 0 && numOfElementstoRemove == 0)
		array[startIndex] = 0
		return array
	elseif numOfElementsToRemove >= arrayLength
		; To prevent an error. Returns the array unchanged.
		return array
	else
		while (startIndex < numOfElementsToRemove + 1)
			array[startIndex] = 0
			startIndex += 1
		endwhile
	endif
	
	return array
EndFunction
Form[] Function ReverseArray(Form[] array) Global
	; Reverses the order from the smallest index to the largest and returns the array.
	; Change the return, parameter, and variable type to suit the array type you are reversing.
 
	Int index = array.length
	Int i = 0
	Form temp
 
	while (i < (index / 2))
		temp = array[i]
		array[i] = array[(index - 1) - i]
		array[(index - 1) - i] = temp
		i += 1
	endwhile
 
	return array
EndFunction

Unit Converions[edit | edit source]

The Unit page lists the Skyrim Unit to metric/imperial conversions, centimeters to inches is obvious, though it doesn't list the calculations when going to feet, so here it is: FT = Unit * 0.046875 --Rasikko (talk) 2018-01-10T12:18:45 (EST)

Cell Dimensions[edit | edit source]

Each side is 4096 units long. When split diagonally across it forms 2 right isosceles triangles with 2 equal sides(4096) with a hypotenuse of 5792.618751480198 and an area of 8,388,608.

Calendar Info[edit | edit source]

Months in Skyrim are index based. Meaning Morning Star is Month 0, and Evening Star is Month 11. Days of the week are also index based, where Sundas is 0, and Loredas is 6. One day passes on Morndas, 18th, Last Seed,4E201. The game starts at 8:00AM, Sundas, 17th Last Seed 4E 201, which is exactly 16 hours til the next day.

Skyrim's calendar resets(first day of the year starts on middas again) every 6 years, thus the average length of a skyrim year is exactly 365 days(2,190/6). The years can be broken up into indexes with 201 = 1, 202 = 2, 203 = 3, etc, resetting back to 1 on the year 207. To find the index for the year, divide the last two digits of the year by 6 and take only the remainder. Due to the game beginning on the 17th, a full calendar month thus occurs on the 17th of every month until 20th, First Seed 202 because of Sun's Dawn only having 28 days, from there, the 20th of every month will be a full calendar month.

In case I forget: Sun's Dawn and First Seed always begins on the same day of the week, like February and March.

  • Finding the day of the week for the first day of the following month: (TotalDaysPreviousMonth + StartingDoWPreviousMonth) % 7



Moon info[edit | edit source]

Masser appears in the night sky at a fixed time. 8PM - 4AM.
Secunda appears during the day and night at hours that follow a certain pattern.

  • First time frame: 4PM - 12AM
  • Second time frame: 12PM - 8PM
  • Third time frame: 8AM - 4PM
  • Forth time frame: 4AM - 12PM
  • Final time frame: 12AM - 8AM
  • Conjunction: 8PM - 4AM

The final and conjunction(when both moons rise and set together) occur on the same day.

Will put info here when it's been figured out.::

To calculate the current moon phase each day:

String Function GetCurrentMoonPhase()
	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

EndFunction

This will return a number between 0 and 7, which each presenting a phase. New Moon is 0, and Full Moon is 4 for example. As the phases last 3 days, the return value will reflect this as well. The value of 228 is the number of days from Morning Star 1, 201 to Last Seed 17.

From 1/1/201 to 7/17/201, 9.513888875 New Moons have occurred. Knowing this, there is a total of 15.208333 New Moons for 4E 201. To get this information, take the number of days passed since the first known new moon(this being 1/1/201) and divide it by the length of the lunar cycle, which is 24. To find out how many days remaining until the next new moon, use the following equation:

DayPassedSinceFirstNewMoon % 24

Lunar Functions[edit | edit source]

Returns the time Masser rises. If the current time is beyond this, will return how many hours til the next moonrise. If more than 1 day has not passed, will return the time Masser will rise instead.

Float Function GetMasserRiseTime() Global
    Float gameTime = Utility.GetCurrentGameTime()
    Float riseTime = 20.00 ; 8PM
    Float hoursPerDay = 24.00	
    Float currentHour = (gameTime - gameTime as int) * hoursPerDay
	
    if (gameTime >= 1.0)
	 if currentHour > riseTime
       
	    riseTime = currentHour - (riseTime - 12.00)
		
	    return riseTime
	 else
	    return riseTime
	 endif
    endif
    
    return riseTime
EndFuntion


Same above, but for Masser's setting time.

Float Function GetMasserSetTime() Global
    ; Returns the time that Masser sets. If the current time is passed the moonset time,
    ; will return the number of hours til the next moonset.
	
    Float daysPassed = Utility.GetCurrentGameTime()
    Float hoursPerDay = 24.00
    Float setTime = 4.00 ; 4AM
    Float currentHour = (daysPassed - daysPassed as int) * hoursPerDay
	
    if daysPassed >= 1.0
	if currentHour > setTime
	  
	   setTime = currentHour - setTime
			
	   return setTime
	else
	   return setTime
        endif
    endif
	
    return setTime
	
EndFunction

Self Reminders[edit | edit source]

  • When time permits, add another example concerning the Events OnActivate, OnTriggerEnter and OnTriggerLeave.
  • Test out function for acquiring the xp for the next level and add it to the condition function page of the same name as an alternative to it.
  • Fix syntax/logic issue concerning the Cast to string section in Cast Reference, because it's completely wrong.
  • https://www.creationkit.com/index.php?title=Coordinate_Functions


collision layers[edit | edit source]

Adding or removing a layer will edit all the other layers associated with the collision layer that is being modified. For example if you add L_ACTORZONE to L_DEADACTORZONE, then L_ACTORZONE will have L_DEADACTORZONE added to it as well. This can potentially lead to lots of conflicts and/or weird behaviors with existing triggers.