Wonder if I could get a little advice on SLIC please.
Have ben doing a bit for myself but cant get this bit to work. Curiously, it works sometimes but not others.
I have incorporated Locutu's repair code into a cradle mod expansion. Works fine for cities. Have developed a new unit, the supply train, wanted the code to work for units stacked with a supply train.
Code-
for (a = 0; a < player[0].armies; a = a + 1) {
GetArmyByIndex(player[0], a, tmpArmy);
army[0] = tmpArmy;
i = 0;
while(i < army[0].size && success == 0) {
GetUnitFromArmy(army[0], i, tmpUnit);
if(tmpUnit.type == UnitDB(UNIT_SUPPLY_TRAIN)) {
success = 1;
//}
}
i = i + 1;
}
if(success == 1) {
tmpLoc = tmpUnit.location;
for (k = 0; k < GetUnitsAtLocation(tmpLoc); k = k + 1) {
GetUnitFromCell(tmpLoc, k, tmpUnit);
Then the repair code goes here, have declared all things, returns no errors, just does not work most of the time.
I hope the line format comes across ok in the post.
Have ben doing a bit for myself but cant get this bit to work. Curiously, it works sometimes but not others.
I have incorporated Locutu's repair code into a cradle mod expansion. Works fine for cities. Have developed a new unit, the supply train, wanted the code to work for units stacked with a supply train.
Code-
for (a = 0; a < player[0].armies; a = a + 1) {
GetArmyByIndex(player[0], a, tmpArmy);
army[0] = tmpArmy;
i = 0;
while(i < army[0].size && success == 0) {
GetUnitFromArmy(army[0], i, tmpUnit);
if(tmpUnit.type == UnitDB(UNIT_SUPPLY_TRAIN)) {
success = 1;
//}
}
i = i + 1;
}
if(success == 1) {
tmpLoc = tmpUnit.location;
for (k = 0; k < GetUnitsAtLocation(tmpLoc); k = k + 1) {
GetUnitFromCell(tmpLoc, k, tmpUnit);
Then the repair code goes here, have declared all things, returns no errors, just does not work most of the time.
I hope the line format comes across ok in the post.
Comment