[LUA] Enemy Unit Panel

Discussion in 'Civ5 - Creation & Customization' started by martijnaikema, Dec 28, 2010.

  1. martijnaikema

    martijnaikema Warlord

    Joined:
    Oct 30, 2010
    Messages:
    111
    Hi,

    I have a question about the Enemy Unit Panel (at least I think that the panel is called that way). See the screenshot I added. At this screen I see the bonus the unit gets for fighting the barbarian village (Bonus VS Barbarians).

    I want to add a line which displays the bonus for the unit if it is fighting in a river tile. I added the bonus through a promotion, but it isn't showing in the Enemy Unit Panel when I attack from a river tile.

    I searched the Civ5-directory and I think that the correct files are:
    EnemyUnitPanel.lua
    EnemyUnitPanel.xml

    I know it is possible to show the feature bonus here, cause I can see it while I play with the unit Mohawk, the forest and jungle bonus is shown in the panel.

    Can anybody help me with this?
     

    Attached Files:

  2. martijnaikema

    martijnaikema Warlord

    Joined:
    Oct 30, 2010
    Messages:
    111
    The XML I use for the promotion is:

    Spoiler :

    <UnitPromotions_Features>
    <Row>
    <PromotionType>PROMOTION_WATERGEUS</PromotionType>
    <FeatureType>FEATURE_MARSH</FeatureType>
    <Defense>50</Defense>
    <Attack>50</Attack>
    </Row>
    <Row>
    <PromotionType>PROMOTION_WATERGEUS</PromotionType>
    <FeatureType>FEATURE_OASIS</FeatureType>
    <Defense>50</Defense>
    <Attack>50</Attack>
    </Row>
    <Row>
    <PromotionType>PROMOTION_WATERGEUS</PromotionType>
    <FeatureType>FEATURE_RIVER</FeatureType>
    <Defense>50</Defense>
    <Attack>50</Attack>
    </Row>
    </UnitPromotions_Features>


    The thing is that it works for the Marsh-tiles, but not for the River-tiles. Maybe the reason is that in the Civ5Features file, River, Ocean and Lake are defiened as <FakeFeatures>:

    Spoiler :

    <FakeFeatures>
    <Row>
    <ID>0</ID>
    <Type>FEATURE_LAKE</Type>
    <Description>TXT_KEY_CIV5_FEATURES_LAKE_TITLE</Description>
    <Civilopedia>TXT_KEY_CIV5_FEATURES_LAKE_TEXT</Civilopedia>
    <Impassable>true</Impassable>
    <IconAtlas>TERRAIN_ATLAS</IconAtlas>
    <PortraitIndex>10</PortraitIndex>
    </Row>
    <Row>
    <Type>FEATURE_RIVER</Type>
    <Description>TXT_KEY_CIV5_FEATURES_RIVER_TITLE</Description>
    <Civilopedia>TXT_KEY_CIV5_FEATURES_RIVER_TEXT</Civilopedia>
    <Movement>TXT_KEY_CIV5_FEATURES_RIVER_MVT_TEXT</Movement>
    <IconAtlas>TERRAIN_ATLAS</IconAtlas>
    <PortraitIndex>13</PortraitIndex>
    </Row>
    </FakeFeatures>
     
  3. martijnaikema

    martijnaikema Warlord

    Joined:
    Oct 30, 2010
    Messages:
    111
    Another thing I found out is that Lakes and Ocean are both in the Civ5Terrain.xml and Civ5Features.xml (as FakeFeatures).

    So I guess this code does not work:
    <UnitPromotions_Features>
    <Row>
    <PromotionType>PROMOTION_WATERGEUS</PromotionType>
    <FeatureType>FEATURE_RIVER</FeatureType>
    <Defense>50</Defense>
    <Attack>50</Attack>
    </Row>
    </UnitPromotions_Features>

    Is there another way to give an attack and defense bonus on a tile with a river?
     
  4. martijnaikema

    martijnaikema Warlord

    Joined:
    Oct 30, 2010
    Messages:
    111
    I now got the bonus showing up by directly editing the Enemy Unit Panel.



    But it seems like the bonus is showing but it is not calculated in the Strenght. Cause in my opinion the correct strength should be 10 + 50% (bonus vs barbarian) + 50% (river bonus) = 22,5.

    So if anyone could please tell me how and where the :c5strength: Strength is calculated...
     

    Attached Files:

  5. BomberEscort

    BomberEscort Don't be alarmed; this is a kindness Supporter

    Joined:
    Jul 28, 2003
    Messages:
    1,125
    Gender:
    Male
    Location:
    Kansas City
    It's shown in the panel, but isn't being calculated (basically it is shown in the panel, but is never passed to the combat code). Remove the barbarian bonus and the strength will drop to 10. Also, all bonuses are calculated from the base and are additive. For example, a Pikeman with a 100% bonus would be strength 20. For some other peculiarities with bonuses and penalties, see the following thread:

    http://forums.civfanatics.com/showthread.php?p=9919613#post9919613
     
  6. Hesha

    Hesha Prince

    Joined:
    Jan 3, 2011
    Messages:
    407
    I'm sorry, if this is not the appropriate place to post a question like this, but I couldn't find a "General Discussion" thread on Modding...

    Anyways, I've been playing Civ V for a couple of days now and I think it isn't as good as Civ 4 was in many aspects, but since I paid a lot of money for it, I'm gonna play it for another while... and there is one thing, that annoys me more than the rest: Melee Gunpowder Units!!! wtf is the logic behind this? Prehistoric archers have a better range/precision/damage than Musketeers/Riflemen/Infantry? I don't think so... and because this is such an obvious absurdity to me I assume that some others stumpled accross this as well... my question would therefor be: Is anyone currently working on a mod that converts all gunpowder units into Ranged Combat Units OR is it even possible to mod this?

    Thanks!

    EDIT: Uhh, I guess this would be better in "Mod component request"...
     

Share This Page