obj.Misbehaviour - originalfoo/Prison-Architect-API GitHub Wiki

PA Bug #9969 - different primitive types when getting vs. setting

##Overview

The .Misbehaviour property is specific to Prisoner entities and defines how they are misbehaving.

##Syntax

-- get:
local misbehaviour = somePrisoner.Misbehaviour -- <string>

-- set:
somePrisoner.Misbehaviour = <number>

When getting the value, a string will be returned (needs more testing to find all applicable values), but when setting you have to use a number instead:

  • 0 = 'None' - No misbehaviour
  • 1 = 'Misbehaving' Start fighting, spoiling, or destroying randomly.
  • 2 = 'Escaping' Run for freedom.
  • 3 = 'Destroying' Attack objects nearby.
  • 4 = 'Spoiling' Be hostile to random target, either entity or not, therefore soon becomes destroying or fighting.
  • 5 = 'Fighting' Set TargetObject.u and .i to make the prisoner attack specific target. Or they will attack someone nearby randomly.
  • 6 = 'Rioting'
  • 7 = 'HostageTaking', but they don't actually do anything. TargetObject won't help it work.
  • 8 = ? Prisoner puts hands up like fighting, but doesn't actually fight; Guards will attack them

##Example

-- start a riot

local find  = this.GetNearbyObjects
local range = 10

for prisoner in next, find( 'Prisoner', range ) do
  prisoner.Misbehaviour = 6
end

##Notes

##See Also

⚠️ **GitHub.com Fallback** ⚠️