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

Unique Units that don't replace "standard" units.

Discussion in 'Civ4 - Creation & Customization' started by Matty R, Oct 17, 2009.

  1. Matty R

    Matty R Veteran Newbie

    Joined:
    Jun 17, 2006
    Messages:
    416
    Location:
    Bolton, England
    Hello :)

    I was wondering if somene could help me with something.

    I want to make what I've called "Deviant" units to practise with combat. I want to give them "Hidden Nationality" and "Explore Enemy Territory" and use them as mischief-makers when I want a change from developing my empire. I'll be able to practise combat without going to war.

    But, I still want to keep the standard units for when I do got to war.

    Is there a way to have a choice of two types of the same unit, with one of those units being unique to my civ?

    For example :

    Axeman
    5 Strength
    1 Movement
    +50% vs Melee Units

    Deviant Axeman
    4 Strength
    2 Movement
    Hidden Nationality
    Can Explore Enemy Territory

    So with these, I can produce both the standard Axeman and the Deviant Axeman at any one time.

    I'm thinking of producing a Deviant variation of most units, and maybe putting a cap on how many I can have at one time. At the moment, I'm playing for training purposes on Settler difficulty. It's not about the challenge yet, just the fun. :)

    So far, the only thing I've come up with is creating a seperate UnitClass entry in UnitClassInfos, but that didn't allow me to create both of the Archers I was experiementing with. It did show both units on the Tech Tree though.

    I'd appreciate any help with this. I don't have a clue.

    Thanks.
     
  2. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
    This is kind of hack-y, but you could do it this way:

    Make a Unit that has an icost of -1 (so no one can build it.)
    Then, give a Civilization a UU replacing that unit, but with a real cost, so only that civilization can build it.

    Again, as I said, a little hacky, but it should work.
     
  3. GeoModder

    GeoModder Deity

    Joined:
    Nov 29, 2005
    Messages:
    7,512
    I though creating a separate unitclass should have done the job. What happens if you try to build the other unit? Nothing? Error message? CTD?
     
  4. Tholish

    Tholish Emperor

    Joined:
    Jul 5, 2002
    Messages:
    1,344
    Location:
    Japan
    It simply doesn't show in the list of available units Another way to do it is to make the primary unit require a tech that is disabled and placed at 0,0 on the tech advisor. More mouse clicks though.
     
  5. zyphyr

    zyphyr Prince

    Joined:
    Oct 30, 2005
    Messages:
    461
    The absolute simplest way :

    Give the new UU an UnitClass with the DefaultUnit set to NONE.
     
  6. Matty R

    Matty R Veteran Newbie

    Joined:
    Jun 17, 2006
    Messages:
    416
    Location:
    Bolton, England
    Thanks for the replies. :)

    I'll give that a go when I get some time. A bit of extra effort, but if it works, great. :)

    So I could copy the UnitInfos for the Axeman, rename it, change it's iCost to -1 then create my Deviant Axeman using the same method.

    Wouldn't the copied Axeman replace the standard Axeman, then my Deviant Axeman would replace the copy? I'm confuseded. :crazyeye:

    I get this :
    Spoiler :


    Both standard and unique Archers shown in Tech tree.



    Only the unique Archer is available for production.


    Unique Archer produced without problems, and able to move.




    I don't really understand how to do that, and I don't want to start disabling techs. I was hoping to have my Deviant units available at the same time as their standard version. Thanks for the suggestion though. Might come in handy at some point. :)

    I went back into the UnitClassInfos and changed the default unit to NONE, but it just removed the standard Archer from the Tech Tree. The unique unit still replaces it.
     
  7. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
    Not quite. You need to make dummy units, just name it UNITCLASS_DUMMYUNIT1, like that, and the just redirect the Art to the warrior art or something, sense no one will ever build it any way, and if the icost is -1, it won't show in the civilopedia. Then, have the UU replace the dummy unit, with a real Icost.
     
  8. Matty R

    Matty R Veteran Newbie

    Joined:
    Jun 17, 2006
    Messages:
    416
    Location:
    Bolton, England
    I've gone back into the UnitClassInfos and realised I hadn't altered the UU's section in CivilizationInfos.

    Now the unit is unique to the Viking Empire and doesn't replace the standard Archer, but the Sevopedia doesn't say it's unique/replaces and the game crashes when I try to build a standard Archer. I can build the unique Archer without any problems.

    These are the alterations I have for my unique Archer :

    UnitClassInfos
    Type : UNITCLASS_CITY_GUARDIAN
    Description : TXT_KEY_UNIT_CITY_GUARDIAN
    DefaultUnit : NONE

    UnitInfos
    Class : UNITCLASS_CITY_GUARDIAN
    Type : UNIT_VIKING_CITY_GUARDIAN

    CivilizationInfos
    UnitClassType : UNITCLASS_CITY_GUARDIAN
    UnitType : UNIT_VIKING_CITY_GUARDIAN

    I also have the relevant text file edited aswell.

    Am I missing something? If I can't get this to work, I'll try the Dummy Unit idea.
     
  9. mechaerik

    mechaerik Tuturuu!

    Joined:
    Oct 28, 2008
    Messages:
    7,064
    Location:
    Los Angeles
    If you want the cleanest, best way to do it (but definitely not the easiest) do it via DLL. In xienwolf's SDK tutorial thread, this is done as an example. He added a tag <bUnique> to the XML file that makes it... well unique, without replacing anything.
     
  10. Matty R

    Matty R Veteran Newbie

    Joined:
    Jun 17, 2006
    Messages:
    416
    Location:
    Bolton, England
    I've just had a look at that walkthrough. Really not for me. :eek: :sad:

    It was tempting though. At first. Before seeing how much work was involved. :mischief:

    Oh yeah. I forgot to mention something. In Civ4 v1.54 (I think that was the version) I got all of this to work by adding the new UnitClassInfos section. I had two types of Greek Artillery. One was standard and the other was more defensive, they could both be built in the same game and they both worked fine. So I know it has been possible to do this. :)
     
  11. God-Emperor

    God-Emperor Deity

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    This looks fine.

    Did you undo any changes you made to the archer unit and class? Those should be exactly the same as they were before you started.
     
  12. Matty R

    Matty R Veteran Newbie

    Joined:
    Jun 17, 2006
    Messages:
    416
    Location:
    Bolton, England
    Erm, I'm not sure what you mean. :blush:

    I haven't done anything to the standard Archer, the one that is available to all civs. I copied the Archer's UnitInfos and pasted the copy at the bottom of the XML, then did my editing for the unique Archer there.
     

Share This Page