As discuessed in the other City Units thread, here is the revised trigger to check enemy stacked units content.
[This message has been edited by Dreamer (edited January 14, 2000).]
Code:
// Check contents of stacked units
Trigger 'CheckStackContents' when(clicked.unit && (unit.owner != g.player)
&& (UnitsInCell(unit.location) > 1)){ //continued from above
Message(g.player, 'CheckStackContentsMessage');
}
Alertbox 'CheckStackContentsMessage' {
SetPlayer(1, unit.owner);
i = 0;
u = 4;
while (i < player.1.totalunits) {
SetUnitByIndex(3, player.1, i);
if (unit.3.location == unit.location) {
SetUnit(u, unit.3);
u = u + 1;
}
i = i + 1;
}
Text(ID_CHECK_STACK_CONTENTS_MESSAGE);
EyeDropDown(4, unit);
Button(ID_BUTTON_CLOSE) {
Deselect(); // suggested by skorpion59
Kill();
}
}
Comment