   /////////////////////////////////////////////////
  // Script for the WW2 D-Day Invasion scenario  //
 //     last update 4-10-02 by Eddie Cavazos    //
/////////////////////////////////////////////////

HandleEvent(BeginTurn) pre {
  VeteranEffect();					// Call the VeterenEffect function
}

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)
          } 
        }
      } 
    } 
  } 
}

// Player 1 - America
// Player 2 - Germany
// Player 3 - Great Britain
// Player 4 - Canada
// Player 5 - France

HandleEvent(BeginTurn) 'BeginGameRegard' pre {
int_t turnMax;
turnMax = 1000;

		// Make everybody hate the Germans
		ChangeGlobalRegard(2, -1000, ID_BLITZ_WAR_REASON, turnMax);

		// Make the Germans hate everybody
		LogRegardEvent(2, 1, -1000, 0, ID_BLITZ_WAR_REASON, turnMax);
		LogRegardEvent(2, 3, -1000, 0, ID_BLITZ_WAR_REASON, turnMax);
		LogRegardEvent(2, 4, -1000, 0, ID_BLITZ_WAR_REASON, turnMax);
		LogRegardEvent(2, 5, -1000, 0, ID_BLITZ_WAR_REASON, turnMax);

		// Make the Allies like each other
		LogRegardEvent(1, 3, 1000, 0, ID_WW_BLANK, turnMax);
		LogRegardEvent(1, 4, 1000, 0, ID_WW_BLANK, turnMax);
		LogRegardEvent(1, 5, 1000, 0, ID_WW_BLANK, turnMax);
		LogRegardEvent(3, 1, 1000, 0, ID_WW_BLANK, turnMax);
		LogRegardEvent(3, 4, 1000, 0, ID_WW_BLANK, turnMax);
		LogRegardEvent(3, 5, 1000, 0, ID_WW_BLANK, turnMax);
		LogRegardEvent(4, 1, 1000, 0, ID_WW_BLANK, turnMax);
		LogRegardEvent(4, 3, 1000, 0, ID_WW_BLANK, turnMax);
		LogRegardEvent(4, 5, 1000, 0, ID_WW_BLANK, turnMax);
		LogRegardEvent(5, 1, 1000, 0, ID_WW_BLANK, turnMax);
		LogRegardEvent(5, 3, 1000, 0, ID_WW_BLANK, turnMax);
		LogRegardEvent(5, 4, 1000, 0, ID_WW_BLANK, turnMax);
	DisableTrigger('BeginGameRegard');
}


	