DisablePlayerControls - Game

From the CreationKit Wiki
Jump to navigation Jump to search

Member of: Game Script

Selectively disables the player's controls.

Syntax[edit | edit source]

Function DisablePlayerControls(bool abMovement = true, bool abFighting = true, bool abCamSwitch = false, \
  bool abLooking = false, bool abSneaking = false, bool abMenu = true, bool abActivate = true, bool abJournalTabs = false, \
  int aiDisablePOVType = 0) native global

Parameters[edit | edit source]

  • abMovement: Disable the player's movement controls.
    • Default: True
  • abFighting: Disable the player's combat controls.
    • Default: True
  • abCamSwitch: Disable the ability to switch point of view.
    • Default: False
  • abLooking: Disable the player's look controls.
    • Default: False
  • abSneaking: Disable the player's sneak controls. This will make the player stand up if they are currently sneaking. Disabling movement controls also disables sneaking.
    • Default: False
  • abMenu: Disables menu controls (Journal, Inventory, Pause, etc.).
    • Default: True
  • abActivate: Disables ability for player to activate objects.
    • Default: True
  • abJournalTabs: Disables all Journal tabs except System.
    • Default: False
  • aiDisablePOVType: What system is disabling POV.
    • 0 = Script
    • 1 = Werewolf
    • Default: 0

Return Value[edit | edit source]


Examples[edit | edit source]

; Disable movement and combat

; Disable just camera switching
Game.DisablePlayerControls(false, false, true, false, false, false, false)

Notes[edit | edit source]

  • Disabling movement also disables the UI (at least partially), and other actors can't attack a player with a disabled movement. You may want to consider using Game.GetPlayer().SetDontMove() or Game.GetPlayer().SetRestrained() instead.
  • Disabling player movement also disables the ability for the player to activate objects.
  • If you disable movement while the hud is in "cart mode" (via SetHudCartMode()) then the "cart mode" will be lost until you re-enable movement again.
  • This can be used if you want to close in game menus and other screens opened by player. Simply call this then enable back the controls. Tested with player inventory and opened books. Doesn't seem to work on containers.
  • If this is called immediately on quest start as the result of an OnInit firing, this function will not fire.

See Also[edit | edit source]