I start working on the code that spawns animals and monsters randomly. The idea is to pick several random map tiles each turn (the number of these tiles depending on the map size and game speed) and put animal/monster units there, their type depending on terrain and feature type, as well as the techs available to the barbarian civ (which, as far as I remember, depend on the techs researched by the civs). But there is one thing that I need to do, and I don't know how: to prevent the situation where uninhabited islands have lots of low-tech units hanging around, I need to make the units that are too old disappear. So, I need code that does the following:
1. Iterate through all barbarian units
2. Check their age
3. Destroy units that reach certain age (depending on game speed)
Would it be possible using Lua, and if so, how?
1. Iterate through all barbarian units
2. Check their age
3. Destroy units that reach certain age (depending on game speed)
Would it be possible using Lua, and if so, how?