MerakSpielman
Warlord
- Joined
- Oct 27, 2005
- Messages
- 217
I was making a unique unit for my Elf civilization that replaces the normal scout. The idea was to have an "invisible" scout, using the abilities of the submarine.
It shows up in-game as a promotion, but the unit isn't actually invisible. I can tell because barbarians seem to delight in destroying him.
so here's the code snippets that seem to work, as in they don't crash the game and they do show up in game as a promotion the scout possesses:
Why did I leave it saying "<Invisible>INVISIBLE_SUBMARINE</Invisible>" you say? I'm glad you asked. I figure that's where the problem is.
There's another file, called InvisibleInfos.xml. It contains the INVISIBLE_SUBMARINE data, plus a dire warning:
So I erred on the side of caution and didn't create an INVISIBLE_ELVEN_RANGER row in that table. I am unable to change things in CvPlot. It doesn't sound like I can use any sort of function in LUA to change this variable, because it says I should recompile afterwards. This leads me to believe that NUM_INVISIBLE_TYPES is a hard-coded variable that can only be changed manually in the source code.
So I left my Elven Ranger pointing to the INVISIBLE_SUBMARINE definition, hoping it would work. But he fails to turn invisible (and for all I know, I broke the Submarine too, since there are now 2 invisible units).
Does anybody have any ideas? Workarounds? Or should I just come up with a different unit until we get access to the code?
It shows up in-game as a promotion, but the unit isn't actually invisible. I can tell because barbarians seem to delight in destroying him.
so here's the code snippets that seem to work, as in they don't crash the game and they do show up in game as a promotion the scout possesses:
Spoiler :
Code:
<GameData>
<Units>
<Row>
<Class>UNITCLASS_SCOUT</Class>
<Type>UNIT_ELVEN_RANGER</Type>
<Combat>4</Combat>
<Cost>25</Cost>
<Moves>3</Moves>
<CombatClass>UNITCOMBAT_RECON</CombatClass>
<Domain>DOMAIN_LAND</Domain>
<DefaultUnitAI>UNITAI_EXPLORE</DefaultUnitAI>
<Description>TXT_KEY_UNIT_ELVEN_RANGER</Description>
<Civilopedia>TXT_KEY_CIV5_ELVEN_RANGER</Civilopedia>
<Strategy>TXT_KEY_UNIT_ELVEN_RANGER_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_HELP_ELVEN_RANGER</Help>
<NoBadGoodies>true</NoBadGoodies>
<Pillage>true</Pillage>
<MilitarySupport>true</MilitarySupport>
<MilitaryProduction>true</MilitaryProduction>
<ObsoleteTech>TECH_SCIENTIFIC_THEORY</ObsoleteTech>
<GoodyHutUpgradeUnitClass>UNITCLASS_ARCHER</GoodyHutUpgradeUnitClass>
<AdvancedStartCost>10</AdvancedStartCost>
<XPValueAttack>3</XPValueAttack>
<XPValueDefense>3</XPValueDefense>
<UnitArtInfo>ART_DEF_UNIT_SCOUT</UnitArtInfo>
<UnitFlagIconOffset>5</UnitFlagIconOffset>
<IconAtlas>UNIT_ATLAS_1</IconAtlas>
<PortraitIndex>5</PortraitIndex>
</Row>
</Units>
<Unit_AITypes>
<Row>
<UnitType>UNIT_ELVEN_RANGER</UnitType>
<UnitAIType>UNITAI_EXPLORE</UnitAIType>
</Row>
</Unit_AITypes>
<Unit_Flavors>
<Row>
<UnitType>UNIT_ELVEN_RANGER</UnitType>
<FlavorType>FLAVOR_RECON</FlavorType>
<Flavor>7</Flavor>
</Row>
</Unit_Flavors>
<Unit_FreePromotions>
<Row>
<UnitType>UNIT_ELVEN_RANGER</UnitType>
<PromotionType>PROMOTION_IGNORE_TERRAIN_COST</PromotionType>
</Row>
<Row>
<UnitType>UNIT_ELVEN_RANGER</UnitType>
<PromotionType>PROMOTION_INVISIBLE_ELVEN_RANGER</PromotionType>
</Row>
</Unit_FreePromotions>
<UnitPromotions>
<Row>
<Type>PROMOTION_INVISIBLE_ELVEN_RANGER</Type>
<Description>TXT_KEY_PROMOTION_INVISIBLE_ELVEN_RANGER</Description>
<Help>TXT_KEY_PROMOTION_INVISIBLE_ELVEN_RANGER_HELP</Help>
<Sound>AS2D_IF_LEVELUP</Sound>
<Invisible>INVISIBLE_SUBMARINE</Invisible>
<PortraitIndex>59</PortraitIndex>
<IconAtlas>ABILITY_ATLAS</IconAtlas>
<PediaType>PEDIA_ATTRIBUTES</PediaType>
<PediaEntry>TXT_KEY_PEDIA_PROMOTION_INVISIBLE_ELVEN_RANGER</PediaEntry>
</Row>
</UnitPromotions>
Why did I leave it saying "<Invisible>INVISIBLE_SUBMARINE</Invisible>" you say? I'm glad you asked. I figure that's where the problem is.
There's another file, called InvisibleInfos.xml. It contains the INVISIBLE_SUBMARINE data, plus a dire warning:
Spoiler :
Code:
<!--
Very Important: If you change this at all you will need to change
NUM_INVISIBLE_TYPES in CvPlot and recompile (this was done for memory allocation efficiency)
-->
So I left my Elven Ranger pointing to the INVISIBLE_SUBMARINE definition, hoping it would work. But he fails to turn invisible (and for all I know, I broke the Submarine too, since there are now 2 invisible units).
Does anybody have any ideas? Workarounds? Or should I just come up with a different unit until we get access to the code?