[help] Door Functionality
Moderator: NBJeff
- SHOT(by)GUN
- level0
- Posts: 6
- Joined: Wed Jul 24, 2013 9:54 am
[help] Door Functionality
So I figured I am going to make Blast Door as my first mod.
But seems like I cannot find any documentation how to implement:
- Remote Door functionality = disable jail keys
- Slower opening / closing
- Sounds : I tried copying solitary door sound info from sounds.txt, but seems like PA does not support sounds.txt adding?
- Sounds: use ingame voice like solitary door and then lower the pitch of that sound to make it feel like more massive
I have feeling that you could do these if you had secret prison architect LUA API documentation.. but I assume I cannot find it because it is secret (documented in source code only) ?
However I can do (compared to large jail door)
- Increase toughness
- Disable vision trough
- Increase building time
- Increase price
- Make custom sprite
- Make it work like normal door plus with servos
Work in progress file: *edit deleted* mod released in workshop http://steamcommunity.com/sharedfiles/filedetails/?id=364318805
So do anyone have any tips if I can achieve any of those things or do I have to wait for new patch with new expanded modding capabilities?
But seems like I cannot find any documentation how to implement:
- Remote Door functionality = disable jail keys
- Slower opening / closing
- Sounds : I tried copying solitary door sound info from sounds.txt, but seems like PA does not support sounds.txt adding?
- Sounds: use ingame voice like solitary door and then lower the pitch of that sound to make it feel like more massive
I have feeling that you could do these if you had secret prison architect LUA API documentation.. but I assume I cannot find it because it is secret (documented in source code only) ?
However I can do (compared to large jail door)
- Increase toughness
- Disable vision trough
- Increase building time
- Increase price
- Make custom sprite
- Make it work like normal door plus with servos
Work in progress file: *edit deleted* mod released in workshop http://steamcommunity.com/sharedfiles/filedetails/?id=364318805
So do anyone have any tips if I can achieve any of those things or do I have to wait for new patch with new expanded modding capabilities?
Last edited by SHOT(by)GUN on Sun Dec 28, 2014 8:07 pm, edited 1 time in total.
Re: [help] Door Functionality
Modding is very limited at the moment the things you can do are about the only ones you can do
Re: [help] Door Functionality
Have you tried consulting the wiki for some help?
- SHOT(by)GUN
- level0
- Posts: 6
- Joined: Wed Jul 24, 2013 9:54 am
Re: [help] Door Functionality
will309 wrote:Have you tried consulting the wiki for some help?
>> Yeah of course, both of them. Wiki LUA documented features only talk about processing items and campaign events.
Well I guess I release the mod as is and fix the missing features when they come available.
Mod released here: http://steamcommunity.com/sharedfiles/filedetails/?id=364318805
Re: [help] Door Functionality
Haven't worked with doors yet, but have you tried to open the door at a slower rate with the lua script? You could manually move the door to open at a slower rate. This *could* work, but I don't know if a normal door behavior is possible than.
For the other things you wanna implement, I think here is no way (yet). As for sounds you can only play a sound which is already in the game. There are 2845 sounds in the sounds.dat and I don't know if they are all implemented in the sounds.txt, but maybe there is a suitable sound for your door in the game.
For the other things you wanna implement, I think here is no way (yet). As for sounds you can only play a sound which is already in the game. There are 2845 sounds in the sounds.dat and I don't know if they are all implemented in the sounds.txt, but maybe there is a suitable sound for your door in the game.
- SHOT(by)GUN
- level0
- Posts: 6
- Joined: Wed Jul 24, 2013 9:54 am
Re: [help] Door Functionality
Chad wrote:have you tried to open the door at a slower rate with the lua script?
I'd love to try, but I have not found a LUA script command what enables me to do this.
As for sounds you can only play a sound which is already in the game.
I tried adding sounds.txt file into the data folder with "copied" entries from solitary door where I replaced objects name to my blastdoor & tried with object_blastdoor but it didin't work, also I have not found any examples how you could do this.
Game.Sound function is actually documented here http://devwiki.introversion.co.uk/pa/index.php/Lua#Game._Elements
But in order to use that function I would need to hook into door/open&close event or trigger, but I have no idea how to do this. Or alternatively I would have to read some kind of isMoving? property value and trigger the sounds myself, but no idea how to do this either.
So if someone could link a example or web page where any of this is documented, I'd be happy. Until then all I can do is wait for new modding capabilities or better documented modding section.
Re: [help] Door Functionality
SHOT(by)GUN wrote:I'd love to try, but I have not found a LUA script command what enables me to do this.
You could check if there is a guard near the door (with Object.GetNearbyObjects). If true move the door (with Object.Pos.x/Object.Pos.y). After certain time the door moves back to the original position. Would be a bit work to fiddle with orientation and stuffs, but that wouldn't be too hard. Maybe it's possible to check if the guard (or whoever) carries a staff key, but haven't tried something like this yet.
SHOT(by)GUN wrote:Game.Sound function is actually documented here [...]
This functions may not work in normal lua scripts, as this section is about campaign scripting.
Here is the command to play a sound (from lua_function_list.txt):
Code: Select all
Object.Sound
Format:
(1) Object.Sound( ObjectTable, SoundGroup, SoundId )
(2) Object.Sound( ObjectName, SoundGroup, SoundId )
- Use to get the "objectName" table
(3) Object.Sound( SoundGroup, SoundId )
- Used to on the "me" table
(4) objectTable.Sound( SoundGroup, SoundId )
Triggers a sound event at the given object's position.
In format 4, objectTable can refer to a return object's table or the "this" table (for the object the script is running
on). For example, this.Sound( soundGroupName, soundIdName )
ObjectTable/ObjectName: Optional. Defaults to the object that the script is running on.
SoundGroup: Sound group name (defined by OBJECT in sounds.txt)
SoundId: Sound name (defined by EVENT in sounds.txt)
Returns: N/A
The only way for now is, check if one of the sounds in sounds.txt works for you!
SHOT(by)GUN wrote:So if someone could link a example or web page where any of this is documented, I'd be happy. Until then all I can do is wait for new modding capabilities or better documented modding section.
I think there is no better documentation out there than the wiki or the forums about PA modding
Good luck!
- SHOT(by)GUN
- level0
- Posts: 6
- Joined: Wed Jul 24, 2013 9:54 am
Re: [help] Door Functionality
Chad wrote:Good luck!
Thanks your post was very helpful. I have been foolish by not looking into that lua_function_list.txt file. The wiki does not tell there is file like that and you should look THERE for answers.
A whole new world opened for me... so if I remove the door property and make the functionality manually like that.... I can pretty much do anything I want
My current plan is now in pseudo language:
Code: Select all
function Update ( passed )
myServo = this.GetNearbyObjects( "Servo", 2.0 )
if myServo.getProperty(isTriggered)
then
startOpening()
end
if prison.getProperty(isLockdown)
then
startClosing()
end
endWell that would never work like that, but I will try to achieve the functionality manually.
*edit* P.S. I knew there was a secret LUA scripting documentation
Re: [help] Door Functionality
SHOT(by)GUN wrote:Well that would never work like that, but I will try to achieve the functionality manually.
My guess is that you will run in to pathfinding problems if you stop defining the object as a door, I think you will want to test that first.
Unfortunately there is currently nothing like:
prison.getProperty(isLockdown)
The feature is nice though, I hope you can get it sorted.
- SHOT(by)GUN
- level0
- Posts: 6
- Joined: Wed Jul 24, 2013 9:54 am
Re: [help] Door Functionality
I did it !
I learned LUA + Prison Architect debugger console + those secret variables inside there in 12 hours straight coding
Here is the source code what enables me to:
- Read the Servo
- Use sound effects
- Slower opening / closing
- Forcibly close the door (someone might get stuck, but WHO CARES IN EMERGENCY?
)

