1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

[XML] What does "AlienLifeform=true" Do exactly?

Discussion in 'CivBE - Modding Help & Mod Creation' started by Galgus, Oct 27, 2017.

  1. Galgus

    Galgus Chieftain

    Joined:
    Aug 22, 2012
    Messages:
    1,695
    I was looking for a way to make the Xeno Swarm and other Harmony unique units benefit from Miasma as the Aliens do, but I'm a bit worried it may cause them to spawn from Alien Nests.

    Edit: Also, where are perks from perk choices upon upgrading a unit found?

    I'm specifically looking for the Architect's perk doubling the effectiveness of support actions.
     
    Last edited: Oct 27, 2017
  2. Valessa

    Valessa Communistress

    Joined:
    Aug 30, 2013
    Messages:
    8,103
    Gender:
    Female
    Not 100% sure, but I think it decides if bonus-damage against Aliens applies, and it prevents the units from being produced.
    Which units spawn from Alien Nests is decided in Aliens.lua, so that won't be a problem.

    Might want to try a promotion instead, they have:

    <Column name="MiasmaFlatHealthMod" type="integer" default="0"/>

    But it's unused in the game, so I don't know whether it actually works.
     
  3. Galgus

    Galgus Chieftain

    Joined:
    Aug 22, 2012
    Messages:
    1,695
    I'll test it later and post whether or not it did.

    But I hit a bigger roadblock that there doesn't seems to be any equivalent to DamageToAdjacentUnitsOnAttack in the Promotions section, though bizarrely they seem to have some similar effects to perks with slightly different names like "MoveAfterAttacking" and "CanMoveAfterAttacking" which I'm hoping will work.

    Is there any workaround to give a unit a perk by default? I didn't see anything referencing that in the Units section.

    My goal is to make traits that unique units get by default a when they upgrade a part of their base form, to make them feel more unique to use sooner.
     
  4. Valessa

    Valessa Communistress

    Joined:
    Aug 30, 2013
    Messages:
    8,103
    Gender:
    Female
    The Alien Strains Mod does something like that, but I haven't looked into it to see how exactly it's done.
     
  5. Galgus

    Galgus Chieftain

    Joined:
    Aug 22, 2012
    Messages:
    1,695
    I'm not very familiar with lua coding, but I think that he first made unit perks.

    Code:
    <UnitUpgrades>
            <Row>
                <Type>UNITUPGRADE_ALIEN_WOLF_BEETLE_MANTIS</Type>
                <Description>TXT_KEY_UNIT_ALIEN_WOLF_BEETLE_MANTIS</Description>
                <UnitType>UNIT_ALIEN_WOLF_BEETLE_MANTIS</UnitType>
                <UpgradeTier>0</UpgradeTier>
                <AnyAffinityLevel>0</AnyAffinityLevel>
                <ExtraProductionCost>0</ExtraProductionCost>
                <FreePerk>UNITPERK_AST_DUMMY</FreePerk>
                <IconAtlas>UNIT_UPGRADE_ATLAS_1</IconAtlas>
                <PortraitIndex>89</PortraitIndex>
            </Row>
    </UnitUpgrade>
    Then tied them to upgrades.


    Code:
    <UnitUpgradePerkChoices>
            <Row>
                <UpgradeType>UNITUPGRADE_ALIEN_WOLF_BEETLE_MANTIS</UpgradeType>
                <PerkType>UNITPERK_ALIEN_WOLF_BEETLE_MANTIS</PerkType>
            </Row>
    </UnitUpgradePerkChoices>

    I have no idea why this dummy perk exists.

    Code:
    <UnitPerks>
            <Row>
                <Type>UNITPERK_AST_DUMMY</Type>
                <PortraitIndex>15</PortraitIndex>
                <IconAtlas>PERK_ATLAS</IconAtlas>
                <PediaType>PEDIA_MEDIC</PediaType>
                <PediaEntry>TXT_KEY_UNITPERK_AST_DUMMY</PediaEntry>
                <ExtraCombatStrength>0</ExtraCombatStrength>
            </Row>
    </UnitPerks>
    But then it looks like he used lua to automatically give those perks to the units


    Code:
    local iUnitWBM = GameInfo.Units["UNIT_ALIEN_WOLF_BEETLE_MANTIS"].ID
    local iUpgradeWBM = GameInfo.UnitUpgrades["UNITUPGRADE_ALIEN_WOLF_BEETLE_MANTIS"].ID
    local iPerkWBM = GameInfo.UnitPerks["UNITPERK_ALIEN_WOLF_BEETLE_MANTIS"].ID

    Code:
    for i = 0, GameDefines.MAX_PLAYERS-1, 1 do
        local pPlayer = Players[i];
        pPlayer:AssignUnitUpgrade(iUnitWBM, iUpgradeWBM, iPerkWBM);
        print("All alien strains perked up for player ".. i .."!")
    end
    Does that seem right?

    It seems like assigning the perks should be as simple as swapping the unit and perk names and making the right perks.

    Edit: When I tried that, it game a lua error on the UNITUPGRADE line.


    Code:
    [1447124.218] Runtime Error: C:\Users\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Affinity units start unique and Naval rebalance (v 1)\Lua/Affinity Unique Upgrade Assign.lua:9: attempt to index a nil value
    stack traceback:
        C:\Users\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Affinity units start unique and Naval rebalance (v 1)\Lua/Affinity Unique Upgrade Assign.lua:9: in function '(main chunk)'
        [C]: in function '(anonymous)'
    [1447124.218] Runtime Error: Error loading C:\Users\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Affinity units start unique and Naval rebalance (v 1)\Lua/Affinity Unique Upgrade Assign.lua.
    stack traceback:
     
    Last edited: Oct 28, 2017

Share This Page