View Full Version : Python for Mercenary Payment?


loseth
Jan 25, 2006, 10:11 AM
I'm not sure if this has been suggested before, but I'm wondering if it would be possible to use python/XML to create a 'mercenary' type unit that...

a) is much quicker to build than a normal unit (e.g. one or two turns),
b) costs an up-front payment of gold (e.g. 20 gold),
c) costs gold per turn to maintain (e.g. 3 gold), and
d) doesn't count toward total supportable units (i.e. it's 'free' to support aside from the python-generated gold/turn).

If so, how tough would this be to do in python? How would one go about it?

Thanks in advance,

loseth

Kael
Jan 25, 2006, 10:24 AM
I'm not sure if this has been suggested before, but I'm wondering if it would be possible to use python/XML to create a 'mercenary' type unit that...

a) is much quicker to build than a normal unit (e.g. one or two turns),
b) costs an up-front payment of gold (e.g. 20 gold),
c) costs gold per turn to maintain (e.g. 3 gold), and
d) doesn't count toward total supportable units (i.e. it's 'free' to support aside from the python-generated gold/turn).

If so, how tough would this be to do in python? How would one go about it?

Thanks in advance,

loseth

That all can be done. The tough part is getting the AI to understand the new cost of the unit and use it appropriatly. As is the AI will think the unit is awesome for its low production cost compared to its power, make tons of them, run itself into poverty (all the while making more mercenaries) and end up having the units abandon it when it is unable to pay for them.

TheLopez
Jan 25, 2006, 10:47 AM
Actually, I have been mulling this idea as a mod component for a while now. There is no reason why you need to create a new "mercenary" type. What you could do is programmatically create a random number of units with a random level and random set of extra promotions that are valid for that unit type and maybe a couple of "special" promotions. One of the special promotions could be that they get withdraw set to 100%, the reason being that mercenaries are in it for the money and cannot collect if they are dead.

After the units are created they could be given unique names like "Kael's Marauders" or "Loseth's Raiders" etc. Their price would be set according to their type and level. One alternate idea would be that you could hire both single mercenary units or even mercenary groups (which would be considerably more expensive.)

At the beginning of each player turn an interface is displayed allowing for either the hiring or not hiring of the mercenaries. This same interface would also display the maintenance/turn cost. If they are hired then they are randomly placed in a city on the outer edges of the civilization who hired them. If during the time that they are hired the civilization who hired them cannot pay the maintenance/turn cost the mercenaries could either turn into "barbarians" or they would just leave and re-enter the mercenary hiring pool.

Another action that one civilization could do is hire away mercenaries, how that would work I don't know yet.

So what do you guys think? I will probably start working on this as a component for mods if there is enough interest and after I release the next set of mods that I have been working on which should be by the end of the week (I hope).

TheLopez
Jan 25, 2006, 11:15 AM
There is no reason why you need to create a new "mercenary" type. What you could do is programmatically create a random number of units with a random level and random set of extra promotions that are valid for that unit type and maybe a couple of "special" promotions.

The other benefits of using this method rather than hardcoding a mercenary type into a mod is that:
1. It can be easily incorporated into other mods
2. If the mod that it is being incorporated into has new units they would be used to create mercenaries automatically without having to make any modifications so they would be used.