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

EnemyDamageChance

Discussion in 'Civ5 - Creation & Customization' started by Frossa, Oct 1, 2015.

  1. Frossa

    Frossa Chieftain

    Joined:
    Apr 29, 2012
    Messages:
    409
    Gender:
    Male
    Location:
    Sweden
    I played the Conquest of the New World scenario, and I find risking getting damaged upon ending your turn in hostile territory to be a highly immersive and exciting feature I simply need to implement in my own games. Looking in the files for the scenario I see the Scurvy Promotion which causes it, utilizing the EnemyDamageChance and NeutralDamageChance columns.
    When attempting to recreate this however, the columns don't seem to be doing anything. The new Promotion shows up in the game just fine, but Units with it are not taking the expected damage, even if I set it to <NeutralDamageChance>100</NeutralDamageChance> (this should mean they have a 100% chance of taking 10 HP of damage each turn).
    Do EnemyDamageChance and NeutralDamageChance just not work without some kind of Lua configuration or something? I tried looking throughout the rest of the files for the scenario but couldn't find anything that seemed to be related to this feature, so I'm rather clueless.
     
  2. AW Arcaeca

    AW Arcaeca Deus Vult

    Joined:
    Mar 10, 2013
    Messages:
    2,958
    Gender:
    Male
    Location:
    Operation Padlock ground zero
    Click here and here
    There's so many hundreds of thousands of things that could've gone wrong, and modders aren't psychic.
     
  3. Frossa

    Frossa Chieftain

    Joined:
    Apr 29, 2012
    Messages:
    409
    Gender:
    Male
    Location:
    Sweden
    Sorry if I was unclear, but this is not a call for help with something that isn't working. I haven't done anything wrong in the process of trying this thing out, I was just wondering if somebody happened to know something about the above mentioned columns...
     
  4. AW Arcaeca

    AW Arcaeca Deus Vult

    Joined:
    Mar 10, 2013
    Messages:
    2,958
    Gender:
    Male
    Location:
    Operation Padlock ground zero
    :confused: Then what did you mean by...?

    My impression was therefore that you had in fact attempted this and maybe you misspelled the column name or whatever else.
     
  5. Frossa

    Frossa Chieftain

    Joined:
    Apr 29, 2012
    Messages:
    409
    Gender:
    Male
    Location:
    Sweden
    Ah. Well, no. It's just that they clearly don't seem to be working. I copy pasted it from the official Conquest of the New World XML files. Googling for EnemyDamageChance yields no answers either, so I guess it's just uncharted territory in general. Quite surprising, you'd think the modding community would be all over this feature.
     
  6. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,120
    Location:
    Illinois, USA
    We would want to have a look at the actual code of what you are doing and in what "context". If in a mod, you should just add the mod as an attachment to a post whoward69's zip your mods and attach tutorial

    Firaxis is using lua to give all the European Players the Promotion for "free", and then allowing a redrafted version of the Public School (Which they turn into a "Navigation School" within the Scenario) to remove the Scurvy promotion for units constructed in that city.

    I didn't really see anything else in the Scenario's lua file that would lead me to believe there are additional implimentations for the promotion in there, but most of the Scenario Lua-files are convoluted enough it would take more time to examine what is going on in there.

    Just bear in mind that the Firaxis-made scenarios are all their own special-snowflake environments, and what Firaxis wrote-into the game's LUA/DLL code is not always something the average mod-maker is able to use. A further examination shows me nothing within the Scenario's "TurnsRemaining.lua" anything they are doing within there to impliment the "attrition" effect. So I would have to say there is still something you are not doing right, or just plain old *sigh* Firaxis.

    As a side note, JFD has a similar if not the same effect in his ExCE mod (Exploration Continued Expanded).
     
  7. Frossa

    Frossa Chieftain

    Joined:
    Apr 29, 2012
    Messages:
    409
    Gender:
    Male
    Location:
    Sweden
    The functions of the Promotion being delved away in some obscure or unreachable line of code somewhere is what I feared from the start. I will look into JFD's mod though, maybe there's something there I can use. Thanks. :)
     
  8. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,301
    Location:
    Near Portsmouth, UK
    Without a corresponding <NeutralDamage> entry, it actually means you have a 100% chance of taking 0 HP per turn.

    Which is why we ask to see the totality of what you've actually edited/written, otherwise you're asking us to guess.
     
  9. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,120
    Location:
    Illinois, USA
    His question has me even more confused now, because the New World Scenario's TechTreeUpdate.xml has:
    Code:
    	<UnitPromotions>
    		<Row>
    			<Type>PROMOTION_SCURVY</Type>
    			<Description>TXT_KEY_PROMOTION_SCURVY</Description>
    			<Help>TXT_KEY_PROMOTION_SCURVY_HELP</Help>
    			<Sound>AS2D_IF_LEVELUP</Sound>
    			<CannotBeChosen>true</CannotBeChosen>
    			<EnemyDamageChance>65</EnemyDamageChance>
    			<NeutralDamageChance>65</NeutralDamageChance>
    			<PortraitIndex>57</PortraitIndex>
    			<IconAtlas>ABILITY_ATLAS</IconAtlas>
    			<PediaType>PEDIA_ATTRIBUTES</PediaType>
    			<PediaEntry>TXT_KEY_PEDIA_PROMOTION_SCURVY</PediaEntry>
    		</Row>
    	</UnitPromotions>
    	<UnitPromotions_UnitCombats>
    		<Row>
    			<PromotionType>PROMOTION_SCURVY</PromotionType>
    			<UnitCombatType>UNITCOMBAT_NAVAL</UnitCombatType>
    		</Row>
    	</UnitPromotions_UnitCombats>
    
    But I don't see NeutralDamage or EnemyDamage anywhere.
     
  10. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,301
    Location:
    Near Portsmouth, UK
    New World (DLC-2) is G&K

    Conquest of the New World (DLC-7) is BNW

    BNW added the two new columns
     
  11. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,120
    Location:
    Illinois, USA
    Ah, OK, thar she blows!
    Code:
    		<Row>
    			<Type>PROMOTION_SCURVY</Type>
    			<Description>TXT_KEY_PROMOTION_SCURVY</Description>
    			<Help>TXT_KEY_PROMOTION_SCURVY_HELP</Help>
    			<Sound>AS2D_IF_LEVELUP</Sound>
    			<CannotBeChosen>true</CannotBeChosen>
    			<EnemyDamageChance>50</EnemyDamageChance>
    			<NeutralDamageChance>50</NeutralDamageChance>
    			[COLOR="Blue"]<EnemyDamage>10</EnemyDamage>
    			<NeutralDamage>10</NeutralDamage>[/COLOR]
    			<PortraitIndex>57</PortraitIndex>
    			<IconAtlas>ABILITY_ATLAS</IconAtlas>
    			<PediaType>PEDIA_ATTRIBUTES</PediaType>
    			<PediaEntry>TXT_KEY_PEDIA_PROMOTION_SCURVY</PediaEntry>
    		</Row>


    'Interesting' that the G&K definition of UnitPromotions has the two columns, but they weren't used in the G&K version of the scenario's promotion. Just one more helpful consistency from Firaxis, I guess. I should know by now, however, one should always play the here's a folder, there's a folder, everywhere there's another folder game when attempting to see how Firaxis used something.
     
  12. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,301
    Location:
    Near Portsmouth, UK
    Or do what I do and just look in the C++ source code

    Spoiler :
    Code:
    if(... getEnemyDamageChance() > 0 && getEnemyDamage() > 0)
    {
        ... apply enemy territory attrition
    }
    else if(getNeutralDamageChance() > 0 && getNeutralDamage() > 0)
    {
        ... apply neutral territory attrition
    }
    
     
  13. Frossa

    Frossa Chieftain

    Joined:
    Apr 29, 2012
    Messages:
    409
    Gender:
    Male
    Location:
    Sweden
    I guess looking in the pre-BNW scenario files didn't help, but I really didn't expect there to have been any difference between the Promotion in the vanilla scenario and the Deluxe one. There not being an input for the amount of damage dealt each turn just made me think it defaulted to 10, like in the New World scenario.
    But anyway, adding the EnemyDamage columns did work, so thank you so very much :D and apologies for the confusion.
     

Share This Page