Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Sudden fort-wide brawl?  (Read 1759 times)

DDDragoni

  • Bay Watcher
  • More than just an average drunken axe-crazy nutjob
    • View Profile
Sudden fort-wide brawl?
« on: May 11, 2022, 02:12:09 am »

One of my dwarves threw a tantum and attacked some visitors, and all of a sudden everyone in my fort- visitors, citizens, long-term residents, animals- started attacking each other. It doesn't seem like a Loyalty Cascade, since creatures several z-levels away started fighting without being involved in any other fight, DFHack's `fix/loyaltycascade` said "no loyalty cascade found", and no one seems to be using weapons (E: never mind someone just got stabbed in the face). Is this normal for a tantrum? Will it stop on its own, and if not is there anything I can do to stop it?
« Last Edit: May 11, 2022, 02:21:00 am by DDDragoni »
Logged
Stuff I run:
Icehold(Second Thread)
Stuff I was/am involved with:
The Succession Tower, ConstructIvory
Bonepillar                    Thunderdoom
Parallel Fortresses

Thisfox

  • Bay Watcher
  • Vixen.
    • View Profile
Re: Sudden fort-wide brawl?
« Reply #1 on: May 11, 2022, 05:16:29 am »

I was under the impression that loyalty cascades could (and would) jump z-levels and to far edges of the map if there were allegiences involved, by some form of unintended telepathy, so I'm not sure you can assert it not being a loyalty cascade just because it happened in a few places at once. They definitely will fight in the loyalty battle using their own fists, lethal weapons, random mugs of drink, or another dwarfs body parts as weapons.... anything that comes to hand really.

I don't know anything about DFHack though, so can't help you there.

Best thing to do is to try to get as many of them isolated to seperate rooms and locked in, and wait for the fight to die out, in my experience.
Logged
Mules gotta spleen. Dwarfs gotta eat.
Thisfox likes aquifers, olivine, Forgotten Beasts for their imagination, & dorfs for their stupidity. She prefers to consume gin & tonic. She absolutely detests Facebook.
"Urist McMason died out of pure spite to make you wonder why he was suddenly dead"
Oh god... Plump Helmet Man Mimes!

dwarfish

  • Bay Watcher
    • View Profile
Re: Sudden fort-wide brawl?
« Reply #2 on: June 09, 2022, 08:07:47 am »

One of my dwarves threw a tantum and attacked some visitors, and all of a sudden everyone in my fort- visitors, citizens, long-term residents, animals- started attacking each other. It doesn't seem like a Loyalty Cascade, since creatures several z-levels away started fighting without being involved in any other fight, DFHack's `fix/loyaltycascade` said "no loyalty cascade found", and no one seems to be using weapons (E: never mind someone just got stabbed in the face). Is this normal for a tantrum? Will it stop on its own, and if not is there anything I can do to stop it?

df is currently unplayable rn because of this bug and it doesnt seem like it will be fixed soon. i actually came to check if it was fixed; hasnt been for a year now.

http://www.bay12forums.com/smf/index.php?topic=178464.0

this post should explain why it happens
Logged
"Likes cats for their ability to hunt vermin, and elves for their sensitive ears"

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Sudden fort-wide brawl?
« Reply #3 on: June 10, 2022, 03:15:28 am »

The DFHack check for loyalty cascades only checks for "real" loyalty cascades. These fights are slightly different, but still work essentially in the same way. Fights that should be just non lethal brawls are (or become) no quarters lethal fights.

The following DFHack script is intended to downgrade lethal fights to brawls that peter out. It's used by first selecting someone involved in the fight you're trying to stop and then invoking the script (with the script content copied and pasted into e.g. .../hack/scripts/mute_conflict.lua)

Code: [Select]
local help = [====[

mute_conflict
=============
Attempts to put a damper on a conflict the selected unit is involved in by reducing its level
to a Brawl. Note that there are checks in place to try to detect 'real' conflict and not
tamper with those, as the effects are even less predictable than on a normal lethal non lethal
fight.
]====]

function mute_conflict (arg)
  if arg and (arg:match ('help') or arg:match ('?')) then
    print (help)
    return
  end

  local unit = dfhack.gui.getSelectedUnit (true)

  if not unit then
    qerror ("This script acts on a selected unit")
  end
 
  local activity
 
  for i, act in ipairs (unit.activities) do
    activity = df.activity_entry.find (act)
   
    if activity and activity.type == df.activity_entry_type.Conflict then
      for m, event in ipairs (activity.events) do 
        for k, side in ipairs (event.sides) do
          for l, unit_2_id in ipairs (side.unit_ids) do
            local unit_2 = df.unit.find (unit_2_id)
            if unit_2 then
              if unit_2.flags1.active_invader then
                qerror ("Sorry, at least one of the involved is an active invader, indicating a 'real' conflict")
           
              elseif unit_2.flags1.hidden_in_ambush then
                qerror ("Sorry, at least one of the involved is hidden in ambush, indicating a 'real' conflict")
           
              elseif unit_2.flags1.invader_origin then
                qerror ("Sorry, at least one of the involved is of invader origin, indicating a 'real' conflict")
           
              elseif unit_2.flags1.hidden_ambusher then
                qerror ("Sorry, at least one of the involved is a hidden ambusher, indicating a 'real' conflict")
           
              elseif unit_2.flags1.invades then
                qerror ("Sorry, at least one of the involved is currently invading, indicating a 'real' conflict")
           
              elseif unit_2.flags2.visitor_uninvited then
                qerror ("Sorry, at least one of the involved is an uninvited visitor, indicating a 'real' conflict")       
              end
            end
         
            if side.enemies [0].conflict_level < df.conflict_level.Lethal then
              qerror ("This doesn't seem to be a serious conflict: " .. df.conflict_level [side.enemies [0].conflict_level])
            end
          end
        end
       
        for k, side in ipairs (event.sides) do
          side.enemies [0].conflict_level = df.conflict_level.Brawl
        end
       
        dfhack.println ("Deescalated a conflict to a mutual Brawl")       
        return
      end
    end
  end
 
  qerror ("Failed to find a conflict this unit is involved in.")
end

mute_conflict (...)
Logged

dwarfish

  • Bay Watcher
    • View Profile
Re: Sudden fort-wide brawl?
« Reply #4 on: June 10, 2022, 06:59:14 am »

The following DFHack script is intended to downgrade lethal fights to brawls that peter out. It's used by first selecting someone involved in the fight you're trying to stop and then invoking the script (with the script content copied and pasted into e.g. .../hack/scripts/mute_conflict.lua)
oh wow, how long have you been sitting on this neat little bit of code? did you just make it or has it been tried and tested?

also things like "df.activity_entry_type.Conflict" where did you find the documentation for internal game code like this?
Logged
"Likes cats for their ability to hunt vermin, and elves for their sensitive ears"

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Sudden fort-wide brawl?
« Reply #5 on: June 10, 2022, 11:24:32 am »

Since 2020-03-21 if the file time stamp is to be trusted ;)

I've posted it a number of times since then, though, and I've used it a few times myself.

The mapped DF structures are made available through DFHack as XML. There's no documentation beyond that (not quite true: there's some rather useful documentation for the DFHack API), however, but if you happen to delve into things you eventually get an idea about approximately where you should look for things.
Logged