Difference between revisions of "Game Script"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>CraftySentinel
(Added SKSE Legendary Skill Functions)
imported>CraftySentinel
m (Minor Formatting Change)
Line 18: Line 18:


{|class="wikitable" width =100%
{|class="wikitable" width =100%
!style="text-align:left;" width=25%|Function
!style="text-align:left;"|Function
!style="text-align:left;"|Description
!style="text-align:left;"|Description
|-
|-

Revision as of 02:08, 24 October 2013

Source: Creation Kit

Extends: None

Flags: Hidden


Collection of game-specific global functions

Definition

ScriptName Game Hidden


Global Functions

Function Description
AddAchievement(Int aiAchievementID) Adds the specified achievement/trophy to the player's gamer profile.
AddPerkPoints(Int aiPerkPoints) Adds the given number of perk points to the player. Clamped at 255.
AdvanceSkill(String asSkillName, Float afMagnitude) Advance the given skill on the player by the provided amount of skill usage
Bool AddHavokBallAndSocketConstraint(ObjectReference arRefA, String arRefANode, ObjectReference arRefB, String arRefBNode, Float afRefALocalOffsetX, Float afRefALocalOffsetY, Float afRefALocalOffsetZ, Float afRefBLocalOffsetX, Float afRefBLocalOffsetY, Float afRefBLocalOffsetZ) Adds a ball-and-socket constraint between two rigid bodies, identified by their ref and node names
Int CalculateFavorCost(Int aiFavorPrice) Calculates how many points the player would have to pay for a favor of the specified price.
ClearPrison() Clears all Prison variables on the PlayerCharacter so the game will know he is out of prison.
ClearTempEffects() Clears all temp effects (such as terrain effects) in the game.
DisablePlayerControls(Bool abMovement, Bool abFighting, Bool abCamSwitch, Bool abLooking, Bool abSneaking, Bool abMenu, Bool abActivate, Bool abJournalTabs, Int aiDisablePOVType) Disables the specified player controls.
EnableFastTravel(Bool abEnable) Enables or disables the player's ability to fast travel.
EnablePlayerControls(Bool abMovement, Bool abFighting, Bool abCamSwitch, Bool abLooking, Bool abSneaking, Bool abMenu, Bool abActivate, Bool abJournalTabs, Int aiDisablePOVType) Enables the specified player controls.
FadeOutGame(Bool abFadingOut, Bool abBlackFade, Float afSecsBeforeFade, Float afFadeDuration) Fades the game in and out with the specified parameters.
FastTravel(ObjectReference akDestination) Fast-travels the player to the specified object's location.
Actor FindClosestActor(Float afX, Float afY, Float afZ, Float afRadius) Finds the closest actor within a given radius of a location
Actor FindClosestActorFromRef(ObjectReference arCenter, Float afRadius) Finds the closest actor within a given radius of a reference
ObjectReference FindClosestReferenceOfAnyTypeInList(FormList arBaseObjects, Float afX, Float afY, Float afZ, Float afRadius) Finds the closest reference of any of the base objects in the list within a given radius of a location
ObjectReference FindClosestReferenceOfAnyTypeInListFromRef(FormList arBaseObjects, ObjectReference arCenter, Float afRadius) Finds the closest reference of any of the base objects in the list within a given radius of a reference
ObjectReference FindClosestReferenceOfType(Form arBaseObject, Float afX, Float afY, Float afZ, Float afRadius) Finds the closest reference of a given base object within a given radius of a location
ObjectReference FindClosestReferenceOfTypeFromRef(Form arBaseObject, ObjectReference arCenter, Float afRadius) Finds the closest reference of a given base object within a given radius of a reference
Actor FindRandomActor(Float afX, Float afY, Float afZ, Float afRadius) Finds a random actor within a given radius of a location
Actor FindRandomActorFromRef(ObjectReference arCenter, Float afRadius) Finds a random actor within a given radius of a reference
ObjectReference FindRandomReferenceOfAnyTypeInList(FormList arBaseObjects, Float afX, Float afY, Float afZ, Float afRadius) Finds a random reference of any of the base objects in the list within a given radius of a location
ObjectReference FindRandomReferenceOfAnyTypeInListFromRef(FormList arBaseObjects, ObjectReference arCenter, Float afRadius) Finds a random reference of any of the base objects in the list within a given radius of a reference
ObjectReference FindRandomReferenceOfType(Form arBaseObject, Float afX, Float afY, Float afZ, Float afRadius) Finds a random reference of a given base object within a given radius of a location
ObjectReference FindRandomReferenceOfTypeFromRef(Form arBaseObject, ObjectReference arCenter, Float afRadius) Finds a random reference of a given base object within a given radius of a reference
ForceFirstPerson() Forces the player camera into 1st-person.
ForceThirdPerson() Forces the player camera into 3rd-person.
Form GetForm(Int aiFormID) Obtains a Form from the game by its form ID number.
Form GetFormFromFile(Int aiFormID, String asFilename) Obtains the form specified by its form ID number which originated in the specified file.
Float GetGameSettingFloat(String asGameSetting) Obtains the value of a float game setting.
Float GetGameSettingInt(String asGameSetting) Obtains the value of an int game setting.
Float GetGameSettingString(String asGameSetting) Obtains the value of a string game setting.
Actor GetPlayer() Obtains the Actor that represents the player.
ObjectReference GetPlayerGrabbedRef() Obtains the ObjectReference the player is currently grabbing.
Actor GetPlayersLastRiddenHorse() Gets this actors last ridden horse if it is the player. Returns None if player has not ridden a horse is not the player.
Float GetRealHoursPassed() Returns the number of real-life hours that have passed playing the game.
Float GetSunPositionX() Gets the X position of the sun.
Float GetSunPositionY() Gets the Y position of the sun.
Float GetSunPositionZ() Gets the Z position of the sun.
HideTitleSequenceMenu() Hides the title sequence menu.
IncrementSkill(String asSkillName) Advances the provided Skill by the one point (for the player only).
IncrementSkillBy(String asSkillName, Int aiCount) Advances the provided Skill by the given number of points (for the player only).
IncrementStat(String asStatName, Int aiModAmount) Modifies the specified MiscStat by the given amount
Bool IsActivateControlsEnabled() Are the activation controls enabled?
Bool IsCamSwitchControlsEnabled() Are the camera switch controls enabled?
Bool IsFastTravelEnabled() Is fast travel enabled?
Bool IsFastTravelControlsEnabled() Are fast travel controls enabled?
Bool IsFightingControlsEnabled() Are the fighting controls enabled?
Bool IsJournalControlsEnabled() Are the journal menu controls enabled?
Bool IsLookingControlsEnabled() Are the looking controls enabled?
Bool IsMenuControlsEnabled() Are the menu controls enabled?
Bool IsMovementControlsEnabled() Are the movement controls enabled?
Bool IsPlayerSungazing() Checks to the see if the player is looking directly at the sun.
Bool IsSneakingControlsEnabled() Are the sneaking controls enabled?
Bool IsWordUnlocked(WordOfPower akWord) Is the word of power unlocked on the player?
PlayBink(String asFileName, Bool abInterruptible, Bool abMuteAudio, Bool abMuteMusic, Bool abLetterbox) Plays a bink video
PrecacheCharGen() Precaches all the data used by character gen to avoid hitches with file I/O.
PrecacheCharGenClear() Clears all the previously cached data used by character gen.
Int QueryStat(String asStat) Queries the given stat and returns its value.
QuitToMainMenu() Forces the game back to the main menu.
Bool RemoveHavokConstraints(ObjectReference arFirstRef, String arFirstRefNodeName, ObjectReference arSecondRef, String arSecondRefNodeName) Removes any constraint between two rigid bodies
RequestAutoSave() Requests for an auto-save to be made.
RequestModel(String asModelName) Requests the specified model.
RequestSave() Requests for a normal save to be made.
SendWereWolfTransformation() Finds an actor in high who can detect the player to call werewolf crime on the player
ServeTime() Has the player serve their jail time.
SetAllowFlyingMountLandingRequests(Bool abAllow) Allow or disallow the player requests to have a flying mount land.
SetBeastForm(Bool abEntering) Flags the player as being in/out of "beast form".
SetCameraTarget(Actor arTarget) Sets the camera target actor
SetHudCartMode(Bool abSetCartMode) Flags the HUD as being in "cart mode" or not.
SetInChargen(Bool abDisableSaving, Bool abDisableWaiting, Bool abShowControlsDisabledMessage) Enable/disable various functionality which we want in chargen.
SetPlayerAIDriven(Bool abAIDriven) Enables or disables the AI driven flag on the player.
SetPlayerReportCrime(Bool abReportCrime) Set the state of the player as an actor who commits crimes
SetSittingRotation(Float afValue) Set the player's sitting camera offset rotation.
SetSunGazeImageSpaceModifier(ImageSpaceModifier apImod) Will cause the specified ImageSpace Modifier to be triggered when the player begins looking at the sun
ShakeCamera(ObjectReference akSource, Float afStrength) Shakes the camera from the specified location with the specified strength.
ShakeController(Float afLeftStrength, Float afRightStrength, Float afDuration) Shakes the controller for the specified amount of time.
ShowFirstPersonGeometry(Bool abShow) Shows or hides the first-person geometry
ShowLimitedRaceMenu() Shows the race/sex change menu, but without the ability to change race or sex.
ShowRaceMenu() Shows the race/sex change menu.
ShowTitleSequenceMenu() Shows the title sequence menu.
ShowTrainingMenu(Actor aActor) Shows the training menu provided by actor parameter.
StartTitleSequence(String asSequenceName) Plays the specified sequence in the title menu.
TeachWord(WordOfPower akWord) Teaches the specified WordOfPower to the player
TriggerScreenBlood(Int aiValue) Trigger on-screen blood splatter.
UnlockWord(WordOfPower akWord) Unlocks the specified WordOfPower so the player can use it
Bool UsingGamepad() Returns whether the player is using a gamepad or not.

SKSE Global Functions

Function Description
AddAchievement(Int aiAchievementID) Adds the specified achievement/trophy to the player's gamer profile.
AddPerkPoints(Int aiPerkPoints) Adds the given number of perk points to the player. Clamped at 255.
AdvanceSkill(String asSkillName, Float afMagnitude) Advance the given skill on the player by the provided amount of skill usage
Bool AddHavokBallAndSocketConstraint(ObjectReference arRefA, String arRefANode, ObjectReference arRefB, String arRefBNode, Float afRefALocalOffsetX, Float afRefALocalOffsetY, Float afRefALocalOffsetZ, Float afRefBLocalOffsetX, Float afRefBLocalOffsetY, Float afRefBLocalOffsetZ) Adds a ball-and-socket constraint between two rigid bodies, identified by their ref and node names
Int CalculateFavorCost(Int aiFavorPrice) Calculates how many points the player would have to pay for a favor of the specified price.
ClearPrison() Clears all Prison variables on the PlayerCharacter so the game will know he is out of prison.
ClearTempEffects() Clears all temp effects (such as terrain effects) in the game.
DisablePlayerControls(Bool abMovement, Bool abFighting, Bool abCamSwitch, Bool abLooking, Bool abSneaking, Bool abMenu, Bool abActivate, Bool abJournalTabs, Int aiDisablePOVType) Disables the specified player controls.
EnableFastTravel(Bool abEnable) Enables or disables the player's ability to fast travel.
EnablePlayerControls(Bool abMovement, Bool abFighting, Bool abCamSwitch, Bool abLooking, Bool abSneaking, Bool abMenu, Bool abActivate, Bool abJournalTabs, Int aiDisablePOVType) Enables the specified player controls.
FadeOutGame(Bool abFadingOut, Bool abBlackFade, Float afSecsBeforeFade, Float afFadeDuration) Fades the game in and out with the specified parameters.
FastTravel(ObjectReference akDestination) Fast-travels the player to the specified object's location.
Actor FindClosestActor(Float afX, Float afY, Float afZ, Float afRadius) Finds the closest actor within a given radius of a location
Actor FindClosestActorFromRef(ObjectReference arCenter, Float afRadius) Finds the closest actor within a given radius of a reference
ObjectReference FindClosestReferenceOfAnyTypeInList(FormList arBaseObjects, Float afX, Float afY, Float afZ, Float afRadius) Finds the closest reference of any of the base objects in the list within a given radius of a location
ObjectReference FindClosestReferenceOfAnyTypeInListFromRef(FormList arBaseObjects, ObjectReference arCenter, Float afRadius) Finds the closest reference of any of the base objects in the list within a given radius of a reference
ObjectReference FindClosestReferenceOfType(Form arBaseObject, Float afX, Float afY, Float afZ, Float afRadius) Finds the closest reference of a given base object within a given radius of a location
ObjectReference FindClosestReferenceOfTypeFromRef(Form arBaseObject, ObjectReference arCenter, Float afRadius) Finds the closest reference of a given base object within a given radius of a reference
Actor FindRandomActor(Float afX, Float afY, Float afZ, Float afRadius) Finds a random actor within a given radius of a location
Actor FindRandomActorFromRef(ObjectReference arCenter, Float afRadius) Finds a random actor within a given radius of a reference
ObjectReference FindRandomReferenceOfAnyTypeInList(FormList arBaseObjects, Float afX, Float afY, Float afZ, Float afRadius) Finds a random reference of any of the base objects in the list within a given radius of a location
ObjectReference FindRandomReferenceOfAnyTypeInListFromRef(FormList arBaseObjects, ObjectReference arCenter, Float afRadius) Finds a random reference of any of the base objects in the list within a given radius of a reference
ObjectReference FindRandomReferenceOfType(Form arBaseObject, Float afX, Float afY, Float afZ, Float afRadius) Finds a random reference of a given base object within a given radius of a location
ObjectReference FindRandomReferenceOfTypeFromRef(Form arBaseObject, ObjectReference arCenter, Float afRadius) Finds a random reference of a given base object within a given radius of a reference
ForceFirstPerson() Forces the player camera into 1st-person.
ForceThirdPerson() Forces the player camera into 3rd-person.
Form GetForm(Int aiFormID) Obtains a Form from the game by its form ID number.
Form GetFormFromFile(Int aiFormID, String asFilename) Obtains the form specified by its form ID number which originated in the specified file.
Float GetGameSettingFloat(String asGameSetting) Obtains the value of a float game setting.
Float GetGameSettingInt(String asGameSetting) Obtains the value of an int game setting.
Float GetGameSettingString(String asGameSetting) Obtains the value of a string game setting.
Actor GetPlayer() Obtains the Actor that represents the player.
ObjectReference GetPlayerGrabbedRef() Obtains the ObjectReference the player is currently grabbing.
Actor GetPlayersLastRiddenHorse() Gets this actors last ridden horse if it is the player. Returns None if player has not ridden a horse is not the player.
Float GetRealHoursPassed() Returns the number of real-life hours that have passed playing the game.
Float GetSunPositionX() Gets the X position of the sun.
Float GetSunPositionY() Gets the Y position of the sun.
Float GetSunPositionZ() Gets the Z position of the sun.
HideTitleSequenceMenu() Hides the title sequence menu.
IncrementSkill(String asSkillName) Advances the provided Skill by the one point (for the player only).
IncrementSkillBy(String asSkillName, Int aiCount) Advances the provided Skill by the given number of points (for the player only).
IncrementStat(String asStatName, Int aiModAmount) Modifies the specified MiscStat by the given amount
Bool IsActivateControlsEnabled() Are the activation controls enabled?
Bool IsCamSwitchControlsEnabled() Are the camera switch controls enabled?
Bool IsFastTravelEnabled() Is fast travel enabled?
Bool IsFastTravelControlsEnabled() Are fast travel controls enabled?
Bool IsFightingControlsEnabled() Are the fighting controls enabled?
Bool IsJournalControlsEnabled() Are the journal menu controls enabled?
Bool IsLookingControlsEnabled() Are the looking controls enabled?
Bool IsMenuControlsEnabled() Are the menu controls enabled?
Bool IsMovementControlsEnabled() Are the movement controls enabled?
Bool IsPlayerSungazing() Checks to the see if the player is looking directly at the sun.
Bool IsSneakingControlsEnabled() Are the sneaking controls enabled?
Bool IsWordUnlocked(WordOfPower akWord) Is the word of power unlocked on the player?
PlayBink(String asFileName, Bool abInterruptible, Bool abMuteAudio, Bool abMuteMusic, Bool abLetterbox) Plays a bink video
PrecacheCharGen() Precaches all the data used by character gen to avoid hitches with file I/O.
PrecacheCharGenClear() Clears all the previously cached data used by character gen.
Int QueryStat(String asStat) Queries the given stat and returns its value.
QuitToMainMenu() Forces the game back to the main menu.
Bool RemoveHavokConstraints(ObjectReference arFirstRef, String arFirstRefNodeName, ObjectReference arSecondRef, String arSecondRefNodeName) Removes any constraint between two rigid bodies
RequestAutoSave() Requests for an auto-save to be made.
RequestModel(String asModelName) Requests the specified model.
RequestSave() Requests for a normal save to be made.
SendWereWolfTransformation() Finds an actor in high who can detect the player to call werewolf crime on the player
ServeTime() Has the player serve their jail time.
SetAllowFlyingMountLandingRequests(Bool abAllow) Allow or disallow the player requests to have a flying mount land.
SetBeastForm(Bool abEntering) Flags the player as being in/out of "beast form".
SetCameraTarget(Actor arTarget) Sets the camera target actor
SetHudCartMode(Bool abSetCartMode) Flags the HUD as being in "cart mode" or not.
SetInChargen(Bool abDisableSaving, Bool abDisableWaiting, Bool abShowControlsDisabledMessage) Enable/disable various functionality which we want in chargen.
SetPlayerAIDriven(Bool abAIDriven) Enables or disables the AI driven flag on the player.
SetPlayerReportCrime(Bool abReportCrime) Set the state of the player as an actor who commits crimes
SetSittingRotation(Float afValue) Set the player's sitting camera offset rotation.
SetSunGazeImageSpaceModifier(ImageSpaceModifier apImod) Will cause the specified ImageSpace Modifier to be triggered when the player begins looking at the sun
ShakeCamera(ObjectReference akSource, Float afStrength) Shakes the camera from the specified location with the specified strength.
ShakeController(Float afLeftStrength, Float afRightStrength, Float afDuration) Shakes the controller for the specified amount of time.
ShowFirstPersonGeometry(Bool abShow) Shows or hides the first-person geometry
ShowLimitedRaceMenu() Shows the race/sex change menu, but without the ability to change race or sex.
ShowRaceMenu() Shows the race/sex change menu.
ShowTitleSequenceMenu() Shows the title sequence menu.
ShowTrainingMenu(Actor aActor) Shows the training menu provided by actor parameter.
StartTitleSequence(String asSequenceName) Plays the specified sequence in the title menu.
TeachWord(WordOfPower akWord) Teaches the specified WordOfPower to the player
TriggerScreenBlood(Int aiValue) Trigger on-screen blood splatter.
UnlockWord(WordOfPower akWord) Unlocks the specified WordOfPower so the player can use it
Bool UsingGamepad() Returns whether the player is using a gamepad or not.
Int GetPerkPoints() Returns the number of perk points available to the player.
SetPerkPoints(Int perkPoints) Sets the number of perk points available to the player.
ModPerkPoints(Int perkPoints) Changes the number of perk points available to the player by the specified amount.
SetGameSettingBool(String setting, Bool value) Changes the value of boolean Game Settings.
SetGameSettingInt(String setting, Int value) Changes the value of integer Game Settings.
SetGameSettingFloat(String setting, Float value) Changes the value of float Game Settings.
SetGameSettingString(String setting, String value) Changes the value of string Game Settings.
Int GetModCount() Returns the number of mods currently active.
String GetModName(Int modIndex) Returns the mods name at the specified index.
String GetModAuthor(Int modIndex) Returns the specified mod's author.
String GetModDescription(Int modIndex) Returns the specified mod's description.
Int GetModDependencyCount(Int modIndex) Returns the dependency count of the specified mod.
Int GetNthModDependency(Int modIndex, Int n) Returns the mod index of the specified Dependency.
Int GetCameraState() Returns the character's current camera state.(0 - first person;1 - auto vanity;2 - VATS;3 - free;4 - iron sights;5 - furniture;6 - transition;7 - tweenmenu;8 - third person 1;9 - third person 2;10 - horse;11 - bleedout;12 - dragon)
SaveGame(String name) Saves the game with the specified name.
LoadGame(String name) Loads the save with the specified name.
Int GetNumTintMasks() Returns the total number of tints for the player.
Int GetNthTintMaskColor(Int n) Returns the color of the Nth tint mask.
Int GetNthTintMaskType(Int n) Returns the type of the Nth tint mask.
Int SetNthTintMaskColor(Int n, Int color) Sets the color of the Nth tint mask.
String GetNthTintMaskTexturePath(Int n) Returns the texture path of the Nth tint mask.
SetNthTintMaskTexturePath(Int n) Sets the texturepath of the Nth tint mask.
Int GetNumTintsByType(Int type) Returns how many indexes there are for this type.
Int GetTintMaskColor(Int type, Int index) Returns the color for the particular tintMask type and index.
SetTintMaskColor(Int color, Int type, Int index) Sets the tintMask color for the particular type and index
UpdateHairColor() Instantly updates the player's hair color.
Int GetSkillLegendaryLevel(String actorValue) Returns the legendary level for the skill
SetSkillLegendaryLevel(String actorValue, Int level) Sets the legendary level for the skill.