Fabrysse
Charming-snake learner
Hi,
I'd like to add a function to the game, but I don't really know how to do that...
Here is what I want to do :
When you fight a "machine" (tank, plane, artillery, etc), and if you win (perhaps if you kill the unit), you have a percent chance to capture the unit, and then may use it as one of yours.
Imagine that you have defeated a tank, the soldiers in the tank are dead or are gone away. The tank is not every time destroyed. Perhaps, you could repar and use it ?...
How I think I'll do that ?
I thought add a python function like that :
Questions :
I'd like to add a function to the game, but I don't really know how to do that...
Here is what I want to do :
When you fight a "machine" (tank, plane, artillery, etc), and if you win (perhaps if you kill the unit), you have a percent chance to capture the unit, and then may use it as one of yours.
Imagine that you have defeated a tank, the soldiers in the tank are dead or are gone away. The tank is not every time destroyed. Perhaps, you could repar and use it ?...
How I think I'll do that ?
I thought add a python function like that :
- when a unit is killed, if this unit has the "<FormationType>FORMATION_TYPE_MACHINE</FormationType>" (in UnitInfo.xml)
- get a random percent chance that the combat winner capture the unit,
- create the same unit for the winner on the plot from where the attack was launched.
Questions :
- How can I get the unit's FormationType infos with python ?
- Will it run if I try to create a unic unit of civ A for civ B ?
- Can't I just use the XML tag "<Capture>UNITCLASS_MYUNIT</Capture>" (and forgot python stuff) ? And if I use that, will the unit fight before being captured ?