The debugger console was the tool to get inside the secret world of prison architect, there are many many variables for objects what are not documented anywhere.... By getting those values inside Update function, I can observe the values in realtime. For example, blastDoorDebugOpen = this.Open , allowed me to see, that the Open variable was the one what changed when door was opening / closing, and it is basically the value I want to edit when overriding the door function.
It was lot of trial and error, but I finally got there.
Only two things are missing I am not able to make:
1. How to know when we are in lockdown?
2. How to disable jail keys from making insane damage to my door? (1 second time to crack door open with jail keys = more than 70% damage)
*edit* P.S. I knew the scripting was a secret art !
I learned LUA + Prison Architect debugger console + those secret variables inside there in 12 hours straight coding
Here is the source code what enables me to:
- Read the Servo
- Use sound effects
- Slower opening / closing
- Forcibly close the door (someone might get stuck, but WHO CARES IN EMERGENCY?

The debugger console was the tool to get inside the secret world of prison architect, there are many many variables for objects what are not documented anywhere.... By getting those values inside Update function, I can observe the values in realtime. For example, blastDoorDebugOpen = this.Open , allowed me to see, that the Open variable was the one what changed when door was opening / closing, and it is basically the value I want to edit when overriding the door function.
It was lot of trial and error, but I finally got there.
Only two things are missing I am not able to make:
1. How to know when we are in lockdown?
2. How to disable jail keys from making insane damage to my door? (1 second time to crack door open with jail keys = more than 70% damage)
*edit* P.S. I knew the scripting was a secret art !
Re: [help] Door Functionality
SHOT(by)GUN wrote:2. How to disable jail keys from making insane damage to my door? (1 second time to crack door open with jail keys = more than 70% damage)!
If the keys are doing damage to the door rather than opening it, you can just decrease/nullify the amount of damage every update?
Re: [help] Door Functionality
Great news! Have you found a suitable sound for your door in the sounds.txt?
As far I can tell, not every variable found in the debug console is useable, because it's values is not changed by the game (i.e. Powered is always true)
As far I can tell, not every variable found in the debug console is useable, because it's values is not changed by the game (i.e. Powered is always true)
- SHOT(by)GUN
- level0
- Posts: 6
- Joined: Wed Jul 24, 2013 9:54 am
Re: [help] Door Functionality
Puman wrote:If the keys are doing damage to the door rather than opening it, you can just decrease/nullify the amount of damage every update?
- Since the damage is not "event driven" ? I think I cannot nullify damage taken from specified source: like jail keys.... ofc I could limit maximum damage allowed per second... so it would override the system just like my door opening speed does... so that is actually good suggestion
Currently single prisoner can do about 1% dmg per second. So if I would limit max 2% per second allowed for the door, that would override the issue somewhat... so it would increase door durability from 1 second to 30+ seconds
But the learning / coding was too much for me so I am going to take 2 days break from developing, so next patch expected next week
Chad wrote:Great news! Have you found a suitable sound for your door in the sounds.txt?
- Yeah, I use jaildoor close sound as cling cling cling = massive door running on rails sound effect...
- And solitary door close sound as stopping sound, it is sufficient for now. It is already live if you want to test it out.
Re: [help] Door Functionality
SHOT(by)GUN wrote:[...]
- Since the damage is not "event driven" ? I think I cannot nullify damage taken from specified source: like jail keys.... ofc I could limit maximum damage allowed per second... so it would override the system just like my door opening speed does... so that is actually good suggestion, I will think about it.
Currently single prisoner can do about 1% dmg per second. So if I would limit max 2% per second allowed for the door, that would override the issue somewhat... so it would increase door durability from 1 second to 30+ secondsseems good enough for me!
But the learning / coding was too much for me so I am going to take 2 days break from developing, so next patch expected next week![]()
You could check every second if there was damage in comparison with the second before, and if so, you could set the damage to another value. I'm pretty sure that theres a workaround for that!
SHOT(by)GUN wrote:- Yeah, I use jaildoor close sound as cling cling cling = massive door running on rails sound effect...
- And solitary door close sound as stopping sound, it is sufficient for now. It is already live if you want to test it out.
I've seen it, but haven't had the time to test it yet
Who is online
Users browsing this forum: No registered users and 5 guests





