1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Adding a Unit Model Error

Discussion in 'Civ5 - Creation & Customization' started by sman1975, Sep 10, 2019 at 1:49 PM.

  1. sman1975

    sman1975 Chieftain

    Joined:
    Aug 27, 2016
    Messages:
    868
    Location:
    Dallas, TX
    Am trying to add one of @danrell 's models to a mod, but am getting an odd error.

    Here is the screenshot, although it doesn't do the error justice:

    upload_2019-9-10_12-30-34.jpeg

    What you can't see is that these odd geometric shapes are popping/flashing/undulating like a disco ball on steroids, whenever the unit is within view of the map...

    The model in question is the 'Yokosuka MXY7 Ohka' airframe, from this mod:

    https://forums.civfanatics.com/resources/civ5-wwii-unit-pack-14-japan-part1.17441/

    I've found this model appearing (but not actually used) in a few other mods, yet when I use any versions of this model, they all render the same epileptic-inducing light show.

    Unit Definition:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <GameData>
    
        <UnitClasses>
            <Row>
                <Type>UNITCLASS_WAW_WW2_KAMIKAZE_2</Type>
                <Description>TXT_KEY_UNIT_WAW_WW2_KAMIKAZE_2_JAP</Description>
                <DefaultUnit>NONE</DefaultUnit>
            </Row>
        </UnitClasses>
    
    
        <Units>
            <Row>
                <Type>UNIT_WAW_WW2_KAMIKAZE_2_JAP</Type>
                <Class>UNITCLASS_WAW_WW2_KAMIKAZE_2</Class>
                <RangedCombat>60</RangedCombat>
                <Moves>2</Moves>
                <Range>8</Range>
                <Cost>125</Cost>
    
                <PrereqTech>TECH_SMAN_JET_ENGINES</PrereqTech>
                <ObsoleteTech>TECH_ADVANCED_BALLISTICS</ObsoleteTech>
    
                <Description>TXT_KEY_UNIT_WAW_WW2_KAMIKAZE_2_JAP</Description>
                <Strategy>TXT_KEY_UNIT_WAW_WW2_KAMIKAZE_2_JAP_STRATEGY</Strategy>
                <Help>TXT_KEY_UNIT_WAW_WW2_KAMIKAZE_2_JAP_HELP</Help>
                <Civilopedia>TXT_KEY_UNIT_WAW_WW2_KAMIKAZE_2_JAP_PEDIA</Civilopedia>
    
                <Immobile>true</Immobile>
                <!--<AirInterceptRange>7</AirInterceptRange>-->
                <CombatClass></CombatClass>
                <Domain>DOMAIN_AIR</Domain>
                <Special>SPECIALUNIT_MISSILE</Special>
                <IgnoreBuildingDefense>true</IgnoreBuildingDefense>           
                <MoveRate>AIR_REBASE</MoveRate>
                <Mechanized>true</Mechanized>           
                <RangedCombatLimit>100</RangedCombatLimit>
                <AirUnitCap>1</AirUnitCap>
                <MilitaryProduction>true</MilitaryProduction>
                <AdvancedStartCost>20</AdvancedStartCost>
                <MilitarySupport>true</MilitarySupport>
                <DefaultUnitAI>UNITAI_MISSILE_AIR</DefaultUnitAI>           
                <XPValueDefense>2</XPValueDefense>
                <Suicide>true</Suicide>
    
                <UnitArtInfo>ART_DEF_UNIT_WAW_WW2_KAMIKAZE_2_JAP</UnitArtInfo>
    
                <IconAtlas>WAW_UNIT_ATLAS</IconAtlas>
                <PortraitIndex>48</PortraitIndex>
                <UnitFlagAtlas>WAW_UNIT_FLAG_ATLAS_B</UnitFlagAtlas>
                <UnitFlagIconOffset>9</UnitFlagIconOffset>
            </Row>
      </Units>
    
        <Civilization_UnitClassOverrides>
            <Row>
                <CivilizationType>CIVILIZATION_JAPAN</CivilizationType>
                <UnitClassType>UNITCLASS_WAW_WW2_KAMIKAZE_2</UnitClassType>
                <UnitType>UNIT_WAW_WW2_KAMIKAZE_2_JAP</UnitType>
            </Row>
        </Civilization_UnitClassOverrides>
    
        <!--
        <Unit_ClassUpgrades>
            <Row>
                <UnitType>UNIT_WAW_WW2_KAMIKAZE_2_JAP</UnitType>
                <UnitClassType>UNITCLASS_FIGHTER</UnitClassType>
            </Row>
        </Unit_ClassUpgrades>   
        -->
        
      <Unit_AITypes>
        <Row>
          <UnitType>UNIT_WAW_WW2_KAMIKAZE_2_JAP</UnitType>
          <UnitAIType>UNITAI_MISSILE_AIR</UnitAIType>
        </Row>
          <!--
          <Row>
              <UnitType>UNIT_WAW_WW2_KAMIKAZE_2_JAP</UnitType>
              <UnitAIType>UNITAI_CARRIER_AIR</UnitAIType>
          </Row>   
          -->
        </Unit_AITypes>
        
      <Unit_Flavors>
            <Row>
                <UnitType>UNIT_WAW_WW2_KAMIKAZE_2_JAP</UnitType>
                <FlavorType>FLAVOR_AIR</FlavorType>
                <Flavor>7</Flavor>
            </Row>
          <Row>
              <UnitType>UNIT_WAW_WW2_KAMIKAZE_2_JAP</UnitType>
              <FlavorType>FLAVOR_NAVAL</FlavorType>
              <Flavor>5</Flavor>
          </Row>
            <Row>
                <UnitType>UNIT_WAW_WW2_KAMIKAZE_2_JAP</UnitType>
                <FlavorType>FLAVOR_DEFENSE</FlavorType>
                <Flavor>2</Flavor>
            </Row>
            <Row>
                <UnitType>UNIT_WAW_WW2_KAMIKAZE_2_JAP</UnitType>
                <FlavorType>FLAVOR_OFFENSE</FlavorType>
                <Flavor>10</Flavor>
            </Row>
      </Unit_Flavors>     
        
      <Unit_FreePromotions>
          <Row>
              <UnitType>UNIT_WAW_WW2_KAMIKAZE_2_JAP</UnitType>
              <PromotionType>PROMOTION_EVASION</PromotionType>
          </Row>
          <Row>
              <UnitType>UNIT_WAW_WW2_KAMIKAZE_2_JAP</UnitType>
              <PromotionType>PROMOTION_NAVAL_BONUS</PromotionType>
          </Row>
          <Row>
              <UnitType>UNIT_WAW_WW2_KAMIKAZE_2_JAP</UnitType>
              <PromotionType>PROMOTION_AMBUSH_1</PromotionType>
          </Row>   
      </Unit_FreePromotions>
        
        
      <Unit_ResourceQuantityRequirements>
        <Row>
              <UnitType>UNIT_WAW_WW2_KAMIKAZE_2_JAP</UnitType>
              <ResourceType>RESOURCE_OIL</ResourceType>
          </Row>
      </Unit_ResourceQuantityRequirements>
    
        <UnitGameplay2DScripts>
            <Row>
                <UnitType>UNIT_WAW_WW2_KAMIKAZE_2_JAP</UnitType>
                <SelectionSound>AS2D_SELECT_FIGHTER</SelectionSound>
                <FirstSelectionSound>AS2D_BIRTH_FIGHTER</FirstSelectionSound>
            </Row>
        </UnitGameplay2DScripts>
    
    
        <Language_en_US>
            <Row Tag="TXT_KEY_UNIT_WAW_WW2_KAMIKAZE_2_JAP">
                <Text>MXY7 `Ohka` Kamikazi [ICON_CIV_WAW_JAPAN]</Text>
            </Row>
    
            <Row Tag="TXT_KEY_UNIT_WAW_WW2_KAMIKAZE_2_JAP_STRATEGY">
                <Text>Cutting-edge, the `Ohka` is a human-guided rocket Unit being used as a flying bomb. Effective against armored units, and especially against ships. Unit is destroyed when it attacks. Requires [ICON_RES_OIL] Oil.</Text>
            </Row>
    
            <Row Tag="TXT_KEY_UNIT_WAW_WW2_KAMIKAZE_2_JAP_HELP">
                <Text>Bonus 25% vs Armored Units, +50% vs. Ships. Damage taken from interception reduced by 50%</Text>
            </Row>
    
            <Row Tag="TXT_KEY_UNIT_WAW_WW2_KAMIKAZE_2_JAP_PEDIA">
                <Text>
                    The Yokosuka MXY7 `Ohka` Kamikazi (V2 Rocket equivalent) is a World War II Era Missile Unit, available at the discovery of Synthetics. It becomes obsolete at the discovery of the discovery of Advanced Ballistics.[NEWLINE][NEWLINE]The Kamikaze (`Divine wind`) were suicide attacks by military aviators from the Empire of Japan against Allied naval vessels in the closing stages of the Pacific campaign of World War II, designed to destroy as many warships as possible.  Kamikaze pilots would attempt to crash their aircraft into enemy ships in what was called a `Body Attack` in planes often laden with explosives, bombs, torpedoes and full fuel tanks.[NEWLINE][NEWLINE]The aircraft`s normal functions (to deliver torpedoes or bombs or shoot down other aircraft) were put aside, and the planes were converted to what were essentially manned missiles in an attempt to reap the benefits of greatly increased accuracy and payload over that of normal bombs.[NEWLINE][NEWLINE]The goal of crippling as many Allied ships as possible, particularly aircraft carriers, was considered critical enough to warrant the combined sacrifice of pilots and aircraft.
                </Text>
            </Row>
        </Language_en_US>
    
    
        <!-- ====================================================================================================================== -->
        <!--        Art Defines Data            -->
    
        <!--        Unit Data                    -->
        <ArtDefine_UnitInfos>
            <Row>
                <Type>ART_DEF_UNIT_WAW_WW2_KAMIKAZE_2_JAP</Type>
                <DamageStates>1</DamageStates>
                <Formation></Formation>
            </Row>
        </ArtDefine_UnitInfos>
        
        <ArtDefine_UnitInfoMemberInfos>
            <Row>
                <UnitInfoType>ART_DEF_UNIT_WAW_WW2_KAMIKAZE_2_JAP</UnitInfoType>
                <UnitMemberInfoType>ART_DEF_UNIT_MEMBER_WAW_WW2_KAMIKAZE_2_JAP</UnitMemberInfoType>
                <NumMembers>1</NumMembers>
            </Row>
        </ArtDefine_UnitInfoMemberInfos>
    
        <ArtDefine_StrategicView>
            <Row>
                <StrategicViewType>ART_DEF_UNIT_WAW_WW2_KAMIKAZE_2_JAP</StrategicViewType>
                <TileType>Unit</TileType>
                <Asset>SV_GuidedMissile.dds</Asset>
            </Row>
        </ArtDefine_StrategicView>
    
    
        <!--        Member Data                    -->
        <ArtDefine_UnitMemberInfos>
            <Row>
                <Type>ART_DEF_UNIT_MEMBER_WAW_WW2_KAMIKAZE_2_JAP</Type>
                <Scale>.08</Scale>
                <Domain>Air</Domain>
                <Model>WAW_JAP_V2.fxsxml</Model>
                <MaterialTypeTag>METAL</MaterialTypeTag>
                <MaterialTypeSoundOverrideTag>METALLRG</MaterialTypeSoundOverrideTag>
            </Row>
        </ArtDefine_UnitMemberInfos>
        
        <ArtDefine_UnitMemberCombats>
            <Row>
                <UnitMemberType>ART_DEF_UNIT_MEMBER_WAW_WW2_KAMIKAZE_2_JAP</UnitMemberType>
                <EnableActions>Idle Attack Bombard Death Run</EnableActions>
                <AttackRadius>64.0</AttackRadius>
                <MoveRate>2.0</MoveRate>
                <TurnRateMin>0.5</TurnRateMin>
                <TurnRateMax>1.5</TurnRateMax>
                <PitchRateMin>1</PitchRateMin>
                <PitchRateMax>3</PitchRateMax>           
                <HasRefaceAfterCombat>0</HasRefaceAfterCombat>
                <HasCollisionAttack>1</HasCollisionAttack>
                <AttackAltitude>45</AttackAltitude>           
            </Row>
        </ArtDefine_UnitMemberCombats>
        
        <ArtDefine_UnitMemberCombatWeapons>
            <Row>
                <UnitMemberType>ART_DEF_UNIT_MEMBER_WAW_WW2_KAMIKAZE_2_JAP</UnitMemberType>
                <Index>0</Index>
                <SubIndex>0</SubIndex>
                <VisKillStrengthMin>100</VisKillStrengthMin>
                <VisKillStrengthMax>100</VisKillStrengthMax>
                <HitEffect>ART_DEF_VEFFECT_GUIDED_MISSILE_IMPACT_$(TERRAIN)</HitEffect>
                <WeaponTypeTag>EXPLOSIVE</WeaponTypeTag>
                <WeaponTypeSoundOverrideTag>EXPLOSION200POUND</WeaponTypeSoundOverrideTag>
            </Row>
        </ArtDefine_UnitMemberCombatWeapons>
            
    </GameData>
    
    


    And the corresponding ftsxml file:

    Code:
    <Asset>
        <Mesh file="WAW_JAP_V2.gr2"/>
        <Animation file="GuidedMissile_IdleA.gr2" ec="1000"/>
        <Animation file="GuidedMissile_AttackA.gr2" ec="1100"/>
        <Animation file="GuidedMissile_Start_Run.gr2" ec="1420"/>
        <Animation file="GuidedMissile_Run.gr2" ec="1400"/>
        <Animation file="GuidedMissile_DeathA.gr2" ec="1200"/>
        <Animation file="GuidedMissile_DeathA_Idle.gr2" ec="1220"/>
        <Texture file="GuidedMissile_DIFF.dds"/>
        <Texture file="GuidedMissile_SREF.dds"/>
        <AnimGraph file="START_RUN_LAUNCH.dge"/>
        <AnimGraph file="DEATH_A_GRAPH.dge"/>
        <StateMachine file="MISSLE_STATE_01.fsmxml"/>
        <AnimGraph file="IDLE_A_GRAPH.dge"/>
        <AnimGraph file="RUNNING_LOOP_GRAPH.dge"/>
        <AnimGraph file="DEATH_FINAL_A_GRAPH.dge"/>
        <AnimGraph file="ATTACK_A_GRAPH.dge"/>
        <TimedTrigger file="FX_Triggers_GuidedMissile.ftsxml"/>
        <BoneUsage>
            <Bone name="bone_BODY"/>
            <Bone name="WORLD_center"/>       
        </BoneUsage>
    </Asset>
    
    
    The original version of this file had a reference in BoneUsage to "GuidedMissile" but I checked the .gr2 file using GrannyViewer and there was no such bone that I could find in the model, so I removed the Bone name from this file.

    Also, the model "looks" like a fighter, but the definitions are based on the Guided Missile unit. I've "converted" the model to a straight Fighter unit, but with the same light show resulting.

    Questions:

    - Has anyone seen a disco light show when making a unit - and if so, point me in the direction of a fix?

    - Or, has anyone seen a mod where the unit in question (@danrell 's "MXY7 `Ohka`") where it actually works?

    - Or, (and most likely), what bone-headed boo-boo have I made and missed this time??? :crazyeye:


    Many, many thanks!


    P.s. And before anyone takes offense, the usage of "JAP" in the file is not intended as an insult to anyone. The mod in question adds Civ-specific units for many different Civs, and to save time, I used a 3 letter abbreviation for the Civ in question, e.g. USA, RUS, CHI, etc.
     

    Attached Files:

  2. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,329
    Location:
    Near Portsmouth, UK
    Danrell's models require a support file IIRC. Have you included that in your mod? Search these forums for "burrowing tanks" and you'll find a post of mine that mentions it in one of the replies
     
    sman1975 likes this.
  3. sman1975

    sman1975 Chieftain

    Joined:
    Aug 27, 2016
    Messages:
    868
    Location:
    Dallas, TX
    Hey, @whoward69 - thanks for the suggestion!

    I've seen the "burrowing tanks" problems before - which is due to not having the appropriate edited .dge files imported into VFS. I don't believe that's what's causing this error as I've used 34 other models from the Japanese WW2 Units Pak in the mod. Additionally, the .fxsxml file doesn't use any edited animations, just straight-up Guided Missile data. So, I don't think anything the model needs is missing.

    I'm starting to think the problem is with the model's main .gr2 file itself, which is why I was wondering if anyone had ever got the model to working.
     

Share This Page