Player

Part of openmw.types

Usage:

local Player = require('openmw.types').Player

Type types

types.Player

#Player functions

Type Player

Player.baseType

#NPC

Player.getCrimeLevel(player)

Returns the bounty or crime level of the player

Player.objectIsInstance(object)

Whether the object is a player.

Player.quests(player)

Returns a list containing quests #PlayerQuest for the specified player, indexed by quest ID.

Type PlayerQuest

PlayerQuest:addJournalEntry(stage, actor)

Sets the quest stage for the given quest, on the given player, and adds the entry to the journal, if there is an entry at the specified stage.

PlayerQuest.finished

Whether the quest is finished (global and player scripts can change it).

PlayerQuest.id

The quest id.

PlayerQuest.stage

The quest stage (global and player scripts can change it). Changing the stage starts the quest if it wasn't started.

PlayerQuest.started

Whether the quest is started.

Type types

Field(s)

#Player types.Player

#Player functions

Type NPC

Type Player

Extends #NPC

Field(s)

#NPC Player.baseType

#NPC

Player.getCrimeLevel(player)

Returns the bounty or crime level of the player

Parameter

Return value

#number:

Player.objectIsInstance(object)

Whether the object is a player.

Parameter

Return value

#boolean:

Player.quests(player)

Returns a list containing quests #PlayerQuest for the specified player, indexed by quest ID.

Parameter

Return value

#list<#PlayerQuest>:

Usages:

  • -- Get stage of a specific quest
    stage = types.Player.quests(player)["ms_fargothring"].stage
  • -- Get names of all started quests
    for x, quest in pairs(types.Player.quests(player)) do print (quest.name) end
  • -- Start a new quest, add it to the player's quest list but don't add any journal entries
    types.Player.quests(player)["ms_fargothring"].stage = 0

Type PlayerQuest

Field(s)

PlayerQuest:addJournalEntry(stage, actor)

Sets the quest stage for the given quest, on the given player, and adds the entry to the journal, if there is an entry at the specified stage.

Can only be used in global or player scripts.

Parameters

  • #number stage : Quest stage

  • openmw.core#GameObject actor : (optional) The actor who is the source of the journal entry, it may be used in journal entries with variables such as %name(The speaker's name) or %race(The speaker's race).

#bool PlayerQuest.finished

Whether the quest is finished (global and player scripts can change it).

#string PlayerQuest.id

The quest id.

#number PlayerQuest.stage

The quest stage (global and player scripts can change it). Changing the stage starts the quest if it wasn't started.

#bool PlayerQuest.started

Whether the quest is started.

Type bool