Package openmw.selfΒΆ

OpenMW version: 0.49.0
core.API_REVISION: 59 *

openmw.self provides full access to the object the script is attached to.

Can be used only from local scripts. All fields and function of GameObject are also available for openmw.self.

Usage:

local self = require('openmw.self')
local types = require('openmw.types')
if self.type == types.Player then  -- All fields and functions of `GameObject` are available.
    self:sendEvent("something", self.position)
end

Type self

self.controls

Movement controls (only for actors)

self:enableAI(v)

Enables or disables standard AI (enabled by default).

self:isActive()

Returns true if the script isActive (the object it is attached to is in an active cell).

self.object

The object the script is attached to (readonly)

Type ActorControls

ActorControls.jump

If true - initiate a jump

ActorControls.movement

+1 - move forward, -1 - move backward

ActorControls.pitchChange

Look down (radians); if negative - look up

ActorControls.run

true - run, false - walk

ActorControls.sideMovement

+1 - move right, -1 - move left

ActorControls.sneak

If true - sneak

ActorControls.use

if 1 - activates the readied weapon/spell. For weapons, keeping at 1 will charge the attack until set to 0.

ActorControls.yawChange

Turn right (radians); if negative - turn left

Type self

Extends openmw.core#GameObject

Field(s)

#ActorControls self.controls

Movement controls (only for actors)

self:enableAI(v)

Enables or disables standard AI (enabled by default).

Parameter

  • #boolean v :

self:isActive()

Returns true if the script isActive (the object it is attached to is in an active cell).

If it is not active, then openmw.nearby can not be used.

Return value

#boolean:

openmw.core#GameObject self.object

The object the script is attached to (readonly)

Type ActorControls

Allows to view and/or modify controls of an actor.

All fields are mutable.

Field(s)

#boolean ActorControls.jump

If true - initiate a jump

#number ActorControls.movement

+1 - move forward, -1 - move backward

#number ActorControls.pitchChange

Look down (radians); if negative - look up

#boolean ActorControls.run

true - run, false - walk

#number ActorControls.sideMovement

+1 - move right, -1 - move left

#boolean ActorControls.sneak

If true - sneak

#number ActorControls.use

if 1 - activates the readied weapon/spell. For weapons, keeping at 1 will charge the attack until set to 0.

#number ActorControls.yawChange

Turn right (radians); if negative - turn left