Bay 12 Games Forum
Dwarf Fortress => DF Modding => Topic started by: Korgoth 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.
-
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.
-
--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.
-
--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!!!
-
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?
-
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.
-
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.