Create a Hovering Unit

thelijah

Chieftain
Joined
Jul 18, 2016
Messages
53
Location
New Jersey, US
So I've been trying to make a unit that can hover over all terrain (land, sea, mountain, and ice).

I didn't want to create a new thread, but I've only been able to gather limited information from threads loosely related to this, and it hasn't helped much. I hope this is the right forum.

Based on what I've been finding, people have only been able to succeed at creating a new land unit that can hover over land, mountain, ice, and coast but no ocean. So I changed my desired "hovering" unit's domain to sea (to fix the ocean problem) and added the following promotions as suggested (to allow it to traverse on land).

Spoiler :
<Units>
<Row>
<Type>UNIT_HOVERING</Type>
<!-- I created this class in a separate document -->
<Class>UNITCLASS_CAPITAL</Class>
<PrereqTech>TECH_AGRICULTURE</PrereqTech>
<Combat>90</Combat>
<RangedCombat>50</RangedCombat>
<Cost>1000</Cost>
<Moves>5</Moves>
<Range>2</Range>
<CombatClass>UNITCOMBAT_NAVAL</CombatClass>
<Domain>DOMAIN_SEA</Domain>
<DefaultUnitAI>UNITAI_CARRIER_SEA</DefaultUnitAI>
<Description>TXT_KEY_UNIT_STARDESTROYER</Description>
<Civilopedia>TXT_KEY_UNIT_STARDESTROYER_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_STARDESTROYER_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_STARDESTROYER_HELP</Help>
<MilitarySupport>true</MilitarySupport>
<MilitaryProduction>true</MilitaryProduction>
<Pillage>false</Pillage>
<IgnoreBuildingDefense>true</IgnoreBuildingDefense>
<Mechanized>true</Mechanized>
<AdvancedStartCost>100</AdvancedStartCost>
<XPValueAttack>3</XPValueAttack>
<XPValueDefense>3</XPValueDefense>
<SpecialCargo>SPECIALUNIT_FIGHTER</SpecialCargo>
<DomainCargo>DOMAIN_AIR</DomainCargo>
<UnitArtInfo>ART_DEF_UNIT_SMOKEY_STEAM_AIRSHIP</UnitArtInfo>
<MoveRate>BOAT</MoveRate>
<UnitFlagIconOffset>8</UnitFlagIconOffset>
<UnitFlagAtlas>EXPANSION_SCEN_UNIT_FLAG_ATLAS</UnitFlagAtlas>
<PortraitIndex>8</PortraitIndex>
<IconAtlas>EXPANSION_SCEN_UNIT_ATLAS</IconAtlas>
</Row>
</Units>


I added the following promotions;
Spoiler :
<Unit_FreePromotions>
<Row>
<UnitType>UNIT_HOVERING</UnitType>
<PromotionType>PROMOTION_CARGO_III</PromotionType>
</Row

<!-- Custom promotion I made to allow travel over land, mountain, and ice -->
<Row>
<UnitType>UNIT_HOVERING</UnitType>
<PromotionType>PROMOTION_MOVEALL</PromotionType>
</Row>


<Row>
<UnitType>UNIT_HOVERING</UnitType>
<PromotionType>PROMOTION_NO_DEFENSIVE_BONUSES</PromotionType>
</Row>

<Row>
<UnitType>UNIT_HOVERING</UnitType>
<PromotionType>PROMOTION_ONLY_DEFENSIVE</PromotionType>
</Row>

<Row>
<UnitType>UNIT_HOVERING</UnitType>
<PromotionType>PROMOTION_NO_CAPTURE</PromotionType>
</Row>

<!-- I doubt both of the following are necessary together, but I'm not worried about them right now. -->
<Row>
<UnitType>UNIT_HOVERING</UnitType>
<PromotionType>PROMOTION_FLAT_MOVEMENT_COST</PromotionType>
</Row>

<Row>
<UnitType>UNIT_HOVERING</UnitType>
<PromotionType>PROMOTION_IGNORE_TERRAIN_COST</PromotionType>
</Row>


The PROMOTION_MOVEALL contains

Spoiler :
<Row>
<Type>PROMOTION_MOVEALL</Type>
<Description>TXT_KEY_PROMOTION_MOVEALL</Description>
<Help>TXT_KEY_PROMOTION_MOVEALL_HELP</Help>
<Sound>AS2D_IF_LEVELUP</Sound>
<OrderPriority>2</OrderPriority>
<HoveringUnit>1</HoveringUnit>
<CanMoveImpassable>1</CanMoveImpassable>
<PortraitIndex>58</PortraitIndex>
<IconAtlas>ABILITY_ATLAS</IconAtlas>
<PediaType>PEDIA_ATTRIBUTES</PediaType>
<PediaEntry>TXT_KEY_PEDIA_PROMOTION_MOVEALL</PediaEntry>
</Row>


