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

World Unit Help

Discussion in 'Civ4 - Creation & Customization' started by Underdog Ally, Mar 31, 2020.

  1. Underdog Ally

    Underdog Ally Chieftain

    Joined:
    Feb 22, 2019
    Messages:
    54
    I need some thoughtful input on creating a world unit please. My intention is to make a unit that is globally limited to 1, to be specific a powerful submarine variant the Red October. I thought of making the unit free to the first person who researches fission. But from what I understand free units spawn in the capital and what if the capital isn’t coastal? Would it spawn in a landlocked city? Can I change the spawn location? Any help or tips are greatly appreciated c:
     
  2. MightyToad

    MightyToad Warlord

    Joined:
    Sep 11, 2015
    Messages:
    125
    I don't really know, but assuming there is no xml only way to do this. A work around might be to have it be a normal unit, but limited to 1 like the missionaries are limited to 3.
     
  3. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,523
    Gender:
    Male
    Location:
    Canberra, Australia
    Yes it can spawn in a landlocked city. Been there done that :lol:
    You would probably have to use the canTrain callback and use python. Something similar to what Platyping does in his World Tech mod but for units.
     
    Underdog Ally likes this.
  4. Underdog Ally

    Underdog Ally Chieftain

    Joined:
    Feb 22, 2019
    Messages:
    54
    Thanks for the input ! To make things easy what I might do is instead of making it a “free” unit when reaching the tech first, I will just make it very cheap production cost so that whoever gets the tech first can just build it quickly in a desired city.
     
  5. MightyToad

    MightyToad Warlord

    Joined:
    Sep 11, 2015
    Messages:
    125
    You could also include it in the upgrade path for submarines. Then you could instantly upgrade a normal submarine and have it instantly.

    But, if another civ researches fission and kills your super submarine they could then upgrade one of theirs before you could replace it. Unless each civ is allowed one each.
     
    Underdog Ally likes this.
  6. Underdog Ally

    Underdog Ally Chieftain

    Joined:
    Feb 22, 2019
    Messages:
    54
    I had not considered that once it dies someone else can produce it again, I forget that the 1 allowed limit really means 1 at a time. But that could actually be cool because once it dies someone else can have it and so fourth. That would play into the “defection” tendency that the Red October is known for. Thus it would be a never ending hunt for an elusive, side switching super sub.
     
  7. GreatLordofPie

    GreatLordofPie Warlord

    Joined:
    Nov 20, 2009
    Messages:
    236
    Gender:
    Male
    If you make it a world unit then only one can be built per game
     
    Underdog Ally likes this.
  8. Dumanios

    Dumanios MLG

    Joined:
    Oct 24, 2008
    Messages:
    4,882
    By setting the unitclass's global limit to 1, it will prevent the unit from being rebuilt if it is destroyed. Setting it to 1 per player or team would allow it to be rebuilt, but also let everyone have their own Red October at the same time.

    I think Python trickery can allow you to limit the amount of Red Octobers to 1 on Earth while allowing a new one afterword.

    <UnitClassInfo>
    <Type>UNITCLASS_LION</Type>
    <Description>TXT_KEY_UNIT_LION</Description>
    <iMaxGlobalInstances>-1</iMaxGlobalInstances>
    <iMaxTeamInstances>-1</iMaxTeamInstances>
    <iMaxPlayerInstances>-1</iMaxPlayerInstances>
    <iInstanceCostModifier>0</iInstanceCostModifier>
    <DefaultUnit>UNIT_LION</DefaultUnit>
    </UnitClassInfo>
     
  9. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    3,847
    Gender:
    Male
    Location:
    In a constant brainstorm...
    You can try this:

    <UnitClassInfo>
    <Type>UNITCLASS_LION</Type>
    <Description>TXT_KEY_UNIT_LION</Description>
    <iMaxGlobalInstances>1</iMaxGlobalInstances>

    and

    <UnitInfo>
    <Class>UNITCLASS_LION</Class>
    <Type>UNIT_LION</Type>
    <UniqueNames/>
    <Special>NONE</Special>
    <Capture>UNITCLASS_LION</Capture>

    So there will always be 1 unit. If it is defeated it "changes owner". Well, it will loose all promotions but you can consider it as having a new crew. You can add starting promotions so it won't feel so empty when captured.
     
  10. Underdog Ally

    Underdog Ally Chieftain

    Joined:
    Feb 22, 2019
    Messages:
    54
    Thanks for all the replies :D
     

Share This Page