Skip to content

tes3game⚓︎

A core game object used for storing game settings.

Properties⚓︎

activationAmbientLight⚓︎

Read-only. An ambiental light inside the worldObjectRoot.

Returns:


debugRoot⚓︎

Read-only. Access to the root of the scene graph of the Debug menu layer.

Returns:


fogProperty⚓︎

Read-only. No description yet available.

Returns:


parentWindowHandle⚓︎

Read-only. The Windows HWND for the parent window.

Returns:

  • result (number)

playerTarget⚓︎

Read-only. The current activation target.

Returns:


renderDistance⚓︎

The game's rendering distance.

Returns:

  • result (number)

sceneGraphCollideString⚓︎

Read-only. No description yet available.

Returns:


sceneGraphGridString⚓︎

Read-only. No description yet available.

Returns:


sceneGraphTextureString⚓︎

Read-only. No description yet available.

Returns:


screenShotsEnabled⚓︎

State on if screenshots are enabled.

Returns:

  • result (boolean)

screenX⚓︎

Read-only. The screen's horizontal position.

Returns:

  • result (number)

screenY⚓︎

Read-only. The screen's vertical position.

Returns:

  • result (number)

soundQuality⚓︎

Sound quality level.

Returns:

  • result (number)

volumeEffect⚓︎

Mix volumes for effects.

Returns:

  • result (number)

volumeFootsteps⚓︎

Mix volumes for footsteps.

Returns:

  • result (number)

volumeMaster⚓︎

Mix volumes for all sounds.

Returns:

  • result (number)

volumeMedia⚓︎

Mix volumes for music.

Returns:

  • result (number)

volumeVoice⚓︎

Mix volumes for voices.

Returns:

  • result (number)

windowHandle⚓︎

Read-only. The Windows HWND for the window.

Returns:

  • result (number)

wireframeProperty⚓︎

Read-only. The reused wireframe property, applied when toggling wireframe rendering.

Returns:


worldLandscapeRoot⚓︎

Read-only. Access to the root of the scene graph of all the currently loaded terrain. It's nine cells in total when the player is in exterior cell. While the player is in interior cell this node is culled.

Returns:


worldObjectRoot⚓︎

Read-only. Access to the root of the scene graph containing all the static objects, and lights that can't be picked up. In addition, the player's scene graph is a child node of this root node.

Returns:


worldPickRoot⚓︎

Read-only. Access to the root of the scene graph containing all the objects that can be interacted with (NPCs, items, harvestable plants, activators, doors...), but also some objects that are only rendered in the Construction Set such as sound emmiting activator objects with EditorMarker.NIF mesh.

Returns:


worldRoot⚓︎

Read-only. Access to the root of the world scene graph. Contains all the 3D geometry. All the other available world root nodes are child nodes of the world root.

Returns:


Methods⚓︎

clearTarget⚓︎

Clears data related to activation, resetting what the player can activate.

myObject:clearTarget()
Example: Resetting the activation tooltip text after untrapping a door
---@param reference tes3reference
---@return boolean untrapped
local function untrap(reference)
    local object = reference.object

    -- Skip objects that can't be trapped.
    if object.objectType ~= tes3.objectType.door
    or object.objectType ~= tes3.objectType.container then
        return false
    end

    tes3.setTrap({
        reference = reference,
        spell = nil
    })
    -- Let the game update the activation tooltip otherwise,
    -- the tooltip would still say "Trapped".
    tes3.game:clearTarget()

    return true
end

-- To test aim at a trapped door or container and press "u" key.
local function onKeyDown()
    -- Get the player's target and apply it's spell
    -- on the player if it's trapped.

    local target = tes3.getPlayerTarget()
    if not target then return end

    untrap(target)
end
event.register(tes3.event.keyDown, onKeyDown, { filter = tes3.scanCode.u })

savePlayerOptions⚓︎

Saves all options menu settings, including those changed by editing controller variables. Writes to the Windows registry.

Options saved:

  • Difficulty and AI distance
  • Render distance and actor shadow options
  • Volume controls and subtitles
  • All keybinds and mouse sensitivity
  • Use best attack mode and save on rest mode
  • Tooltip delay and menu background alpha
myObject:savePlayerOptions()

setGamma⚓︎

This method allows changing gamma correction.

myObject:setGamma(value)

Parameters:

  • value (number)