My UNIT_HOVERING shows up in the game fine, along with other units I've created.
The PROMOTION_MOVEALL appears in the game fine, along with other promotions I created in the same document, it just doesn't provide the expected function.

I initially was using <CanMoveAllTerrain>, but I learned that promotion is broken.

I don't know if I'm going at it wrong, or if what I'm trying to do is blocked by hardcode, but if anyone knows how to fix this or has another [non-extreme] method to get what I'm trying to do done, I'm all ears.

Thanks in advance.
 
Hey mate, I've been mostly successful in creating a hovering unit that can move through all terrain, yes including water, by using the airships promotion from the Smoky Skies Scenario.


Just before adding the unit, I delete embarkation and embarkation promotions from a combatclass I know i won't need for the scenario, in this case bomber and also useless promotions for such a unit.

Spoiler :

<!-- Hovering Unit-->
<UnitPromotions_UnitCombats>
<!-- Airships-->
<Delete PromotionType="PROMOTION_EMBARKATION" UnitCombatType="UNITCOMBAT_BOMBER"/>
<Delete PromotionType="PROMOTION_DEFENSIVE_EMBARKATION" UnitCombatType="UNITCOMBAT_BOMBER"/>
<Delete PromotionType="PROMOTION_ALLWATER_EMBARKATION" UnitCombatType="UNITCOMBAT_BOMBER"/>
<Delete PromotionType="PROMOTION_AIR_AMBUSH_1" UnitCombatType="UNITCOMBAT_BOMBER"/>
<Delete PromotionType="PROMOTION_AIR_AMBUSH_2" UnitCombatType="UNITCOMBAT_BOMBER"/>
<Delete PromotionType="PROMOTION_AIR_RANGE" UnitCombatType="UNITCOMBAT_BOMBER"/>
<Delete PromotionType="PROMOTION_EVASION" UnitCombatType="UNITCOMBAT_BOMBER"/>
</UnitPromotions_UnitCombats>


I then add the Promotion

Spoiler :

<UnitPromotions>
<Row>
<Type>PROMOTION_MOVE_ALL_TERRAIN</Type>
<Description>TXT_KEY_PROMOTION_MOVE_ALL_TERRAIN</Description>
<Help>TXT_KEY_PROMOTION_MOVE_ALL_TERRAIN_HELP</Help>
<Sound>AS2D_IF_LEVELUP</Sound>
<IconAtlas>ABILITY_ATLAS</IconAtlas>
<PediaType>PEDIA_ATTRIBUTES</PediaType>
<PortraitIndex>58</PortraitIndex>
<PediaEntry>TXT_KEY_PROMOTION_MOVE_ALL_TERRAIN</PediaEntry>
<CanMoveAllTerrain>true</CanMoveAllTerrain>
<LostWithUpgrade>1</LostWithUpgrade>
</Row>
</UnitPromotions>


When adding the unit, make sure you use the correct combat class, in this case it would be <CombatClass>UNITCOMBAT_BOMBER</CombatClass>

And finally don't forget to add the promotion to the unit, as well as flat movement cost, so that it can move more like a hovering unit should

Spoiler :
<Unit_FreePromotions>
<Row>
<UnitType>UNIT_DRAGON</UnitType>
<PromotionType>PROMOTION_FLAT_MOVEMENT_COST</PromotionType>
</Row>
<Row>
<UnitType>UNIT_DRAGON</UnitType>
<PromotionType>PROMOTION_MOVE_ALL_TERRAIN</PromotionType>
</Row>
</Unit_FreePromotions>




I've tested this out in 2 mods, and it's worked fine for me. The unit can fly over any terrain type including mountains (without taking damage), and water tiles without needing to first go into transport boats, it can also attack from water tiles to land tiles, and from land to water tiles. The only bug seems to be that it can't move from land to water, or vice versa if it's on its last movement point (this is also true if attacking a unit that is on such a tile,), so take that into account when deciding how to use it, and how many movement points you give the unit.

Hope this helps you out.
 
Spoiler :
Hey mate, I've been mostly successful in creating a hovering unit that can move through all terrain, yes including water, by using the airships promotion from the Smoky Skies Scenario.


Just before adding the unit, I delete embarkation and embarkation promotions from a combatclass I know i won't need for the scenario, in this case bomber and also useless promotions for such a unit.

Spoiler :

<!-- Hovering Unit-->
<UnitPromotions_UnitCombats>
<!-- Airships-->
<Delete PromotionType="PROMOTION_EMBARKATION" UnitCombatType="UNITCOMBAT_BOMBER"/>
<Delete PromotionType="PROMOTION_DEFENSIVE_EMBARKATION" UnitCombatType="UNITCOMBAT_BOMBER"/>
<Delete PromotionType="PROMOTION_ALLWATER_EMBARKATION" UnitCombatType="UNITCOMBAT_BOMBER"/>
<Delete PromotionType="PROMOTION_AIR_AMBUSH_1" UnitCombatType="UNITCOMBAT_BOMBER"/>
<Delete PromotionType="PROMOTION_AIR_AMBUSH_2" UnitCombatType="UNITCOMBAT_BOMBER"/>
<Delete PromotionType="PROMOTION_AIR_RANGE" UnitCombatType="UNITCOMBAT_BOMBER"/>
<Delete PromotionType="PROMOTION_EVASION" UnitCombatType="UNITCOMBAT_BOMBER"/>
</UnitPromotions_UnitCombats>


