AI army improver: - Make AI create 8 large army stacks, at least 5 units big. - Make AI keep these stacks within 2 of the capital. - Make AI move stacks towards enemy cities. - Make AI garrison newely taken cities or raze cities if at gov city-limit. - Make AI move stacks towards enemy units. - Make AI replenish dead stacks. - Make AI place stacks on transports and move towards enemy shoreline. - Make AI spread its naval builds across all good attacking ships (in WAW that's battleships, cruiser, subs and destroyers). - Make AI stack naval units except transport ships to create fleets. // Globals ////////// int_t ArmyStatus[256]; // 0 - dead, 1 - less than 5 units, 2 - alive, 3 - warpathing same continent, 4 - warpathing diff continent, 5 - transports, 6 - garrison int_t ShipFlag; location_t ArmyLocs[256]; // Moving 8 stacks ////////////////// HandleEvent(BeginTurn) 'keep stacks at home' pre { ShipFlag = 0; Check if non-human player & alive; Cycle through 8 armies; Check if army exists on same continent as AI capital and not war-pathing or transported or garrison; Check if army location more than 2 away from AI capital; Un-entrench army; Move army towards capital; Else if within 2 squares of capital; Cancel orders; Stack army; Entrench army; } Else if not on same continent as capital and not war-pathing or transported or garrison; Change army status to 0; } } } } // War-pathing ////////////// HandleEvent(BeginTurn) 'war-pathing' pre { Check if non-human player & alive; Check if at war with someone other than barbs; Check if any armies on the same continent as enemy; Check if any army stack is on garrison status; Ensure city army is in, is building a defensive unit; Check number of defender units in city; If 3 defenders then set army to war-pathing; } } Check if any army stack is next to an enemy city or unit/s on the same continent; Bombard enemy city or unit/s; Attack enemy city or unit/s; Check AI's gov city-limits; If under gov city-limit then free slaves; Set army to garrisoning; Else if at or over gov city-limit; Raze city and continue war-pathing; } } Check for army stacks closest to an enemy city and on the same continent; Move army stacks closer to enemy city; } Check for two other stacks closest to enemy unit/s and on same continent; Move army stacks closer to enemy unit/s; } Else if no armies on the same continent as enemy; Check for less than 2 stacks being transported or warpathing diff continent; Move army stack towards nearest friendly coastal city to capital; Check for army stacks next to 3 transport ships; Move army stack onto transport ships; Stack transport ships; Check for 3 transport ships with army stack; Stack transport ships; Move transport ships to closest enemy coastal city; Check for 3 transport ships with army stack next to nearest enemy coastal city; Unload transport ships next to nearest enemy coastal city; Check for three empty transport ships; Move transport ships towards the closest friendly coastal city to capital; } } } } } // Creating stacks //////////////////// HandleEvent(BeginTurn) 'create stacks' pre { Check if non-human player & alive; Cycle through all cities; Check if any "attack" land units at city location; Cycle through "attack" land units at city location; Check for first available army under 5 units; Move unit to army location; Else if all over 5 units; Check for the smallest of the 8; Move the unit to the smallest army location; } } } } } Cycle through all units; Check if naval unit and not a transport ship; Get unit's location; Get number of units at location; If more than 1 naval unit at location Check if location is a city; Move naval units except transport ships out 1 square; Stack units; Else if location is not a city; Stack units; } Else if only 1 naval unit at location If found nearest naval unit/stack under 12 within 5 squares Move to that square; Stack units; Else if not found naval unit/stack within 5 squares Leave unit be; } } } } } } // Make 1/4 battleships, 1/4 cruisers, 1/4 submarines, 1/4 destroyers ///////////////////////////////////////////////////////////////////// HandleEvent(CreateUnit) pre { Check if non-human player & alive; Check if AI built a naval unit; Check if AI built a cruiser and ShipFlag == 0; NumBships = number of AI battleships; NumCruiser = number of AI cruisers; NumBCruiser = number of AI battlecruisers; NumTCruisers = NumCruiser + NumBCruiser; NumSubs = number of AI submarines; NumUboats = number of AI uboats; NumTSubs = NumSubs + NumUboats; NumDestroyers = number of AI destroyers; Check which of NumBships, NumTCruisers, NumTSubs & NumDestroyers is lowest; Change the ship being built to the "lowest"; ShipFlag = 1; Create the new unit using Event: CreatUnit(..); Stop running this script; } } Else if ShipFlag == 1; ShipFlag == 0; } } } }