i got the result i wanted by checking for changes in the thirst counter, as only residents seem to be drinking. so this works well except its a bit of extra checking.
ill post the code below, you can just drop this into your hack/scripts folder and run it through your dfhack.init or from the dfhack console. it should automatically enable when a fortress game is loaded.
the default is 4/2 times as much consumption for food/drink respectivly. if you want to change that, just tinker with the factor variables.
-- makes residents of your fortress grow hungry and thirsty much faster
---------
local updateInterval = 60 -- min 2
local hungerFactor = 4
local thirstFactor = 2
---------
local doUpdate
local trackCounters
local units
local civ
local residents = {}
---------
trackCounters = function()
for i,v in ipairs(units) do
if v.civ_id == civ then -- only residents appear to be thirsty, so we use that to figure out who is eligible
residents[i] = v.counters2.thirst_timer
end
end
timer = dfhack.timeout(1, 'ticks', doUpdate)
end
doUpdate = function()
for i,v in ipairs(units) do
if residents[i] then
local hc = v.counters2.hunger_timer
local tc = v.counters2.thirst_timer
if residents[i] ~= tc then
v.counters2.hunger_timer = hc + ((hungerFactor - 1) * updateInterval)
v.counters2.thirst_timer = tc + ((thirstFactor - 1) * updateInterval)
end
end
residents[i] = nil
end
timer = dfhack.timeout(updateInterval - 1, 'ticks', trackCounters)
end
dfhack.onStateChange.hungrydwarves = function(state)
if state == 2 then
print("Hungry Dwarves enabled!")
units = df.global.world.units.active
civ = df.global.ui.civ_id
timer = dfhack.timeout(updateInterval -1, 'ticks', trackCounters)
elseif state == 3 then
print("Hungry Dwarves disabled!")
units = nil
civ = nil
timer = dfhack.timeout_active(timer, nil)
end
end