Oh, yeah, sorry, its GetUnitsAtLocation, or UnitsInCell.
HandleEvent(MoveUnits) 'MakeVeteran' pre {
location_t tmpLoc;
tmpLoc = unit[0].location;
tmpPlayer = unit[0].owner;
VeteranEffect(tmpLoc, tmpPlayer);
}
void_f VeteranEffect (location_t tmpLoc, int_t tmpPlayer)
{
int_t i;
unit_t tmpUnit;
int_t tmpNum;
int_t numUnits;
int_t tmpPlayer2;
player[0] = tmpPlayer;
numUnits = player[0].units;
tmpPlayer2 = tmpPlayer;
if (IsPlayerAlive(tmpPlayer2)) {
// Make all Units non veteran, except Special Units
for (i = 0; i < numUnits; i = i + 1) {
GetUnitByIndex(tmpPlayer2, i, tmpUnit);
tmpNum = tmpUnit.type;
if (tmpNum >= 106 && tmpNum <= 112) {
ToggleVeteran(tmpUnit, 1);
} else {
ToggleVeteran(tmpUnit, 0);
}
}
}
// Make all Units veterans who share the location Alexander, Robin Hood and Richard The Lion Heart
tmpNum = GetUnitsAtLocation(tmpLoc);
for (i = 0; i < tmpNum; i = i + 1) {
GetUnitFromCell(tmpLoc, i, tmpUnit);
ToggleVeteran(tmpUnit, 1);
}
}
HandleEvent(MoveUnits) 'MakeVeteran' pre {
location_t tmpLoc;
tmpLoc = unit[0].location;
tmpPlayer = unit[0].owner;
VeteranEffect(tmpLoc, tmpPlayer);
}
. Just take the cantBuild lines off, Pedrunn
. Is that so hard?
Comment