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

updating CombatClass

Discussion in 'Civ5 - Creation & Customization' started by Ambug666, Feb 25, 2014.

  1. Ambug666

    Ambug666 Chieftain

    Joined:
    Jun 23, 2009
    Messages:
    92
    Is there a way to make a unit that has more than one CombatClass? I wanted to create a promotion that gives an additional bonus vs. barbarians, and I was considering creating a new CombatClass for barbarians and making them all part of it, but I don't want them to lose their original CombatClass.

    Alternatively, is there another way to make a promotion (not policy) that could give a unit a bonus vs. barbarians?

    Thanks!
     
  2. bane_

    bane_ Howardianism High-Priest

    Joined:
    Nov 27, 2013
    Messages:
    1,559
    If I'm not mistaken Barbarians all share a single Civilization (number 63, I believe?), does that solve the problem?
     
  3. Ambug666

    Ambug666 Chieftain

    Joined:
    Jun 23, 2009
    Messages:
    92
    Unfortunately, that only changes the problem to "how can I make a promotion that gives a bonus to units from a specific civilization?" Thanks though....
     
  4. bane_

    bane_ Howardianism High-Priest

    Joined:
    Nov 27, 2013
    Messages:
    1,559
    Hmm, I don't know how far you expect to got with this, but with a bit of lua this actually becomes a pretty easier problem than the one you had.
    You should first check the other sources that give bonuses against barbarians though, and see if you can find an (even) easier way to do it! :)
     
  5. Ambug666

    Ambug666 Chieftain

    Joined:
    Jun 23, 2009
    Messages:
    92
    Yeah, policies have their own way of doing it that I can't leverage. Traits just tend to give promotions to units...
     
  6. Ambug666

    Ambug666 Chieftain

    Joined:
    Jun 23, 2009
    Messages:
    92
    Also, if you create a new UnitCombatInfo, then when units fight that new unit, no animation happens because it apparently uses the UnitCombatInfos type to determine which combat animation to show. :(

    How could I use lua to do this? I don't know enough about lua, but if I'm pointed in the right direction, I can figure it out from there.
     
  7. bane_

    bane_ Howardianism High-Priest

    Joined:
    Nov 27, 2013
    Messages:
    1,559
    You could give an empty promotion (ie: it does nothing) and make a fake Policy (I'm sure this forum has done before, just try a quick search!) linked to the said promotion that gives a bonus against Barbarian like the Honor opener!

    If you can't do it eventually, I'll try to do it for you as soon as I get off work.
     
  8. Ambug666

    Ambug666 Chieftain

    Joined:
    Jun 23, 2009
    Messages:
    92
    I'd be interested to see how you could create a policy that only affected one type of unit and linked it to a promotion. Thanks!
     
  9. bane_

    bane_ Howardianism High-Priest

    Joined:
    Nov 27, 2013
    Messages:
    1,559
    The policy would affect every of your combat units against Barbarians, as it was what you were asking in the OP: "create a promotion that gives an additional bonus vs. barbarians".
    It can be done to just affect one type too, I beleve, but I need you to be clearer if you want just one type. :p
     
  10. Ambug666

    Ambug666 Chieftain

    Joined:
    Jun 23, 2009
    Messages:
    92
    I'm sorry. Yeah, I just want it to affect one type of unit, or a unitclass if that works better. It's for a civ leader trait, that scouts get a bunch of special promotions, only I have to create a new unit since if you give a unit a promotion via Trait_FreePromotionUnitCombats in the leader, it won't give you the promotions that have that as the prerequisite as a choice when you get enough xp. Instead, I need to create a new unit and use Unit_FreePromotions to give them the first promotion in the chain. Sigh.
     
  11. bane_

    bane_ Howardianism High-Priest

    Joined:
    Nov 27, 2013
    Messages:
    1,559
    Ok. Just paste the UA as you want, please.

    I already googled a bit for the Policy idea, so if you could be more precise it would save both of us bunch of time.

    Spoiler :
    The .xml Policy:
    Code:
    		<Row>
    			<Type>POLICY_BARBARIAN_HATE</Type>
    			[U]<BarbarianCombatBonus>25</BarbarianCombatBonus>[/U]
    			<CultureCost>-1</CultureCost>
    		</Row>

    Giving the dummy Policy in Lua without increasing the Policy count.
    Code:
    function BarbHate()
    	local player = Players[iPlayer];
    	if player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_YOURCIV"] then
    		player:SetNumFreePolicies(1)
    		player:SetNumFreePolicies(0)
    		player:SetHasPolicy(GameInfoTypes["POLICY_BARBARIAN_HATE"], true)
    	end
    end
    
    BarbHate()
     
  12. Ambug666

    Ambug666 Chieftain

    Joined:
    Jun 23, 2009
    Messages:
    92
    Thanks very much. I don't see how to make it work for just one unit though.
     
  13. bane_

    bane_ Howardianism High-Priest

    Joined:
    Nov 27, 2013
    Messages:
    1,559
    For just one unit I would've to use Promotions (love them!) and a bit more complicated Lua - Unless I find out there is already Promotions that give bonus against Barbarians.

    So, could you post the whole UA so I can help you with the Scout stuff? :)

    Cheers.
     
  14. Ambug666

    Ambug666 Chieftain

    Joined:
    Jun 23, 2009
    Messages:
    92
    Sorry for the delay. The unit and promotions xml files are in the zip file.

    The relevant unit is UNIT_NV_SCOUT and the promotion is PROMOTION_BLOOD_PACT_SCOUT
     

    Attached Files:

  15. bane_

    bane_ Howardianism High-Priest

    Joined:
    Nov 27, 2013
    Messages:
    1,559
    I just realized I may be using SetCombatStrength() the wrong way.
    I don't know how to make the CombatStrength come back to normal after the attack, but I have an idea...

    Since your Promotion should give bonus against Barbarians only, we don't need to worry about that, I hope.
    See if this works:


    --NOT WORKING--


    Also, these will not work with Strategic View enabled nor with Quick Combat.
    It's a bit late and I'm very tired, so if I forgot something I'll check again tomorrow morning. Cheers! :)
     
  16. Ambug666

    Ambug666 Chieftain

    Joined:
    Jun 23, 2009
    Messages:
    92
    I am continuing to be busy but I hope to test this out this weekend. Thanks!
     
  17. Ambug666

    Ambug666 Chieftain

    Joined:
    Jun 23, 2009
    Messages:
    92
    Well, I tried it and I got the message:
    [89317.280] \Users\Mike\Documents\My Games\Sid Meier's Civilization 5\MODS\Night Vale (v 1)\BloodPactScout: Scout VS Barbarian: Who is the Deadliest Warrior?
    in the log, BUT I got none of the other trace messages when I attacked a barbarian.
    I'm not using the dll or Gedemon's RED, so I changed the triggers.

    If this is too much work, I'll just change it to a bonus for an existing combatclass and won't worry about it. Thanks for your help though!
     
  18. bane_

    bane_ Howardianism High-Priest

    Joined:
    Nov 27, 2013
    Messages:
    1,559
    The problem isn't the CombatClass, but the bonus against Barbarian for just one class (Scout). There is no precedent for that in the game, as far as I know, so you have to create a new code for that from scratch.
    I'll try again in a few minutes.
     
  19. bane_

    bane_ Howardianism High-Priest

    Joined:
    Nov 27, 2013
    Messages:
    1,559
  20. SeriousSham

    SeriousSham Chieftain

    Joined:
    Oct 3, 2014
    Messages:
    1
    Location:
    Seven Seas of Rhye
    Hey, sorry for the necrothread but I'm stumbling on the exact same issue.

    I'd like to give a bonus vs barbs to my UU. Has someone figured it out in the meantime?
     

Share This Page