////////////////// // Put the next few lines in scenario.slc ////////////////// HandleEvent(BeginTurn) pre { VeteranEffect(); } ////////////////// // Put the following lines in WAW_mod.slc ////////////////// // Turns units near Generals into Veteran and all other units non Veteran void_f VeteranEffect () { int_t i; int_t j; int_t k; unit_t tmpUnit; int_t tmpNum; int_t numUnits; int_t tmpPlayer; for (i = 1; i < 5; i = i + 1) { // Loop for each player if (IsPlayerAlive(i)) { // Check player exists player[0] = i; tmpPlayer = player[0]; numUnits = player[0].units; // Get number of units for player for (j = 0; j < numUnits; j = j + 1) { // Loop for every unit GetUnitByIndex(tmpPlayer, j, tmpUnit); ToggleVeteran(tmpUnit, 0); // Default every unit to non-veteren tmpNum = GetUnitsAtLocation(tmpUnit.location); // Get the units at the location for (i = 0; i < tmpNum; i = i + 1) { // Loop through units at location GetUnitFromCell(tmpUnit.location, i, tmpUnit); if(tmpUnit == UnitDB(UNIT_ARCHER)) { // Is the unit a leader? Change UNIT_ to whatever the leader unit is for(k = 0; k < tmpNum; k = k + 1) { // Loop through every unit at location again GetUnitFromCell(tmpUnit.location, k, tmpUnit); ToggleVeteran(tmpUnit, 1); // Make the unit a veteren } i = tmpNum; // Cancel the unit at location cycle (don't need to since we've found a leader already) } } } } } }