1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Making a unit ignore borders

Discussion in 'Mod Creation Help' started by Daenvil, Nov 11, 2017.

  1. Daenvil

    Daenvil Chieftain

    Joined:
    Nov 8, 2017
    Messages:
    1
    Gender:
    Male
    Edit: I solved it, it was a silly mistake in the code.

    I am new to modding and I'm stuck in this. It should be easy, I just want my unique unit (which replaces the settler) to be able to enter any territory, just like missionaries do. I tried to copy the code in the game files and after several tries I have this:

    Code:
    <GameData>
        <Types>
            <Row Type="UNIT_GZ_MIGRANT" Kind="KIND_UNIT"/>
            <Row Type="ABILITY_GZ_MIGRANT_ENTER_FOREIGN_LANDS" Kind="KIND_ABILITY"/>
        </Types>
        <TypeTags>
            <Row Type="UNIT_GZ_MIGRANT" Tag="CLASS_LANDCIVILIAN"/>
            <Row Type="UNIT_GZ_MIGRANT" Tag="CLASS_GZ_MIGRANT"/>
            <Row Type="ABILITY_GZ_MIGRANT_ENTER_FOREIGN_LANDS" Tag="CLASS_GZ_MIGRANT"/>
        </TypeTags>
        <Tags>
            <Row Tag="CLASS_GZ_MIGRANT" Vocabulary="ABILITY_CLASS"/>
        </Tags>
        <UnitAiInfos>
            <Row UnitType="UNIT_GZ_MIGRANT" AiType="UNITAI_SETTLE"/>
            <Row UnitType="UNIT_GZ_MIGRANT" AiType="UNITTYPE_CIVILIAN"/>
        </UnitAiInfos>
        <UnitCaptures>
            <Row CapturedUnitType="UNIT_GZ_MIGRANT" BecomesUnitType="UNIT_BUILDER"/>
        </UnitCaptures>
        <UnitAbilities>
            <Row UnitAbilityType="ABILITY_GZ_MIGRANT_ENTER_FOREIGN_LANDS" Name="LOC_ABILITY_ARCHAEOLOGIST_ENTER_FOREIGN_LANDS_NAME" Description="LOC_ABILITY_ARCHAEOLOGIST_ENTER_FOREIGN_LANDS_DESCRIPTION" Inactive="true"/>
        </UnitAbilities>
        <UnitAbilityModifiers>
            <Row>
                <UnitAbilityType>ABILITY_GZ_MIGRANT_ENTER_FOREIGN_LANDS</UnitAbilityType>
                <ModifierId>GZ_ENTER_FOREIGN_LANDS</ModifierId>
            </Row>
        </UnitAbilityModifiers>
        <Modifiers>
            <Row>
                <ModifierId>GZ_ENTER_FOREIGN_LANDS</ModifierId>
                <ModifierType>MODIFIER_PLAYER_UNIT_ADJUST_ENTER_FOREIGN_LANDS</ModifierType>
            </Row>
        </Modifiers>
        <ModifierArguments>
            <Row>
                <ModifierId>GZ_ENTER_FOREIGN_LANDS</ModifierId>
                <Name>Enter</Name>
                <Value>true</Value>
            </Row>
        </ModifierArguments>
        <ModifierStrings>
            <Row ModifierId="GZ_ENTER_FOREIGN_LANDS" Context="Preview" Text="LOC_ABILITY_ENTER_FOREIGN_LANDS_MODIFIER_DESCRIPTION"/>
        </ModifierStrings>
        <Units>
            <Row UnitType="UNIT_GZ_MIGRANT" BaseMoves="4" Cost="80" AdvisorType="ADVISOR_GENERIC" BaseSightRange="3" ZoneOfControl="false" Domain="DOMAIN_LAND" FormationClass="FORMATION_CLASS_CIVILIAN" FoundCity="true" PopulationCost="1" PrereqPopulation="2" Name="LOC_UNIT_GZ_MIGRANT_NAME" Description="LOC_UNIT_GZ_MIGRANT_DESCRIPTION" CanCapture="False" CostProgressionModel="COST_PROGRESSION_PREVIOUS_COPIES" CostProgressionParam1="30" PurchaseYield="YIELD_GOLD" TraitType="TRAIT_CIVILIZATION_GZ_MIGRANT" PseudoYieldType="PSEUDOYIELD_UNIT_SETTLER"/>
        </Units>
        <UnitReplaces>
            <Row CivUniqueUnitType="UNIT_GZ_MIGRANT" ReplacesUnitType="UNIT_SETTLER"/>
        </UnitReplaces>
    </GameData>
    
     
    Last edited: Nov 11, 2017
  2. kingchris20

    kingchris20 Wisdom Seeker

    Joined:
    Jul 30, 2012
    Messages:
    1,328
    Location:
    Resident of Heaven; Currently in the Waiting Room
    Nice! any idea if this could work with any unit type / ai type?

    EDIT: kind of a stupid question turns out. It looks like using the type tags, we can give any unit class this ability.

    But I do have a question for you. Could your code simply be this? (under UnitAbilityModifiers, just set the modifier ID to "MOD_ENTER_FOREIGN_LANDS", and let the base code handle the rest from there?)

    Code:
    <GameData>
       <Types>
            <Row Type="UNIT_GZ_MIGRANT" Kind="KIND_UNIT"/>
            <Row Type="ABILITY_GZ_MIGRANT_ENTER_FOREIGN_LANDS" Kind="KIND_ABILITY"/>
        </Types>
        <TypeTags>
            <Row Type="UNIT_GZ_MIGRANT" Tag="CLASS_LANDCIVILIAN"/>
            <Row Type="UNIT_GZ_MIGRANT" Tag="CLASS_GZ_MIGRANT"/>
            <Row Type="ABILITY_GZ_MIGRANT_ENTER_FOREIGN_LANDS" Tag="CLASS_GZ_MIGRANT"/>
        </TypeTags>
        <Tags>
            <Row Tag="CLASS_GZ_MIGRANT" Vocabulary="ABILITY_CLASS"/>
        </Tags>
        <UnitAiInfos>
            <Row UnitType="UNIT_GZ_MIGRANT" AiType="UNITAI_SETTLE"/>
            <Row UnitType="UNIT_GZ_MIGRANT" AiType="UNITTYPE_CIVILIAN"/>
        </UnitAiInfos>
        <UnitCaptures>
            <Row CapturedUnitType="UNIT_GZ_MIGRANT" BecomesUnitType="UNIT_BUILDER"/>
        </UnitCaptures>
        <UnitAbilities>
            <Row UnitAbilityType="ABILITY_GZ_MIGRANT_ENTER_FOREIGN_LANDS" Name="LOC_ABILITY_ARCHAEOLOGIST_ENTER_FOREIGN_LANDS_NAME" Description="LOC_ABILITY_ARCHAEOLOGIST_ENTER_FOREIGN_LANDS_DESCRIPTION" Inactive="true"/>
        </UnitAbilities>
        <UnitAbilityModifiers>
            <Row>
                <UnitAbilityType>ABILITY_GZ_MIGRANT_ENTER_FOREIGN_LANDS</UnitAbilityType>
                <ModifierId>MOD_ENTER_FOREIGN_LANDS</ModifierId>
            </Row>
        </UnitAbilityModifiers>
                [snip]
        <Units>
            <Row UnitType="UNIT_GZ_MIGRANT" BaseMoves="4" Cost="80" AdvisorType="ADVISOR_GENERIC" BaseSightRange="3" ZoneOfControl="false" Domain="DOMAIN_LAND" FormationClass="FORMATION_CLASS_CIVILIAN" FoundCity="true" PopulationCost="1" PrereqPopulation="2" Name="LOC_UNIT_GZ_MIGRANT_NAME" Description="LOC_UNIT_GZ_MIGRANT_DESCRIPTION" CanCapture="False" CostProgressionModel="COST_PROGRESSION_PREVIOUS_COPIES" CostProgressionParam1="30" PurchaseYield="YIELD_GOLD" TraitType="TRAIT_CIVILIZATION_GZ_MIGRANT" PseudoYieldType="PSEUDOYIELD_UNIT_SETTLER"/>
        </Units>
        <UnitReplaces>
            <Row CivUniqueUnitType="UNIT_GZ_MIGRANT" ReplacesUnitType="UNIT_SETTLER"/>
        </UnitReplaces>
    </GameData>
     
    Last edited: Dec 24, 2017

Share This Page

Ebates: Get Paid to Shop