
========
Description
========
In an effort to make the electric chair have some function outside of the introduction sequence, I figured I might as well push the scripting system to the limit and give it a go. This mod was mostly an experiment to see if something like this could be done, and if (not / so), what expansions the scripting system would need in order for it to (be possible / function better).
At the moment, this mod requires you to build an Electric Chair and an Electric Chair Switch in close proximity to each other. Once both objects are properly powered and the Electric Chair is switched on, my custom script starts running.
Basically, your prison will be searched for Max and SuperMax security level prisoners. These prisoners will then have a 10% chance to be sentenced to execution. Those sentenced are given a random time left to live until their execution, between 2 to 14 in-game days. When the prisoner's time is up, they are sent to the chair to be executed.
Sentenced prisoners will have a handy tooltip on them showing you how much time they have left to live. When a prisoner is being executed, another handy tooltip will appear on the Electric Chair Switch, showing you who's up and how far away he is.
As I expected, the scripting system is still very limited and buggy. So below is a list of all known issues.
=============
Compatibility Notes
=============
Game version: Alpha-28
This mod makes changes to the following files:
materials.txt
Any mods that make alterations to these files may experience conflicts.
==========
Known Issues
==========
Object.NavigateTo() seems to glitch out half the time, resulting in your to-be-executed prisoners occasionally getting stuck when they're supposed to be navigating to the electric chair. Seems to be a path-finding issue, so IV will have to patch this at some point. Switching the electric chair off and on again occasionally resolves the issue.
NavigateTo() also doesn't take into account if your prisoner was doing anything else at the time, which may also have its hand in the glitching issue. As such, your prisoners occasionally get executed while holding their food trays and such.
The electric chair switch does nothing yet, other than enable the electric chair's script. The idea is to have guards flip it at some point. However, there is no "escort" function and NavigateTo(), as mentioned above, glitches out half the time. So I'm holding off on trying to script proper procedures until NavigateTo() is fixed at least.
In line with that, prisoners will simply walk to the electric chair when they're being executed. When they reach the chair, they die, with very little fanfare. WIP is WIP.
There doesn't seem to be a function to check if an object is in a certain room or not, so you don't actually need an Execution room yet. You can place the chair and switch pretty much anywhere you want, as long as they're close enough to each other and receive power.
GetProperty() still doesn't allow you to read prisoners' biographies. Hence why sentencing is left to random chance for now. Once IV "upgrades" this function I can base the sentence on prisoners' actual crimes and such.
The electric chair gets switched off when loading your game, stopping the script from running. So every time you load your game you'll have to turn it back on again.
=============
Useful Information
=============
To uninstall this mod without leaving stray shenanigans in your prison (tooltips and such), just follow these steps:
1) Make sure the script is running first. (If it never ran before, you can skip this.)
2) Switch the Electric Chair off.
3) Dump the Electric Chair Switch and dismantle/dump the Electric Chair.
4) Disable the mod.
ElectricChairSwitch.lua contains some variables that can be modified by end-users at the top of the file. These variables are:
maximumDistanceToChair
categoriesEligibleForExecution
executionChance
minimumTimeToLive
variableTimeToLive
getPrisonersTimer
Most of these are self-explanatory, but in-depth information has been provided inside the file. If you like you can tinker with these to tailor your own custom experience.
=======
Download
=======
Download available on the Steam Workshop only.