Skip to content
aubergine10 edited this page Oct 19, 2015 · 1 revision

This property requires further investigation

Bug: Setting the value of this property can crash the game

##Overview

[Avatar](Avatar (Entity)) [Prisoner](Prisoner (Entity))

In escape mode, this property of Prisoner and Avatar entity objects indicates whether the player can or is controlling them (not sure which yet).

##Syntax

-- get
local userCanControl = someEntity.AvatarControl -- <value>

-- set
someEntity.AvatarControl = <value> -- does not seem to work

Where someEntity is either a Prisoner or Avatar type of entity, and <value> can be one of the following:

  • true - the player can control the entity
  • false - the player can not control the entity
  • nil - equivalent meaning to false

Setting the value of this property generally has no effect, other than sometimes crashing the game (eg. if you try setting it on a Warden object). As such it should be treated as a read-only property.

##Example

-- find all .AvatarControl entities

local controllable = {} -- to store the list

local function AddToList( type, list )

  local entities = this.GetNearbyObjects( type, 9001 )

  for entity in next, entities do
    if entity.AvatarControl then
      controllable[ #controllable + 1 ] = entity
    end
  end

end

AddToList( 'Prisoner' )
AddToList(  'Avatar'  )

##Notes

The Avatar represents the entity that the user was initially playing as, and any Prisoner entities with the property will have been added to the players group (and can also be controlled by the player, even if the original Avatar entity is killed and removed from the map).

##See Also

^ Open "Pages" to Search



Guides:

  • [Lua Basics](Lua Basics Guide)
  • [Save-Load Cycle](Save-Load Cycle Guide)

[Globals](Object Globals):

  • [Game](Game (Global))
  • [me](me (Global))
  • [Object](Object (Global))
  • [this](this (Global))

[Events](Object Events):

Psuedo-Types:

  • [Rotation table](Rotation table)
  • [Id table](Id table)
  • [Location table](Location table)
  • [Velocity table](Velocity table)

[Methods](Object Methods):

[Properties](Object Properties):

Clone this wiki locally