Package openmw.selfΒΆ

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')
if self.type == '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 standart AI (enabled by default).

self:getCombatTarget()

Returns current target or nil if not in combat

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)

self:startCombat(target)

Attack target.

self:stopCombat()

Remove all combat packages from the actor.

Type ActorControls

ActorControls.jump

If true - initiate a jump

ActorControls.movement

+1 - move forward, -1 - move backward

ActorControls.run

true - run, false - walk

ActorControls.sideMovement

+1 - move right, -1 - move left

ActorControls.turn

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 standart AI (enabled by default).

Parameter

  • #boolean v :

self:getCombatTarget()

Returns current target or nil if not in combat

Return value

openmw.core#GameObject:

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)

self:startCombat(target)

Attack target.

Parameter

self:stopCombat()

Remove all combat packages from the actor.

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

#boolean ActorControls.run

true - run, false - walk

#number ActorControls.sideMovement

+1 - move right, -1 - move left

#number ActorControls.turn

Turn right (radians); if negative - turn left