kam_remake
kam_remake copied to clipboard
Actions.GroupOrderSplit, Actions.GroupOrderSplitUnit, and unit selection
Using them more than once in the same Tick sometimes selects enemy units, which is normally impossible.
Please provide a reproducible example.
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;
Does not matter whether you have selected unit or not - working on this.