Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Script to restrain creatures  (Read 3207 times)

fortunawhisk

  • Bay Watcher
    • View Profile
Script to restrain creatures
« on: December 07, 2016, 12:07:54 am »

A gui driven script that can create CageLargeCreature or ChainAnimal jobs for civilians. The jailer hunts the target and drags them off to the chain/cage.
Only works in Fort Mode. GUI mode only allows civilians, but the command line will allow you to use any unit id. I use cprobe and bprobe to get the creature/building id's.

Spoiler (click to show/hide)

Notes:
- Pretty similar to the existing justice system, except victims are restrained indefinitely.
- Units with an active justice sentence will be released.
- Cages or restraints must be made into a room and set to justice.
- Cages must be metal. Chain material doesn't appear to matter.
- Mothers will remove infants from chains/cages with Seek Infant.
- Most jobs are unavailable when on a chain, but...
-- Military will spar/train/watch & attend demonstrations
-- Social activities still work (tavern, library, temple)
-- Chained victims in a tavern get liquor delivered via barkeep
-- Chained victims will consume food/water if it is available.
-- Units can be thrown free of chains!
- Merchants can be chained, but not caged (they go crazy)
-- Interestingly, restrained non-violent crazy creatures will get food/water?
- Restrained merchants go crazy a bit after the caravan leaves.
-- This can be prevented by setting using gm-editor to set flags1.merchant to false.

Enjoy!

Edit:
Updated for 44.10
« Last Edit: July 09, 2018, 06:35:25 pm by fortunawhisk »
Logged

dermal_plating

  • Bay Watcher
    • View Profile
Re: Script to restrain creatures
« Reply #1 on: January 03, 2017, 10:36:51 pm »

Wow, awesome idea. I'll try it when I get home from work tonight. :)
Logged

FantasticDorf

  • Bay Watcher
    • View Profile
Re: Script to restrain creatures
« Reply #2 on: January 16, 2017, 11:37:13 am »

Interesting, to go a step further could this be paired with a paralysing effect (input a syndrome/command either automatically on the target or via applied method) to capture wild animals and then proceed to jail them?

EDIT - though this in itself is a useful feature for putting away moody dwarves who can't be fulfilled or troublemakers.
« Last Edit: January 21, 2017, 01:58:49 pm by FantasticDorf »
Logged

fortunawhisk

  • Bay Watcher
    • View Profile
Re: Script to restrain creatures
« Reply #3 on: February 12, 2017, 04:07:29 pm »

Interesting, to go a step further could this be paired with a paralysing effect (input a syndrome/command either automatically on the target or via applied method) to capture wild animals and then proceed to jail them?

EDIT - though this in itself is a useful feature for putting away moody dwarves who can't be fulfilled or troublemakers.

The command line version of the script allows you to target wildlife now, you just need to provide their unit id. Not sure about syndromes...

Example:
http://imgur.com/a/FiYj5
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: Script to restrain creatures
« Reply #4 on: February 12, 2017, 05:35:53 pm »

*imagines possibly applications*

Guard dwarves who can spar and won't run off and desert their post to pray or slay? Though, probably will be wrestled away soon enough if sparring.

Ability to chain every dwarf you have...It's interesting. What other applications than vampire mayors who hold meetings, though?

DaSwayza

  • Bay Watcher
    • View Profile
Re: Script to restrain creatures
« Reply #5 on: July 07, 2018, 02:54:32 pm »

I am quite sure I want to reply. I can't seem to get this script to work. I have a cage set up and accessible, I have a non-civ target (using cprobe to get the id), and in the command line I am typing this:

[DFHack]# jailer -nogui -victim 24774 -jailer 13872 -restraint 7904

Yet I am getting the error:

C:\Users\david\Desktop\DF 44.11 64/hack/scripts/jailer.lua:75: Cannot read field world.job_list: not found.
stack traceback:
        [C]: in metamethod '__index'
        C:\Users\david\Desktop\DF 44.11 64/hack/scripts/jailer.lua:75: in global 'getLastJobLink'
        C:\Users\david\Desktop\DF 44.11 64/hack/scripts/jailer.lua:83: in global 'addNewJob'
        C:\Users\david\Desktop\DF 44.11 64/hack/scripts/jailer.lua:112: in global 'jailUnit'
        C:\Users\david\Desktop\DF 44.11 64/hack/scripts/jailer.lua:195: in upvalue 'jail'
        C:\Users\david\Desktop\DF 44.11 64/hack/scripts/jailer.lua:266: in function <C:\Users\david\Desktop\DF 44.11 64/hack/scripts/jailer.lua:200>

Help?
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: Script to restrain creatures
« Reply #6 on: July 07, 2018, 08:30:05 pm »

*peeks*

That's because world.job_list was replaced by/reorganized into world.jobs.list. replace all instantances (just 1,  think) of first with second in script.

Also, you have sharpnel in including username in that path.

fortunawhisk

  • Bay Watcher
    • View Profile
Re: Script to restrain creatures
« Reply #7 on: July 09, 2018, 06:49:11 pm »

Script updated to v1.1, should now work with 44.10.
Logged