Dynamic unit values

OrionVeteran

Deity
Joined
Dec 25, 2003
Messages
2,443
Location
Newport News VA
Is there a way to use python to give a unit a promotion capability, without refering to an actual promotion? Example: I want to increase the iCombat value for one unit (Say a Warrior) to a python specified new value. Warriors have an iCombat value of 2. Let's say I want to increase it to 4. Can it be done with python without modifying the XML or refering to a promotion?
 
I haven't tried it but CyUnit.setBaseCombatStr (INT iCombat) should work. If you need a place to put it CvEventManager.onUnitCreated would probably work.
 
All units of one specific type or just one individual unit? All players or only one specific one?
 
This seems like it could be confusing to players if it happens for certain unit instances but not others. "Why does this warrior have strength 2 and that warrior, with identical graphics and promotions, have strength 4?" Is there a strong reason not to do this with promotions? It is easy to add and subtract promotions in python, and there is no reason to keep small the number of possible promotions.
 
I haven't tried it but CyUnit.setBaseCombatStr (INT iCombat) should work. If you need a place to put it CvEventManager.onUnitCreated would probably work.

Yes, that works, but the problem is, that the strength addition will vanish, when you upgreade the unit.
 
Yes, that works, but the problem is, that the strength addition will vanish, when you upgreade the unit.

It looks like that's what he wants.
 
Sorry I haven't replied back to all of you about this request. I have been working on my latest mod pack that is soon to be released. I won't spill the beans on that mod just yet. As for this request, the reason I asked about dynamic promotions is because I want to bring back an old concept we loved in Civ3: The Army! Yes. I want to use Python to calculate the collective power and maintenance cost of say 3 chosen units on a specified plot and create 1 Army unit, giving it the total strength and cost of the 3 units. Lastly, the Python would delete the 3 units in favor of the newly created Army unit. Since you can have several Army units in the game, the combat strength will be different for each one, as different units can be selected to create the Army. The result would allow old units to be combined into a formidable force that is useful on the battlefield. Thus, my request for a dynamic promotion. What do you think?

Here is the concept: http://www.civfanatics.com/civ3/strategy/armies.php
 
No, an upgrade to another unit.
e.g. you give a warrior the promotion "+1 strength", so that he has a strength of 2.
If you then upgrade the warrior to an axeman, the axeman will only have its default strength (=5), and will not get the strength bonus from the promotion.

There's a SDK version for this out, where the bonus will carry over, look at the profile of theLadiesOgre.
 
Sorry I haven't replied back to all of you about this request. I have been working on my latest mod pack that is soon to be released. I won't spill the beans on that mod just yet. As for this request, the reason I asked about dynamic promotions is because I want to bring back an old concept we loved in Civ3: The Army! Yes. I want to use Python to calculate the collective power and maintenance cost of say 3 chosen units on a specified plot and create 1 Army unit, giving it the total strength and cost of the 3 units. Lastly, the Python would delete the 3 units in favor of the newly created Army unit. Since you can have several Army units in the game, the combat strength will be different for each one, as different units can be selected to create the Army. The result would allow old units to be combined into a formidable force that is useful on the battlefield. Thus, my request for a dynamic promotion. What do you think?

Here is the concept: http://www.civfanatics.com/civ3/strategy/armies.php

With the StackAid modcomp by GIR units in a stack can get promotions based on the units in that stack.

Look here

Hope this is useful :)
 
No, an upgrade to another unit.
e.g. you give a warrior the promotion "+1 strength", so that he has a strength of 2.
If you then upgrade the warrior to an axeman, the axeman will only have its default strength (=5), and will not get the strength bonus from the promotion.

There's a SDK version for this out, where the bonus will carry over, look at the profile of theLadiesOgre.

OK great. :)

Thanks.
 
Top Bottom