yes removal on spawning (forest)
only the swordsman_ii
The code is basically done - I just have to test everything before submitting. But I'm not happy with the script. Because what you requested is not very likely to happen. Sure, it might in some odd game, but the human player wouldn't even notice it.
The problem is of course that this setup adds lag to the game. Even if looping through and checking all units probably can be counted in micro-seconds per player, it does add up to a full second per game turn. And with hundreds of game turns we're looking at several minutes worth of wait-in-between-turns per game. And this basically just to have an event that probably won't even fire.
Now, I do however propose that you test it out yourself to see if the AI is getting any catapults. And you can easily change the probability - even in mid-game. I'll set it to 5% by default, but you could as well start testing it with a full 100% setting. Because I really don't think that its all that likely that any advanced swordsmen are going to be on tiles with forest that haven't already been chopped down. I was thinking that you could lower the probability as you continue testing, until you find something that seems reasonable. (The optimal setting may or may not turn out to be higher than 5%.)
But if you do find that the catapults that are spawning doesn't do so at an appropriate time, then we can develop this further. Like mimic now the human player would, consciously, build catapults in forests in preparation for an assault. So there would be a sub-routine running whenever a AI player with Construction declares war. Then all the advanced swordsmen of that player are indexed and only those are checked every turn. And if one happens to be in a non-hostile forest tile - then the rest of the code is triggered and spawns a catapult. But it could easily be limited to only one unit and spawn per turn - and perhaps only a few spawns per war. Because the code would terminate once the war has ended.
Or something along these lines. We can figure out the details when and if we reach that point.
I was thinking that for the rebels mod comp for the domestic disputes I was thinking: "why would the romans have barbs spawn out of thei own cities? What if the great wall was there?"
So, I decided that I will make a rebel civ which cannot build settlers (not sure about a unit skin
) which basically only appears with the spawned units (would this work or once it spawns once would it not be able to spawn again?) but it can control cities and be barbarian style (non contactable), What do you think? It may require extra editing of the senario (but nothing too major probably wether I need to add a dead civ at the start)
I don't foresee any problems with anything along these lines, but you could just test what already is in place before adding to the mod. My code should however be robust enough to handle another minor player without any adjustments at all. (Just change the domestic rebels player from the barbarians to the new one.)
Another idea could be that there can only be one rebellion in the game at any given point - to avoid the formation of a super-Civ that picks up free units (and cities) all over the map. So the Rebels code would only run if the new rebel player isn't - currently - active. There could also be a time limit on how long a rebel city could remain independent, again to avoid unforeseen effects when the AI is simply too dumb to retake cities lost to rebels.
With that said, you could also add an "Independent" Civ that represents a city state that was created by the Rebels code spawning rebel units. So once some number of turns has passed (perhaps as soon as the occupation disorder ends) the city will flip to the independent player, freeing up the rebel player to strike somewhere else...
I can already see how this is developing itself into a separate Rebellion mod.