1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

CIV4UnitInfos question

Discussion in 'Civ4 - Creation & Customization' started by Houman, Feb 17, 2006.

  1. Houman

    Houman TR Team Leader

    Joined:
    Jan 24, 2002
    Messages:
    1,083
    Code:
    <UnitClassAttackMod>
    	<UnitClassType>UNITCLASS_WAR_ELEPHANT</UnitClassType>
    	<iUnitClassMod>40</iUnitClassMod>
    </UnitClassAttackMod>
    <UnitClassAttackMod>
    	<UnitClassType>UNITCOMBAT_MELEE</UnitClassType>
    	<iUnitClassMod>50</iUnitClassMod>
    </UnitClassAttackMod>
    Would that mean, if my unit attack an War_Elephant, it would make 90% damage (50% because WE is counting as meele + 40% because it is a war elephant?)

    Thanks
    Houman
     
  2. Houman

    Houman TR Team Leader

    Joined:
    Jan 24, 2002
    Messages:
    1,083
    Another question:

    I would like to give my WAR ELEPHANT trapling bonus. It means when it attacks a stack of Army, it can damage the units it is attacking in full and the two other units in the stack only in half-strength.

    How would you do that please?

    Thanks
    Houman
     
  3. IVZanIV

    IVZanIV Warlord

    Joined:
    Jan 14, 2006
    Messages:
    285
    For the second question, do you mean collateral damage?
     
  4. Kael

    Kael Deity

    Joined:
    May 6, 2002
    Messages:
    17,401
    Location:
    Ohio
    No, it means this units get a 40% strength boost against elephants. The second function won't work because you are trying to use a UnitCombat in a place where it is expecting a UnitClass.
     
  5. For the second question - you can do this with collateral damage, limit it to only 2 extra units and set the damage to 50%, I think it should be something like this:
    Code:
    <iCollateralDamage>50</iCollateralDamage>
    <iCollateralDamageLimit>50</iCollateralDamageLimit>
    <iCollateralDamageMaxUnits>2</iCollateralDamageMaxUnits>
    
    So other than maxunits, the other two values are in percentages. I'm not sure if the collateraldamagelimit suppose to indicate how much health is left or taken. That is, if it's left then in order to be able to kill with collateral damage you want this value at zero, i.e. there's no limit to how much damage you can cause overall. Or it's the other way around, I'm sure someone knows this better.
     
  6. Houman

    Houman TR Team Leader

    Joined:
    Jan 24, 2002
    Messages:
    1,083
    Thank you very much for the comments.

    1) It would be very important to know what iCollateralDamageLimit means exactly.

    2) I have to understand the difference between
    UnitClassAttackMod
    UnitClassDefenseMod
    UnitCombatMod

    And how do they stack together...e.g. does UnitClassAttackMod and UnitCombatMod stack together? WHat is the meaning of each?

    Any idea for both questions?


    Thanks
    Houman
     
  7. Olleus

    Olleus Deity

    Joined:
    Oct 30, 2005
    Messages:
    6,478
    Location:
    Beyond the Veil
    yes.
    If you +50% city attack
    and +50% ranged unit attack

    and you then attack an archer who is in a city you would get a +100% bonus (not 125% the bonus add up but are worked out from the unit base strenght)
     
  8. UnitClassAttackMod and UnitClassDefenseMod modify how your unit performs when attacking or defending against a particular class of units, and class refers to pretty much the actual units, e.g. grenadiers get attack bonus of 50% against riflemen.

    UnitCombatMod modifies how your unit performs when both attacking and defending against a particular combat type of units, and combat type refers to unit classifications, i.e. Melee, Archer (ranged not the unit), Armor, Mounted, etc.

    And as Lord Olleus said, they do stack, but always based off the base value.
     
  9. Houman

    Houman TR Team Leader

    Joined:
    Jan 24, 2002
    Messages:
    1,083
    @Rabbit, White

    I see. So the idea is:

    Code:
    <UnitClassAttackMods>
            <UnitClassAttackMod>
    	       <UnitClassType>UNITCLASS_WAR_ELEPHANT</UnitClassType>
    	       <iUnitClassMod>40</iUnitClassMod>
            </UnitClassAttackMod>
    </UnitClassAttackMods>
    <UnitCombatMods>
    	<UnitCombatMod>
    		<UnitCombatType>UNITCOMBAT_MOUNTED</UnitCombatType>
    		<iUnitCombatMod>50</iUnitCombatMod>
    	</UnitCombatMod>
    </UnitCombatMods>
    
    Now my Unit is able according to the above values, to fight (attack and defend) all the mounted units (e.g. Elephants and Knights). However against Elephants the Unit will fight even better for another 40%, but only if attacking it. Not if defending.

    Summary:
    Unit attacks or defends Knights = 50% of base
    Unit attacks War Elephants = 50% of base + 40% of base
    Unit defends War Elephants = only 50% of base

    Is this correct?

    Thank you,
    Houman

    P.S. I am still looking for the meaning of iCollateralDamageLimit. If anyone has a clue, please enlighten me. ;)
     
  10. talchas

    talchas Prince

    Joined:
    Jan 3, 2006
    Messages:
    428
    Just a guess, but perhaps either the maximum amount of damage it can do in one attack (ie it can only do up to x% damage/turn) or the max amount of damage it can do period (it can't hurt them past x% damage).

    EDIT: it appears that it is the latter.
     
  11. Vadus

    Vadus pretend the impossible

    Joined:
    Nov 23, 2003
    Messages:
    374
    Location:
    Northern Germany
    hey, is it possible to get the UnitClassType over the GlobalContext only with the Unit-Description ?
    like gc.getUnitTypeByDescription(string description)

    I didn't find anything like that in the API , but maybe somebody already created such a function? :hmm:
     
  12. talchas

    talchas Prince

    Joined:
    Jan 3, 2006
    Messages:
    428
    You could go through every UnitType by hand and check each one's description, but why do you want to? You can easily get the unittype (or unitclass type) number from the <Type> info.
     
  13. Houman

    Houman TR Team Leader

    Joined:
    Jan 24, 2002
    Messages:
    1,083

    Are you sure? Have you tested it? ;)

    Cheers
    Houman
     
  14. Junuxx

    Junuxx Emperor

    Joined:
    Sep 6, 2005
    Messages:
    1,153
    Location:
    the Netherlands
    talchas is right.
     
  15. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    http://civ4wiki.com/wiki/index.php/CIV4UnitInfos
     
  16. Vadus

    Vadus pretend the impossible

    Joined:
    Nov 23, 2003
    Messages:
    374
    Location:
    Northern Germany
    yes .. hmm..
    I want to display a unit with addUnitGraphicGFC( ) from a list ( of unit-descriptions).
    This is working a bit with this method - params :


    Code:
    self.screen.addUnitGraphicGFC( "InterfaceUnitModel", 
                           gc.getUnitInfo(self.unitList.index(
                                      self.screenValues["unitDescription"])
                                      ).getUnitClassType(), 
                           self.xcentre - self.WIDTH/6, 
                           self.ycentre - 250, 
                           self.WIDTH/3, 
                           200, 
                           WidgetTypes.WIDGET_UNIT_MODEL,
                           gc.getUnitInfo(self.unitList.index(
                                      self.screenValues["unitDescription"])
                                      ).getUnitClassType(), 
                           -1,  -20, 30, 1, False )
    
    the unitList contains all unit-descriptions and was built up this way :
    Code:
    self.unitList = []
            for i in range(gc.getNumUnitInfos()):
                self.unitList.append(gc.getUnitInfo(i).getDescription())
    
    screenValues is a directory, and screenValues["unitDescription"] contains a valid unitDescription, which I can change during runtime.

    but when testing to display several units over this way, only the first 6 units are being displayed correctly. Then I get the normal worker graphic for the 7th unit (fast worker) . From this point the unit graphics are shifted to their ID's (or descriptions) somehow .. :hmm:

    Edit
    I debugged this issue with ingame messages. I'm really displaying unit # 74 (Jet) in method addUnitGraphicGFC(...) but get the graphic for modern armor ! :confused: :sad:
     
  17. Belizan

    Belizan Emperor

    Joined:
    Jan 11, 2006
    Messages:
    1,060
    You can test all this by use the alt key to get odds tooltips on perspective match ups. Just go into the game, spawn the units you want and check the odds.
     
  18. Belizan

    Belizan Emperor

    Joined:
    Jan 11, 2006
    Messages:
    1,060
    try
    Code:
    gc.getUnitInfo(self.unitList.index(
                                      self.screenValues["unitDescription"])
                                      ).[B]getUnitType[/B]()
    
     
  19. Vadus

    Vadus pretend the impossible

    Joined:
    Nov 23, 2003
    Messages:
    374
    Location:
    Northern Germany
    CvUnitInfo Object has no attribute 'getUnitType' :(
    Because of this I took .getUnitClassType()
     
  20. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    That's the one he meant.

    What's this code for by the way?

    Oh, and we're going slightly off topic here :mischief:
     

Share This Page