I've got a couple of ideas which require modtools/add-syndrome to work, but have so far been prevented from accomplishing them due to the script not functioning as intended when it comes to removing syndromes. I've been meaning to report this problem since the previous version, but never got round to it. Nevertheless:
Say a unit has a syndrome which, for example, gives the unit the ability to perform an interaction. Attempting to remove the syndrome via "modtools/add-syndrome -target X -syndrome Y -eraseAll" will indeed remove the unit_syndrome from unit.syndromes.active . However, it will NOT remove the syndrome effects, such that the unit retains the ability to perform the interaction, etc.
Digging into the issue, I found that whenever a syndrome is added to a unit, a new unit_wound is created in unit.body.wounds (This, and the following information, may already be common knowledge to a number of you). This unit_wound is referenced in the unit_syndrome as "wound_id". The unit_wound is linked to the raw-defined syndrome via unit_wound.syndrome_id , and unit_wound.curse is what contains the syndrome effects to be applied to the unit. Erasing the unit_wound is what is actually required to remove most of the syndrome effects from a unit. Note that the unit_wound will be recreated if the unit_syndrome is not also erased. Erasing only the unit_syndrome (as is currently done by the eraseSyndrome function in syndrome-util ) will leave the unit_wound and its resultant effects untouched.
I've seemingly fixed the issue in my tests by adding the following to the eraseSyndrome function in syndrome-util:
local w1
local wN
local d
if oldestFirst then
w1 = 0
wN = #unit.body.wounds-1
d = 1
else
w1 = #unit.body.wounds-1
wN = 0
d = -1
end
local wounds = unit.body.wounds
for w=w1,wN,d do
if wounds[w].syndrome_id == syndromeId then
wounds:erase(w)
return true
end
end