Can I change prisoners security based on reform grade?

Discussion about Mods for Prison Architect

Moderator: NBJeff

yuk
level2
level2
Posts: 172
Joined: Fri May 20, 2016 5:47 pm

Re: Can I change prisoners security based on reform grade?

Postby yuk » Tue Aug 09, 2016 8:49 am

elDiablo wrote:Just a quick reply to a few things in this post:

- In regards to the reoffending rate, it is calculated per prisoner using a pretty complex formula based on their experience in the prison and a lot more. I could add a (read-only) value to the prisoner's table to return this calculated value if people want. The reason it's missing at the moment is that all shown variables are member variables of the prisoner (or WorldObject) class that we hold in a data registry for quick loading/saving/lookup/etc. As the reoffending rate isn't a variable, it doesn't exist in there. Shouldn't be too much to get the grade as a read only variable though.


YES that would be AMAZING!!! Thank you so much!! :D It's such an important part it would be good to have it accessible to modders :D. Are you able to make their attributes accessible too so we can get mods to find volatile or instigating prisoners?

elDiablo wrote:- The save file is the way it is due to legacy. One thing we decided was important very early on in PAs development was the ability to have a save file work all the way through development. We never wanted to say to people, "oh, by the way, that prison you spent 100 hours on? Yeah, that's gone...". This, combined with the way the systems work in the game (for example, the water system keeps it own information separate from the cells it affects), mean that the save file does have a lot of duplication, as you pointed out, of x,y position. It's a trade off we made to have the compatibility over a save file increase. We also write it out as plain text (rather than binary format) so that it is human readable and players can look through and play with it if they want.

Hope that lets you know our thoughts on why some things are the way they are :)


Why not have a legacy save reader that converts prisons to a new save file? I worry because I want to have MEGA prisons but I'm afraid of crashing (which happens on my i7 64 bit with 16GB ram at times).
User avatar
Medu_Salem
level1
level1
Posts: 46
Joined: Fri May 16, 2014 6:42 pm

Re: Can I change prisoners security based on reform grade?

Postby Medu_Salem » Tue Aug 09, 2016 3:27 pm

elDiablo wrote:Just a quick reply to a few things in this post:

- In regards to the reoffending rate, it is calculated per prisoner using a pretty complex formula based on their experience in the prison and a lot more. I could add a (read-only) value to the prisoner's table to return this calculated value if people want. The reason it's missing at the moment is that all shown variables are member variables of the prisoner (or WorldObject) class that we hold in a data registry for quick loading/saving/lookup/etc. As the reoffending rate isn't a variable, it doesn't exist in there. Shouldn't be too much to get the grade as a read only variable though.


Ah well... I already figured as much... because pretty many values "available for query" are found directly inside the savefile with the exact same name (and structure)... which is why I came to the conclusion that the mapped variables are almost identical to the representation of the save file format... which is how I found certain variables to use within Lua Scripts in the first place since most of them are nowhere documented yet. That said... not everything works or returns a value.

And yeah... it would be pretty awesome if most of the values the game uses internally would be added at least as "read-only" values to the specific object's table... one can never have enough information about what's currently going on with all the objects or globally in the world.

Would it also be in the range of possibilities that the current amount of prisoners per security level and the current cell capacity per security gets added as "read-only" values?

Because the mod I'm writing is experiencing a nasty stutter every time I have to use "Object.GetNearbyObjects(this, "Prisoner", <Worlddiagonal>)"... just to get ALL current prisoners on the map to be able to count the amount of prisoners per security level manually. The lag is about 0.3-0.6 seconds every time just to map the entire prisoner table (yeah I timed it using Game.Time() difference of time before and after querying).

If the current amount of prisoners per sec level and current capacity per sec level values could be queried the global World object in a way something like following:

World.Prisoners.MinSec
World.Prisoners.Normal
World.Prisoners.MaxSec
World.Prisoners.SuperMax
World.Prisoners.Protected
World.Prisoners.DeathRow

World.Capacity.MinSec
World.Capacity.Normal
World.Capacity.MaxSec
World.Capacity.SuperMax
World.Capacity.Protected
World.Capacity.DeathRow