I then add the Promotion

Spoiler :

<UnitPromotions>
<Row>
<Type>PROMOTION_MOVE_ALL_TERRAIN</Type>
<Description>TXT_KEY_PROMOTION_MOVE_ALL_TERRAIN</Description>
<Help>TXT_KEY_PROMOTION_MOVE_ALL_TERRAIN_HELP</Help>
<Sound>AS2D_IF_LEVELUP</Sound>
<IconAtlas>ABILITY_ATLAS</IconAtlas>
<PediaType>PEDIA_ATTRIBUTES</PediaType>
<PortraitIndex>58</PortraitIndex>
<PediaEntry>TXT_KEY_PROMOTION_MOVE_ALL_TERRAIN</PediaEntry>
<CanMoveAllTerrain>true</CanMoveAllTerrain>
<LostWithUpgrade>1</LostWithUpgrade>
</Row>
</UnitPromotions>


When adding the unit, make sure you use the correct combat class, in this case it would be <CombatClass>UNITCOMBAT_BOMBER</CombatClass>

And finally don't forget to add the promotion to the unit, as well as flat movement cost, so that it can move more like a hovering unit should

Spoiler :
<Unit_FreePromotions>
<Row>
<UnitType>UNIT_DRAGON</UnitType>
<PromotionType>PROMOTION_FLAT_MOVEMENT_COST</PromotionType>
</Row>
<Row>
<UnitType>UNIT_DRAGON</UnitType>
<PromotionType>PROMOTION_MOVE_ALL_TERRAIN</PromotionType>
</Row>
</Unit_FreePromotions>




I've tested this out in 2 mods, and it's worked fine for me. The unit can fly over any terrain type including mountains (without taking damage), and water tiles without needing to first go into transport boats, it can also attack from water tiles to land tiles, and from land to water tiles. The only bug seems to be that it can't move from land to water, or vice versa if it's on its last movement point (this is also true if attacking a unit that is on such a tile,), so take that into account when deciding how to use it, and how many movement points you give the unit.

Hope this helps you out.

Thanks a lot. :)

I had been doing a lot of things that you did to get it to work (deleting embarkation, using Airship as template), I just cobbled them together in the wrong way from the different sources I found them.

This was my original code to delete embarking, and it wasn't working, so I had erroneously thought that it could not be changed due to hardcode.
Spoiler :
<UnitPromotions_UnitCombats>
<Delete UnitCombatType="UNITCOMBAT_HELICOPTER" PromotionType="PROMOTION_EMBARKATION"/>
<Delete UnitCombatType="UNITCOMBAT_HELICOPTER" PromotionType="PROMOTION_DEFENSIVE_EMBARKATION"/>
<Delete UnitCombatType="UNITCOMBAT_HELICOPTER" PromotionType="PROMOTION_ALLWATER_EMBARKATION"/>
</UnitPromotions_UnitCombats>


I also erroneously believed that CanMoveAllTerrain was a defunct promotion from this thread.

But it works beautifully!

Thanks again.
 

Attachments

  • pasted image 0.jpg
    pasted image 0.jpg
    146.7 KB · Views: 100
  • pasted image 1.jpg
    pasted image 1.jpg
    100.4 KB · Views: 116
  • pasted image 2.jpg
    pasted image 2.jpg
    152.6 KB · Views: 165
  • pasted image 3.jpg
    pasted image 3.jpg
    93.9 KB · Views: 68
  • pasted image 4.jpg
    pasted image 4.jpg
    105.9 KB · Views: 141
  • pasted image 5.jpg
    pasted image 5.jpg
    109.9 KB · Views: 143
  • pasted image 6.jpg
    pasted image 6.jpg
    128.8 KB · Views: 74
The only bug seems to be that it can't move from land to water, or vice versa if it's on its last movement point (this is also true if attacking a unit that is on such a tile,), so take that into account when deciding how to use it, and how many movement points you give the unit.

I've found that the solution to this is to make it DOMAIN_SEA rather than DOMAIN_LAND. I haven't tested it thoroughly but it appears that this fixes the land-to-sea issue on the last movement point and vice versa. Everything else still works the same as far as I can tell, except for you can now stack your hovering unit over land military units since it's now technically a "sea unit", and you can't go on the same tile as another naval unit (which, both of these effects work great for me).
 
I'm glad i could help you out mate, and thanks for finding how to fix the last movement point thing, maybe I'll try it like that, or try with DOMAIN_HOVER, and see if that works.
 
Top Bottom