kam_remake
kam_remake copied to clipboard
Bug: Actions.UnitKill and invalid groups
Using Actions.UnitKill on a newly equipped Warrior before he joined a group creates an invalid group that exists and is alive, but has 0 members and is hungry.
Please describe the algorithm of reproducing this bug, in steps.
Create a map in the editor, with a Barracks stocked with recruits and axes. Attach the following script, then start a game on the map and recruit a Militia.
procedure OnTick;
var
aUnits: array of Integer;
i: Integer;
begin
if States.StatUnitTypeCount(0, 14) > 0 then begin
aUnits := States.PlayerGetAllUnits(0);
for i := 0 to Length(aUnits)-1 do if States.UnitType(aUnits[i]) = 14 then
Actions.UnitKill(aUnits[i], True);
end;
end;