... that would be awesome.

Then the stuttering my mod causes every now and then would be gone as I wouldn't have to get the entire prisoner list anymore to be up to date for the things I want to do. I would really appreciate that... especially if I ever intend to release the mod to Steam because otherwise people might complain about the lag every now and then and there's absolutely nothing I can do about it. :D



elDiablo wrote:- The save file is the way it is due to legacy. One thing we decided was important very early on in PAs development was the ability to have a save file work all the way through development. We never wanted to say to people, "oh, by the way, that prison you spent 100 hours on? Yeah, that's gone...". This, combined with the way the systems work in the game (for example, the water system keeps it own information separate from the cells it affects), mean that the save file does have a lot of duplication, as you pointed out, of x,y position. It's a trade off we made to have the compatibility over a save file increase. We also write it out as plain text (rather than binary format) so that it is human readable and players can look through and play with it if they want.

Hope that lets you know our thoughts on why some things are the way they are :)


Yeah, I thought about the "Legacy" and "Compatibility" issue... but shouldn't there be a legacy/compatibility branch in every game (or programs in general) for something like savegame/file loading? One that looks which version the savegame was saved with, use that old version's loading mechanism to gather the gamestate... and upon saving store it to the new save file structure? And every now and then "cutoff" the support for very old versions?

At least that's how most other games do it... otherwise the mess stays forever which is probably hardcore for code maintenance. Factorio does it that way for example. If your map is too old you are out of luck... and that's not particularly a bad thing in my opinion.

In real life I mainly studied Construction Engineering and Architecture (besides Electrical Engineering and a small part of IT)... and while a lot of my professors used to be like "But the building is old and represents traditions and it should be maintained/conserved whatnot!"... I often replied "Yeah, surely that justifies to keep it on lifesupport forever until it collapses in itself burying people alive."

So every now and then it's okay to tear things down and build them from scratch. That's how life is...



yuk wrote:For example...this one is called Reformery, but I've since learned how to make dorms better (look at my max sec area) so I started a new prison to give that a go. The prisoner flow is not so 100% in my new prison but I am working on it.
http://imgur.com/a/pl4BX

