[HELP NEEDED] Checking needs of prisoners.

Discussion about Mods for Prison Architect

Moderator: NBJeff

User avatar
Alpatron
level1
level1
Posts: 38
Joined: Tue Dec 24, 2013 10:52 pm
Location: The Czech Republic

[HELP NEEDED] Checking needs of prisoners.

Postby Alpatron » Fri Mar 31, 2017 6:17 pm

So, I've been modifying a mod (this one). My goal is that when a drug or alcohol addicted prisoner is near the sensor that the prisoners security level will be changed.
The problem is that the script refuses to work and refuses to read the needs of the prisoners.
The game throws at me this error.
Image

Code: Select all

local prisoners = Object.GetNearbyObjects(this, "Prisoner", 10);
if prisoners~=nil then
   for name,dist in pairs( prisoners ) do
      if (name.Needs.Drugs~=nil or name.Needs.Alcohol~=nil) and name.Category~='DeathRow' then
         Object.SetProperty(name,"Category",4);
      end
   end
end
K4jot7x
level0
Posts: 9
Joined: Mon Oct 06, 2014 5:40 pm
Location: javascript:location.href('#')
Contact:

Re: [HELP NEEDED] Checking needs of prisoners.

Postby K4jot7x » Fri Jun 23, 2017 4:04 am

its dirty hack but add to needs.txt actions responses to needs (not) getting fulfilled to interact with a scripted object. have it scan for prisoners attacking/using it.. its good to add something like cigarette machine or kitchen sink/heating/bin/lamp (where you store your stash in prison)

if they are addicts.. they will Use objects like lamps (to store stash)

http://devwiki.introversion.co.uk/pa/in ... uide#Needs

you detect the object in use slot by adding this to the item being used. Pa dont use it. and only some modders been adding that

Slot.u == prisoner.Id.u Slot.i == prisoner.Id.i sees which prisoner is stashing items.. see that link

BEGIN Provider
Slot 0
END

the mod will immediately no the prisoner has the addiction, but you'll prolly only want take action on urine tests/etc

if you're the one that does the addictions mod let me no.. the people will want some real thing.. not just immediately detect and change sec level.. add wired objects.. methods... drug screens.. CODE CODE CODE

if you cant code or something thats fine.. I'm adding this to mine now :P
TLDPA
level0
Posts: 1
Joined: Thu Jul 09, 2015 10:10 am

Re: [HELP NEEDED] Checking needs of prisoners.

Postby TLDPA » Mon Aug 28, 2017 11:34 am

Did you ever get this to work? I'm having the exact same issue reading needs. Returns nil.

Return to “Modding”

Who is online

Users browsing this forum: No registered users and 7 guests