Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: How do you make a dfhack script that causes unconsciousness?  (Read 1767 times)

Tarcek

  • Escaped Lunatic
    • View Profile
How do you make a dfhack script that causes unconsciousness?
« on: October 30, 2014, 05:04:03 am »

Hi.
I dont know LUA, but i tried to throw something together myself thatd render the targetted creature unconscious. I... have no idea what im doing. Help. :)
If you want to laugh at my foolishness,
Spoiler (click to show/hide)
« Last Edit: October 30, 2014, 05:09:25 am by Tarcek »
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: How do you make a dfhack script that causes unconsciousness?
« Reply #1 on: October 30, 2014, 11:46:44 am »

No idea how you came up with that one, but what you want is "unit.counters.unconscious = 1200", which should make it unconscious for exactly 1 day.
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

Tarcek

  • Escaped Lunatic
    • View Profile
Re: How do you make a dfhack script that causes unconsciousness?
« Reply #2 on: October 30, 2014, 03:43:26 pm »

No idea how you came up with that one, but what you want is "unit.counters.unconscious = 1200", which should make it unconscious for exactly 1 day.

I was... attempting, to add a syndrome. That explains alot. Thankyou! :)
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: How do you make a dfhack script that causes unconsciousness?
« Reply #3 on: October 30, 2014, 05:02:35 pm »

"end" is only necessary if you're in a loop, function or the like, for future reference. You don't need it to end scripts.

Tarcek

  • Escaped Lunatic
    • View Profile
Re: How do you make a dfhack script that causes unconsciousness?
« Reply #4 on: October 30, 2014, 07:07:55 pm »

"end" is only necessary if you're in a loop, function or the like, for future reference. You don't need it to end scripts.

Ah, thankyou! Efficiency is glorious :)

Additional question: Where do you find all the different flags and counters? Is there a convenient list, or is it in the RAWs somewhere?
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: How do you make a dfhack script that causes unconsciousness?
« Reply #5 on: October 30, 2014, 09:16:39 pm »

You can explore using gm-editor or with vigorous use of the "~" shortcut in the interactive lua console (~dfhack.gui.getSelectedUnit() will give you a sort of listing of the unit's data structure). Once you're familiar with accessing some of the data and if you have a few minutes/hours to learn how to read the ever-human-readable markup language known as XML, you can look at DFHack's DF data structure XML for quicker finding of info.