The schedule there goes that lockup is 12-6, then shower, then lockup. This ensures everyone in the dorm has showered while giving them time to tend to other needs. They then go to yard for 1 hour then into eat. After eating they go to work for 4 hours. After work they lockup for 2 and freetime for 2 (this ensures everyone is in their own cell and won't travel to the closest and overflow them) then back to work (with all their needs met) for 3 hours. Finally they eat for 2 and then lockup again. It works very well.

All my canteens have toilet and shower blocks in them. My yards too. Both yards and canteens have phones. Dorms have radios and tvs etc so I don't like to add them elsewhere (so the rooms grade well). I usually prefer all prisoners to go through an infirmary to get to a canteen or their doorms but this prison I tried something different (and regretted it greatly). I like to feed them before bed so they don't wake up pissed and cause shit.


Looks pretty neat... and huge. I like the central Canteen!

Though I avoid using Dormitories currently because they are still bugged out in Update 7c (which I'm playing on) when it comes to their room grading. The bug seemingly has been fixed for Update 8, at least Icepick put my Bug Report to "Solved" on Mantis, but I'm still waiting for an updated Preview Build or final Update 8 to be released at the and of the month so more bugs are fixed.

Also the Prisoner's Privacy Need suffers badly using Dormitories. I can't deal with how imbalanced that is... Because even if you have 2x2 cells (Smaller than normally required 2x3) the prisoners aren't complaining about anything as long as the cell is the average room grade... but even if you build a dormitory with 6 tiles PER prisoner they are complaining about privacy. That's why I am not using Dormitories. I don't want to provoke fights between the room mates just because the system is not well balanced. I think someone did some practical research and found out that the Privacy Need doesn't suffer if there is at least 12 tiles PER prisoner in the Dormitory... but that's completely insane in my opinion, just like 16 tiles for a single prisoner Cell is badly balanced (it should be 15 or even better 12 since every item fits within 12 tile cells anyways) and the main reason for why I'd never do that (except maybe for the 3 Gang leaders to force them there).

I think that the Privacy need should suffer, yes, but it shouldn't suffer if there are at least 6-8, maybe 9 tiles per prisoner in the dormitory. Otherwise building a dormitory doesn't make sense as it would require more space overhead just to make the prisoners feel "okay" than it would require if you would just build a lot of single 2x3 cells, which then defeats the purpose of even building a Dormitory. Because hypothetically you can put the same amount of prisoners in the same space using single cells and have happier prisoners than using Dormitories and having unhappy prisoners.



yuk wrote:OI tried using a shared space with rotating schedule but the issue is supermax won't work and there's nothing else for them to do...so they go into the canteen or the yard and wander around. They are SO FRUSTRATING. Your system sounds amazing! I'd love to see it :D. What's an airlock? Sounds interesting I may experiment with zoned hallways/doors to see how that turns out too :D.


Yeah the SuperMax people are a problem... or let's say the Gang Members are the problem. Too bad there is no reform program to convince some of them to leave their gang life behind. There should be something like that and if they successfully leave their gang they would be marked with the Ex Gang Member trait and become a target for every other Gang Member in the prison, so from there on you'd have to put them in Protective Custody and they'd behave like other Protective Custody prisoners.
I would mod something like that into the game, I already looked into doing it but the problem is that:

  1. You can't get or edit Reputations, Bio Information, finished Reform Programs or Misconducts etc in general
  2. You can't call/run a Lua script once a reform program is finished to decide/determine what to do next with the prisoner or whatever. Would be nice if such a thing was possible for various things (like Reform Programs, Research, Production, Needs etc)
  3. You can't edit which prisoners are to be called to a reform program (for example the game internally uses Alcoholism/DrugAddiction/Parole as referrals for the more advanced reform programs that don't depend on a need, but you can't add such a referral to a prisoner, which means you can't call out for gang members or whatever else who you want to refer to/call out for)
  4. Several other small problems I encountered while evaluating the implementation but that I already forgot about.


With my current prison the working class is only MinSec, Normal, MaxSec in 3 shift rotation... like I mentioned earlier: 0:00-4:00 MinSec, 4:00-8:00 Normal, 8:00-12:00 MaxSec, 12:00-16:00 MinSec, 16:00-20:00 Normal, 20:00-24:00 MaxSec, and Eat/Sleep/Yard/LockUp in the 8 hours between each workshift. The SuperMax are mostly locked down and the other time they are either eating or in the yard. Each Security level has only 1 hour of free time in my regime. More than that causes malus points in the prisoner's grading from what I eperienced. But then again the point system is not really explained anywhere so you have to figure everything out yourself.

In another prison of mine I'm also trying out a 4 shift rotation including SuperMax. 0:00-3:00 MinSec, 3:00-6:00 Normal, 6:00-9:00 MaxSec, 9:00-12:00 SuperMax, 12:00-15:00 MinSec, 15:00-18:00 Normal, 18:00-21:00 MaxSec, 21:00-24:00 SuperMax... and again Eat/Sleep/Lockdown/Yard in between each workshift. This prison is currently working together with the Mod I'm working on.. The mod detects when someone is in Solitary for Misconducts and shifts the prisoner automatically one Category up (if there is space in the target Category that is). The mod also detects if someone is behaving for more than a couple of days and shifts the Prisoner down one Category. So almost everyone with <3 days without Misconduct ends up in SuperMax, 3-6 days in MaxSec, 6-9 Days in Normal, >9 in MinSec. The thresholds and if a category is allowed to recategorized in the first place are configureable with buttons on the Controller Item one has to place.


As for the Airlock... when you place 2 doors directly in following each other (not next to each other) then the game will recognize the tile in between those two doors as it's own small room... which allows you to put a Deployment zone there. So you can mark that Tile with MinSec (or whatever else) for example and only MinSec prisoners can go through that tile. That way you can filter out the prisoner types you want to go through the doors. But you need such an "Airlock" for each Security level you want to pass... so sometimes you need multiple such airlocks next to each other for each security level you want to go through there from one shared zone to another shared zone. I wish I could provide a picture link now, but I would have to upload one somewhere.

yuk wrote:
elDiablo wrote:Just a quick reply to a few things in this post:

- In regards to the reoffending rate, it is calculated per prisoner using a pretty complex formula based on their experience in the prison and a lot more. I could add a (read-only) value to the prisoner's table to return this calculated value if people want. The reason it's missing at the moment is that all shown variables are member variables of the prisoner (or WorldObject) class that we hold in a data registry for quick loading/saving/lookup/etc. As the reoffending rate isn't a variable, it doesn't exist in there. Shouldn't be too much to get the grade as a read only variable though.


YES that would be AMAZING!!! Thank you so much!! :D It's such an important part it would be good to have it accessible to modders :D. Are you able to make their attributes accessible too so we can get mods to find volatile or instigating prisoners?


THAT too... additionally to my own request of current prisoners per Sec level and prisoner capacity per Sec level!
yuk
level2
level2
Posts: 172
Joined: Fri May 20, 2016 5:47 pm

Re: Can I change prisoners security based on reform grade?

Postby yuk » Wed Aug 10, 2016 9:23 am

Medu_Salem wrote:
yuk wrote:For example...this one is called Reformery, but I've since learned how to make dorms better (look at my max sec area) so I started a new prison to give that a go. The prisoner flow is not so 100% in my new prison but I am working on it.
http://imgur.com/a/pl4BX

The schedule there goes that lockup is 12-6, then shower, then lockup. This ensures everyone in the dorm has showered while giving them time to tend to other needs. They then go to yard for 1 hour then into eat. After eating they go to work for 4 hours. After work they lockup for 2 and freetime for 2 (this ensures everyone is in their own cell and won't travel to the closest and overflow them) then back to work (with all their needs met) for 3 hours. Finally they eat for 2 and then lockup again. It works very well.

All my canteens have toilet and shower blocks in them. My yards too. Both yards and canteens have phones. Dorms have radios and tvs etc so I don't like to add them elsewhere (so the rooms grade well). I usually prefer all prisoners to go through an infirmary to get to a canteen or their doorms but this prison I tried something different (and regretted it greatly). I like to feed them before bed so they don't wake up pissed and cause shit.


Looks pretty neat... and huge. I like the central Canteen!

Though I avoid using Dormitories currently because they are still bugged out in Update 7c (which I'm playing on) when it comes to their room grading. The bug seemingly has been fixed for Update 8, at least Icepick put my Bug Report to "Solved" on Mantis, but I'm still waiting for an updated Preview Build or final Update 8 to be released at the and of the month so more bugs are fixed.


I am on 7c! I felt really uncomfortable on 2 so I stopped using it. The bug isn't as prevalent if you fill your prison to capacity....I mean it should be a 10 grader all those dorms but they're being graded at 8....and that's still above average.

Medu_Salem wrote:Also the Prisoner's Privacy Need suffers badly using Dormitories. I can't deal with how imbalanced that is... Because even if you have 2x2 cells (Smaller than normally required 2x3) the prisoners aren't complaining about anything as long as the cell is the average room grade... but even if you build a dormitory with 6 tiles PER prisoner they are complaining about privacy. That's why I am not using Dormitories. I don't want to provoke fights between the room mates just because the system is not well balanced. I think someone did some practical research and found out that the Privacy Need doesn't suffer if there is at least 12 tiles PER prisoner in the Dormitory... but that's completely insane in my opinion, just like 16 tiles for a single prisoner Cell is badly balanced (it should be 15 or even better 12 since every item fits within 12 tile cells anyways) and the main reason for why I'd never do that (except maybe for the 3 Gang leaders to force them there).

I think that the Privacy need should suffer, yes, but it shouldn't suffer if there are at least 6-8, maybe 9 tiles per prisoner in the dormitory. Otherwise building a dormitory doesn't make sense as it would require more space overhead just to make the prisoners feel "okay" than it would require if you would just build a lot of single 2x3 cells, which then defeats the purpose of even building a Dormitory. Because hypothetically you can put the same amount of prisoners in the same space using single cells and have happier prisoners than using Dormitories and having unhappy prisoners.


Yes there's rioting every morning but once everyone gets over it they're alright. My privacy need has some yellows but nothing worse. I think the cell spacing is insane too...when I build single cells they are 3x4 that's 12 tiles. When I build dorms they're usually taking up the same space for the same number of people but somehow that's not good enough. And the furniture in there subtracts from that space so they're getting like 3 blocks in their own cell but like 8 in a dorm, that should be a plus.

Also really really hate putting pool tables in there. If the grading weren't bugged I wouldn't use it. And 1 pool table per 4 prisoners! A 12 man dorm would require 3 pool tables, that's a massive amount of space lost. Sometimes I like to build dorms like Orange Is The New Black, and I want common rooms to be used but pool tables are legitimately useless and common rooms even more so.

Image

And why do fights break out over showers? 2 showers, 2 toilets, 4 prisoners....take bloody turns? I mean gees if there were 8 prisoners to 2 showers I can see that happening but not 4 on 2 heads.


Medu_Salem wrote:
yuk wrote:OI tried using a shared space with rotating schedule but the issue is supermax won't work and there's nothing else for them to do...so they go into the canteen or the yard and wander around. They are SO FRUSTRATING. Your system sounds amazing! I'd love to see it :D. What's an airlock? Sounds interesting I may experiment with zoned hallways/doors to see how that turns out too :D.


Yeah the SuperMax people are a problem... or let's say the Gang Members are the problem. Too bad there is no reform program to convince some of them to leave their gang life behind. There should be something like that and if they successfully leave their gang they would be marked with the Ex Gang Member trait and become a target for every other Gang Member in the prison, so from there on you'd have to put them in Protective Custody and they'd behave like other Protective Custody prisoners.
I would mod something like that into the game, I already looked into doing it but the problem is that:

  1. You can't get or edit Reputations, Bio Information, finished Reform Programs or Misconducts etc in general
  2. You can't call/run a Lua script once a reform program is finished to decide/determine what to do next with the prisoner or whatever. Would be nice if such a thing was possible for various things (like Reform Programs, Research, Production, Needs etc)
  3. You can't edit which prisoners are to be called to a reform program (for example the game internally uses Alcoholism/DrugAddiction/Parole as referrals for the more advanced reform programs that don't depend on a need, but you can't add such a referral to a prisoner, which means you can't call out for gang members or whatever else who you want to refer to/call out for)
  4. Several other small problems I encountered while evaluating the implementation but that I already forgot about.


I have actually requested that as a mod.

elDiablo pleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeease look into these issues for us and modders everywhere <3

In case you're curious I've requested a lot of mods...some of which are....
Bigger clone tool, and Rotatable clone tool
More Parents (based on capacity)
Staff "deployment" (like how guards are deployed, to deploy doctors, cooks, etc at specific worksites)
Working pool tables and usable common rooms
Schedule with some sort of color coding based on deployment zone (ie supermax would show maroon)
No auto wiring when placing appliances
Clickable intelligence screen


Medu_Salem wrote:With my current prison the working class is only MinSec, Normal, MaxSec in 3 shift rotation... like I mentioned earlier: 0:00-4:00 MinSec, 4:00-8:00 Normal, 8:00-12:00 MaxSec, 12:00-16:00 MinSec, 16:00-20:00 Normal, 20:00-24:00 MaxSec, and Eat/Sleep/Yard/LockUp in the 8 hours between each workshift. The SuperMax are mostly locked down and the other time they are either eating or in the yard. Each Security level has only 1 hour of free time in my regime. More than that causes malus points in the prisoner's grading from what I eperienced. But then again the point system is not really explained anywhere so you have to figure everything out yourself.

In another prison of mine I'm also trying out a 4 shift rotation including SuperMax. 0:00-3:00 MinSec, 3:00-6:00 Normal, 6:00-9:00 MaxSec, 9:00-12:00 SuperMax, 12:00-15:00 MinSec, 15:00-18:00 Normal, 18:00-21:00 MaxSec, 21:00-24:00 SuperMax... and again Eat/Sleep/Lockdown/Yard in between each workshift. This prison is currently working together with the Mod I'm working on.. The mod detects when someone is in Solitary for Misconducts and shifts the prisoner automatically one Category up (if there is space in the target Category that is). The mod also detects if someone is behaving for more than a couple of days and shifts the Prisoner down one Category. So almost everyone with <3 days without Misconduct ends up in SuperMax, 3-6 days in MaxSec, 6-9 Days in Normal, >9 in MinSec. The thresholds and if a category is allowed to recategorized in the first place are configureable with buttons on the Controller Item one has to place.


As for the Airlock... when you place 2 doors directly in following each other (not next to each other) then the game will recognize the tile in between those two doors as it's own small room... which allows you to put a Deployment zone there. So you can mark that Tile with MinSec (or whatever else) for example and only MinSec prisoners can go through that tile. That way you can filter out the prisoner types you want to go through the doors. But you need such an "Airlock" for each Security level you want to pass... so sometimes you need multiple such airlocks next to each other for each security level you want to go through there from one shared zone to another shared zone. I wish I could provide a picture link now, but I would have to upload one somewhere.


That makes complete sense, great name too cause it really is an airlock haha! I will have to give that a go but if you do have any screenies it would rock to see how you're using them :D.
elDiablo
level5
level5
Posts: 3111
Joined: Thu Mar 14, 2002 12:23 pm
Location: London, UK

Re: Can I change prisoners security based on reform grade?

Postby elDiablo » Thu Aug 11, 2016 5:19 pm

For an update, have a look at this bug. tl;dr, I've added World.NumPrisoners and World.Capacity, both of which return tables listing the current prisoners in each category, and the number of cells in each security zone. Both tables link names to numbers. Be warned that the numbers will probably be incorrect in the Init function, as the game simulation hasn't counted all sectors just after load.

I've also added prisonerTable.ReoffendingChance, to be used like so:

Code: Select all

local prisoners = Object.GetNearbyObjects( "Prisoner", 10 )
for i,v in pairs(prisoners) do
   local chance = i.ReoffendingChance
   print(chance)
end


This will return a number between 0 and 1 (fractional chance of reoffending).

All three of these new features are cfunction calls, which can be expensive (especially NumPrisoners and Capacity as they list all objects/zones in the world to count), therefore it's probably better to cache results and only update them periodically. Just a thought.

In reply to the other requests, I'll try and add features to the modding API, but I won't be making mods for you, I'm afraid. I'm pretty confident that someone could make a bigger clone tool mod using scripted objects now though. Just saying...
User avatar
Medu_Salem
level1
level1
Posts: 46
Joined: Fri May 16, 2014 6:42 pm

Re: Can I change prisoners security based on reform grade?

Postby Medu_Salem » Thu Aug 11, 2016 7:05 pm

elDiablo wrote:For an update, have a look at this bug. tl;dr, I've added World.NumPrisoners and World.Capacity, both of which return tables listing the current prisoners in each category, and the number of cells in each security zone. Both tables link names to numbers. Be warned that the numbers will probably be incorrect in the Init function, as the game simulation hasn't counted all sectors just after load.

I've also added prisonerTable.ReoffendingChance, to be used like so:

Code: Select all

local prisoners = Object.GetNearbyObjects( "Prisoner", 10 )
for i,v in pairs(prisoners) do
   local chance = i.ReoffendingChance
   print(chance)
end


This will return a number between 0 and 1 (fractional chance of reoffending).

All three of these new features are cfunction calls, which can be expensive (especially NumPrisoners and Capacity as they list all objects/zones in the world to count), therefore it's probably better to cache results and only update them periodically. Just a thought.


Like I responded to my Mantis report already... Nice job, elDiablo! Thanks for the effort! :D

I intend to call the capacity/numprisoner functions anyways only periodically. Currently I'm running my script once every World Minute to check if the next full World hour is reached (to keep the Script in sync with the regime) and if that's the case then run the entire update procedure, otherwise it's just yielding, since doing it more often used to cause the stuttering more often due periodic recount using Object.GetNearbyObjects on all Prisoners on the entire map... URGH xD ... so there should probably be no problem with that anymore. Calling these two new Cfunctions will probably be a lot faster than getting all Prisoners in the entire map using GetNearbyObjects and then count them manually :P

I also do the check only hourly because to be able to upgrade a prisoner on bad behaviour they have to be in Solitary, which is pretty easy to check with thatPrisoner.RequiredCellType WHILE NOT being shackled... Shackled=true + RequiredCellType=Solitary would mean they are currently escorted to the Solitary, but not serving their punishment yet.

I have to do that because I have NO access to the Prison's Policy settings and also there's no access to why a prisoner actually is being send to Solitary and how long he/she's going to be in Solitary.. (would be nice to have that information btw)

So I have added an option into the mod-control item that allows you to set the interval of checks manually to adjust to a prison's specific Policy settings. Though it still requires the prison to run a specific policy setting otherwise it doesn't work because of above mentioned lack of information for a specific prisoner. If it isn't adjusted correctly it might upgrade the same prisoner multiple times in a row if they have long Solitary punishment sentences and then they may be in the wrong category because I don't keep track of which prisoner I already upgraded between two checks for convenience reasons und keeping the code cleaner... though I'm thinking about experimenting with that.



I'll also consider that on map load the values won't be correct yet... I already noticed the effect anyways because it normally takes a while for the game to display the correct amount of prisoners/cells in the GUI after load... so I figured as much that the game doesn't know the amount itself yet until after a short time after loading the savegame. I'll add something like a timervariable in my mod to deal with that that locks the update of my mod until after a few seconds after the savegame has been loaded. I timed the load myself anyways and with my current Intel Core i7 860 (which is pretty old for nowadays) takes about 2 seconds to get the correct numbers. So I'll delay the start of my mod about 5 or maybe 10 seconds just to be sure.



About the Reoffending Chance... nice too. I'll look into that as well when Update 8 is out (or maybe another preview build before, which wouldn't be too bad after all because some bugs might have been fixed already and it would good if people would stop producing duplicate bug reports).
@yuk: With that addition I'll see if I can add an option into my mod too for Reoffending chance as well just for you... so that you can downgrade/upgrade prisoners depending on their days without misbehaviour and optionally also on their reoffence chance. I think that it might make you happy. But I can't gurantee anything yet since I'll have to do some testing on the implementation. :P
murgh
level2
level2
Posts: 232
Joined: Sat Jan 30, 2016 11:52 am

Re: Can I change prisoners security based on reform grade?

Postby murgh » Sat Sep 03, 2016 7:05 pm

Wait, what? Can we now use this new World.NumPrisoners toy instead of using GetNearbyObjects(this,'prisoner',150) in order to find them?
Possible to do something like this?

Code: Select all

local AllMyPrisoners=World.NumPrisoners
for i,v in pairs(AllMyPrisoners) do
   things with them
end


Or did I get that completely wrong?

I read this example

Code: Select all

function Init()
    -- Called on World initialisation (both for new maps and loading a pre-existing map)
    Game.DebugOut( "World Script Init" )
    this.Updated = false
end


function Update( timePassed )
    -- Called once per tick
    if this.Updated ~= true then
        this.Updated = true
           
        local prisoners = World.NumPrisoners
        print(type(prisoners))
        print(prisoners)
       
        local capacity = World.Capacity
        print(type(capacity))
        print(capacity)
    end
end

and a screen shot, but I could do with some more elaborate example on how to make good use of this.

edit: ah ok, prisoners.Normal would return the number 90.00
But it doesn't also hold all those 90 prisoners so we can mess with their needs?
murgh
level2
level2
Posts: 232
Joined: Sat Jan 30, 2016 11:52 am

Re: Can I change prisoners security based on reform grade?

Postby murgh » Tue Jan 03, 2017 9:33 pm

elDiablo wrote:The ModSchema on the devwiki has some, but needs updating (I'll try and do it next week). The Modding page itself is also good with links to guides and things.



No pressure intended, but I would love to see the ModSchema page getting updated.
"Next week" became next month and next month became next year since you posted this... :mrgreen:
Could you please update that page, I'm sure it just must have slipped your mind!

Return to “Modding”

Who is online

Users browsing this forum: No registered users and 8 guests