Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Ways to lock doors on Adv mode? Scripts on DFhack maybe?  (Read 1955 times)

Korgoth

  • Bay Watcher
    • View Profile
Ways to lock doors on Adv mode? Scripts on DFhack maybe?
« on: November 15, 2020, 03:04:14 pm »

Hello my fellow dwarfs. I want to know if there is a way do mod a interaction to lock doors on adventure mode.
 I'm building a prison on my adventurer fort, and a prison is not a prison without locked doors right?
So anyone can help me with that?
Scripts to use on Dfhack are very welcome! There is someone with knowledge with scripts and know how to make that possible?
 I would be very grateful.
« Last Edit: November 15, 2020, 06:40:53 pm by Korgoth »
Logged

MC

  • Bay Watcher
    • View Profile
Re: Ways to lock doors on Adv mode? Scripts on DFhack maybe?
« Reply #1 on: November 17, 2020, 08:28:56 am »

Locked doors are handled by a flag on the item IIRC, and you can change the prisoner's position and entity links to have the game actually consider them a prisoner. That said I don't know if they'd actually stay in the locked room once the site was unloaded.
Logged
This is a terrible mod. All crashmanship is of the highest quality. This object is adorned with hanging rings of notification spam. This object menaces with spikes of llama wool. On the item is an image of a large oval dwarf flesh cabochan in elf bone. The artwork relates to the attack of an unknown creature on an unknown creature in a time before time. It was inevitable.

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: Ways to lock doors on Adv mode? Scripts on DFhack maybe?
« Reply #2 on: November 20, 2020, 09:04:40 am »

Code: [Select]
--locks door at cursor
local cursor=copyall(df.global.cursor)

local door=dfhack.buildings.findAtTile(cursor)
if door and df.is_instance(df.building_doorst,door) then
door.door_flags.forbidden=true
door.door_flags.pet_passable=false --optional
else
if door then
qerror("Not a door at cursor")
else
qerror("No building (esp. doors) at cursor")
end
end

Save as "lock-door.lua" in hack/scripts folder.

Korgoth

  • Bay Watcher
    • View Profile
Re: Ways to lock doors on Adv mode? Scripts on DFhack maybe?
« Reply #3 on: November 22, 2020, 03:23:04 pm »

Code: [Select]
--locks door at cursor
local cursor=copyall(df.global.cursor)

local door=dfhack.buildings.findAtTile(cursor)
if door and df.is_instance(df.building_doorst,door) then
door.door_flags.forbidden=true
door.door_flags.pet_passable=false --optional
else
if door then
qerror("Not a door at cursor")
else
qerror("No building (esp. doors) at cursor")
end
end

Save as "lock-door.lua" in hack/scripts folder.

Thank you so much, fellow dwarf! It worked wonders!!!
Logged

Korgoth

  • Bay Watcher
    • View Profile
Re: Ways to lock doors on Adv mode? Scripts on DFhack maybe?
« Reply #4 on: July 05, 2021, 10:00:02 pm »

Sorry to necro this thread, but when a try to lock a king inside my bandit hideout he simples unlocks it get out of the room.
Even though i have to unlock de door by locking picking it or breaking it. Do you know some kind of script to take the creature tag [canopendoor) of the creature or something like that?
Logged

Mobbstar

  • Bay Watcher
  • aka Mossbird
    • View Profile
    • my website
Re: Ways to lock doors on Adv mode? Scripts on DFhack maybe?
« Reply #5 on: July 07, 2021, 06:24:44 am »

Sorry to necro this thread, but when a try to lock a king inside my bandit hideout he simples unlocks it get out of the room.
Even though i have to unlock de door by locking picking it or breaking it. Do you know some kind of script to take the creature tag [canopendoor) of the creature or something like that?

Untested, but the tag-removing syndrome comes to mind:
https://dwarffortresswiki.org/index.php/DF2014:Syndrome#CE_REMOVE_TAG
I think it works on any tag  (besides the listed exceptions), not sure.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: Ways to lock doors on Adv mode? Scripts on DFhack maybe?
« Reply #6 on: July 07, 2021, 08:13:57 am »

Sorry to necro this thread, but when a try to lock a king inside my bandit hideout he simples unlocks it get out of the room.
Even though i have to unlock de door by locking picking it or breaking it. Do you know some kind of script to take the creature tag [canopendoor) of the creature or something like that?
so on this subject I don't think locking a door would permanently keep folks sealed in unless you assign them to the civ zone first ... after which you seal the room up to prevent them from getting into fights from line of sight. well at least for adventure mode.
but I probably just build a fortification behind the door to prevent the person from causally walking out, and the adventurer could just jump through the fortification.
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes