DisablePlayerControlsAltEx

From GECK
Jump to: navigation, search


A function added by the New Vegas Script Extender version 6.3.2.

Description

Disables some or all of the player's controls.

Unlike DisablePlayerControls, the changes are NOT savebaked, and are cleared whenever a save is loaded.

  • Consider using GetGameLoaded to re-apply changes, or something similar.

Furthermore, disabling is stored on a per-mod basis, so if two mods disable a control at some point, it will be disabled until both of them re-enable it, or until the save is reloaded.

  • This makes it easier to keep mods that disable controls compatible with each other.

Unlike DisablePlayerControlsAlt, this function takes a single arg, flags. It is a Bitmask, with each bit representing a flag for a control to disable. See the Flag Definitions section for more info.

Default (no parameters) is equivalent to:

 DisablePlayerControlsAltEx ((1 << 0) | (1 << 2) | (1 << 3) | (1 << 4)) 
 ; Movement, Pipboy, Fighting and POV controls are disabled

If you are unfamiliar with the binary OR operator, "|", or the binary bit-shifting operator "<<", see the NVSE Expressions page. This example also makes use of an Inline Expression.

Syntax

[help]
DisablePlayerControlsAltEx flags:int

Example

DisablePlayerControlsAltEx

Player's Movement, Pipboy, Fighting and POV controls are disabled, but everything else is unaffected.

DisablePlayerControlsAltEx (1 << 3)

Player's ability to equip or use a weapon is disabled; all other controls are unaffected. Equivalent to using DisablePlayerControlsAlt like so:

DisablePlayerControlsAlt 0 0 1 0 0

Note that the flag # used in DisablePlayerControlsAltEx and the arg position used in DisablePlayerControlsAlt do not match in this example; the Fighting flag is the fourth bit (bit #3, remember that bit #0 is the first), but it is the third arg in DisablePlayerControlsAlt. this is intentional, because the vanilla game itself has the bits ordered in a separate way than how the args were ordered for DisablePlayerControls.

Flag Definitions

Flag Names
Bit Value Description
Movement 1 << 0 Player movement is disabled. Activation of world objects is disabled. HUD is partially disabled: Action Points, Health, Crosshair.
Looking 1 << 1 Player looking is disabled -- the player's view is locked into its current position.
Pipboy 1 << 2 Player cannot bring up the pip-boy interface. The "Wait" menu will also be disabled.
Fighting 1 << 3 Player cannot bring up a weapon. If the player currently has a weapon out, the weapon will be holstered.
POV 1 << 4 Player cannot go into 3rd person view. If currently in 3rd person, the view is forced into first person.
RolloverText 1 << 5 No rollover text on world objects.
Sneaking 1 << 6 Player cannot go into sneak mode. If currently sneaking, forces you out of sneak mode.
//== New custom flags
Attacking 1 << 7 Prevents the player from attacking with their weapon, but they can still draw it out.
EnterVATS 1 << 8 Prevents the player from opening VATS.
Jumping 1 << 9 Prevents the player from jumping.
AimingOrBlocking 1 << 10 Prevents the player from aiming or blocking with their weapon.
Running 1 << 11 Prevents the player from running; they will be forced to slowly walk.
Sleeping 1 << 12 Prevents the player from sleeping. New in v6.3.5.
Waiting 1 << 13 Prevents the player from waiting. New in v6.3.5.
FastTravel 1 << 14 Prevents the player from fast travelling. New in v6.3.5.

See Also