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

Galgus

Emperor
Joined
Aug 22, 2012
Messages
1,705
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:
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.
 
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.
 
The Alien Strains Mod does something like that, but I haven't looked into it to see how exactly it's done.
 
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:
Top Bottom