Difference between revisions of "Special variables"
Jump to navigation
Jump to search
imported>QQuix (Added a note about the Day of the Week not being automatically updated if the game date is changed) |
|||
Line 8: | Line 8: | ||
! style="background:#efefef;" | Name | ! style="background:#efefef;" | Name | ||
! style="background:#efefef;" | Description | ! style="background:#efefef;" | Description | ||
|- | |-G | ||
|short | |short | ||
|GameYear | |GameYear |
Revision as of 14:53, 21 December 2023
Globals
Some global variables are predefined and handled and/or updated by the game-engine itself.
Type | Name | Description |
---|---|---|
short | GameYear | The current year |
short | GameMonth | The current month (0-11) |
short | GameDay | The current day of the month (0-31) depending on month |
float | GameHour | The current hour (0.0-23.9999) |
short | TimeScale | Minutes that pass in-game within one minute of real-life |
short | GameDaysPassed | Days that have passed since the beginning of the game |
- You may use or Set any of these variables.
- GameHour stores the minutes as a fraction of the hour.
float Test ... set Test to GameHour Message "Gamehour is %.2f", Test
- will print out "Gamehour is 2.5" if it is 2:30 A.M.
- Setting GameHour to a fractional value sets the game minutes accordingly, e.g., if you set GameHour to 23.9 the game time will become 23:54 and a new game day will start in a few game minutes.
- While most are listed as a short, they are actually stored as floats and may be set to any value, integer or not. The game accepts them all and the fractions seem to be ignored, therefore, setting GameDay to a fractional value does not set the game hour. Of course, setting the game date to weird values like 23.7/47/99999.9 may (and probably will) break a number of mods.
- GameDay and GameDaysPassed are not automatically aligned to each other, meaning: if your script changes one, the other will not be automatically updated, e.g., if the game day is 2 and GameDaysPassed is 80 and you set GameDay to 5, GameDaysPassed will not be updated and will remain at 80, which may break mods that take for granted that both stay aligned.
- The day of the week is not updated when the game date is changed.
- For moving game time forward, see also SetPCSleepHours
GameMonth | Name | Description |
---|---|---|
0 | Morningstar | Same # of days as January (31) |
1 | Sun's Dawn | Same # of days as February (28) |
2 | First Seed | Same # of days as March (31) |
3 | Rain's Hand | Same # of days as April (30) |
4 | Second Seed | Same # of days as May (31) |
5 | Mid-Year | Same # of days as June (30) |
6 | Sun's Height | Same # of days as July (31) |
7 | Last Seed | Same # of days as August (31) |
8 | Heartfire | Same # of days as September (30) |
9 | Frost Fall | Same # of days as October (31) |
10 | Sun's Dusk | Same # of days as November (30) |
11 | Evening Star | Same # of days as December (31) |
Locals
There are also local variables with special functions:
Script-Type | Variable-Type | Name | Description |
---|---|---|---|
Quest | float | fQuestDelayTime | Determines how long (in real-time seconds) the game will wait between two runs of a quest script. The default value is 5 seconds. This value will also be used when fQuestDelayTime is defined but set to 0. |
Object(Trap) | float | fTrapDamage | Amount of damage to do each time the trap affects an actor. |
Object(Trap) | float | fTrapPushBack | Amount of push back force to apply each time a trap effects an actor. This should range from 0 to 1000. |
Object(Trap) | float | fTrapMinVelocity | Minimum velocity a trap must be moving at relative to the actor to do damage (combination of actor and traps respective velocities). This value is in BSUnits (128 = 6ft). |
Object(Trap) | float | bTrapContinuous | 0 = Only deal damage on first contact with trap.
1 = Continously subtract damage as long as actor is in contact with trap. |