Skip to content
aubergine10 edited this page Dec 6, 2015 · 7 revisions

##Overview

This property is found on [Prisoner](Prisoner (Entity)) entities and can be used to determine which of their "Needs" are currently unmet.

##Syntax

The property contains a table with each applicable need as a sub-property:

-- get:
local someNeed = somePrisoner.Needs.<someNeed> -- nil or <number>

-- set:
somePrisoner.Needs.<someNeed> = <number>

Where:

  • <someNeed> is the string name for a Need (see "Needs" section below for a list)
  • <number> is an integer >= 0
    • 0 means the need is fully satisfied
    • any higher value means the need is outstanding

Note that the .Needs.Alcohol and .Needs.Drugs needs will be nil if the prisoner does not have the required traits. Trying to set the values of the needs in such a scenario will cause an error so you need to check that these specific needs exist before doing anything with them, for example:

-- getting:
local alcoholNeed = somePrisoner.Needs.Alcohol or 0 -- default to 0 if nil

-- setting:
if somePrisoner.Needs.Alcohol then -- need exists so we can get/set it
  somePrisoner.Needs.Alcohol = 100
end

###Needs

A list of common needs is shown below (based on PA 1.0, does not yet include some new needs added in Update 1):

  • .Needs.Alcohol
  • .Needs.Bowels
  • .Needs.Bladder
  • .Needs.Clothing
  • .Needs.Comfort
  • .Needs.Drugs
  • .Needs.Environment
  • .Needs.Exercise
  • .Needs.Family
  • .Needs.Food
  • .Needs.Freedom
  • .Needs.Hygiene
  • .Needs.Literacy
  • .Needs.Privacy
  • .Needs.Recreation
  • .Needs.Safety
  • .Needs.Sleep
  • .Needs.Spirituality

It's also possible to add custom Needs via data/needs.txt.

##Example

todo

##Notes

todo

##See Also

todo

^ 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