kam_remake icon indicating copy to clipboard operation
kam_remake copied to clipboard

Bug: Actions.UnitKill and invalid groups

Open Kistrel opened this issue 9 years ago • 2 comments

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.

Kistrel avatar Mar 31 '15 17:03 Kistrel

Please describe the algorithm of reproducing this bug, in steps.

Kromster80 avatar Mar 31 '15 17:03 Kromster80

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;

Kistrel avatar Mar 31 '15 17:03 Kistrel