kam_remake icon indicating copy to clipboard operation
kam_remake copied to clipboard

Actions.GroupOrderSplit, Actions.GroupOrderSplitUnit, and unit selection

Open Kistrel opened this issue 9 years ago • 3 comments

Using them more than once in the same Tick sometimes selects enemy units, which is normally impossible.

Kistrel avatar Mar 31 '15 17:03 Kistrel

Please provide a reproducible example.

Kromster80 avatar Mar 31 '15 17:03 Kromster80

Ok, managed to get a simple script to reproduce the issue: Create a new, empty map. Place 1 unit for player 1 and a group of 10 warriors for player 2 elsewhere. (Not necessarily 10: on my PC, it always happens as long as there are at least 3 warriors in that group at start)

Attach the following script and start a game as player 1: you should start with one of player 2's units selected, which should not happen.

procedure OnMissionStart;
var
  iGroups: array of Integer;
  iGroup: Integer;
begin
  iGroups := States.PlayerGetAllGroups(1);

  iGroup := Actions.GroupOrderSplitUnit(iGroups[0], States.GroupMember(iGroups[0], 0));

  Actions.GroupOrderLink(Actions.GroupOrderSplitUnit(iGroups[0], States.GroupMember(iGroups[0], 0)), iGroup);

  Actions.GroupOrderSplitUnit(iGroup, States.GroupMember(iGroup, 0));
end;

Kistrel avatar Mar 31 '15 19:03 Kistrel

Does not matter whether you have selected unit or not - working on this.

vqw avatar Aug 14 '15 18:08 vqw