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

[Unit] Unit reskin/creation problem

Discussion in 'CivBE - Modding Help & Mod Creation' started by liquid_plane, Jun 6, 2018.

  1. liquid_plane

    liquid_plane Chieftain

    Joined:
    Nov 6, 2014
    Messages:
    4
    Before creating own units, I tried to go through all tutorials. So the cardboard destroyer was ok, but when i tried to reskin it, destroyer start represents in game like marine.

    Spoiler Screenshot :


    VFS for art true, for XML false. Rebuild unit/landmark system checked, actions for updating database added. I have no idea what going wrong. And even if I try to use original models and textures it's become like a marine.

    I'm not good in coding, but good in modeling and art, so if you also need help you are welcome.

    Spoiler cardboarddestroyer.xml :

    Code:
    <GameData>
        <UnitClasses>
            <Row>
                <Type>UNITCLASS_CARDBOARD</Type>
                <Description>TXT_KEY_UNIT_CARDBOARD_DESC</Description>
                <DefaultUnit>UNIT_CARDBOARD</DefaultUnit>
            </Row>
        </UnitClasses>
        
        <Units>
            <Row>
                <Type>UNIT_CARDBOARD</Type>
                <Class>UNITCLASS_CARDBOARD</Class>
                <Combat>3</Combat>
                <Cost>25</Cost>
                <PrereqTech>TECH_HABITATION</PrereqTech>
                <Description>TXT_KEY_UNIT_CARDBOARD_DESC</Description>
                <Civilopedia>TXT_KEY_UNIT_CARDBOARD_PEDIA</Civilopedia>
                <Help>TXT_KEY_UNIT_CARDBOARD_HELP</Help>
                <Moves>2</Moves>
                <CombatClass>UNITCOMBAT_MELEE</CombatClass>
                <Domain>DOMAIN_LAND</Domain>
                <DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
                <MilitarySupport>true</MilitarySupport>
                <MilitaryProduction>true</MilitaryProduction>
                <Pillage>true</Pillage>
                <AdvancedStartCost>25</AdvancedStartCost>
                <XPValueAttack>1</XPValueAttack>
                <XPValueDefense>1</XPValueDefense>
                <Conscription>1</Conscription>
                <UnitArtInfo>ART_DEF_UNIT_CARDBOARD</UnitArtInfo>
                <MoveRate>WHEELED</MoveRate>
            </Row>
        </Units>
    
        <LocalizedText>
            <Row Language="en_US" Tag="TXT_KEY_UNIT_CARDBOARD_DESC">
                <Text>Cardboard Destroyer</Text>
            </Row>
            <Row Language="en_US" Tag="TXT_KEY_UNIT_CARDBOARD_PEDIA">
                <Text>A decoy unit with limited fighting capabilities. Looks like a LEV Destroyer but is extremely weak and does not hover over the terrain.</Text>
            </Row>
            <Row Language="en_US" Tag="TXT_KEY_UNIT_CARDBOARD_HELP">
                <Text>Weak decoy unit that looks like a LEV Destroyer.</Text>
            </Row>
        </LocalizedText>
    </GameData>


    Spoiler cardboarddestroyerart.xml :

    Code:
    <GameData>
        <UnitArtInfo>
            <Type>ART_DEF_UNIT_CARDBOARD</Type>
            <UnitFlagAtlas>UNIT_FLAG_ATLAS</UnitFlagAtlas>
            <UnitFlagIconOffset>20</UnitFlagIconOffset>
            <PortraitAtlas>UNIT_ATLAS_1</PortraitAtlas>
            <PortraitIndex>20</PortraitIndex>
            <Formation>ThreeBigGuns</Formation>
            <DamageStates>3</DamageStates>
            <PortraitCamera>ART_DEF_PORTRAIT_CAMERA_FAR05</PortraitCamera>
            <UpgradeCamera>ART_DEF_PORTRAIT_CAMERA_FAR05_U</UpgradeCamera>
            <UnitMemberArt>
                <MemberType>ART_DEF_UNIT_MEMBER_CARDBOARD</MemberType>
                <MemberCount>1</MemberCount>
            </UnitMemberArt>
        </UnitArtInfo>
    
        <UnitMemberArtInfo>
            <Type>ART_DEF_UNIT_MEMBER_CARDBOARD</Type>
            <fScale>0.052</fScale>
            <Granny>cardboard.fxsxml</Granny>
            <Combat>
                <Defaults>ART_DEF_TEMPLATE_SOLDIER</Defaults>
                <bReformBeforeCombat>1</bReformBeforeCombat>
                <bHasShortRangedAttack>1</bHasShortRangedAttack>
                <bHasLongRangedAttack>1</bHasLongRangedAttack>
                <Weapon>
                    <fAttackRadius>21.0</fAttackRadius>
                    <fProjectileSpeed>4.0</fProjectileSpeed>
                    <fVisKillStrengthMin>25.0</fVisKillStrengthMin>
                    <fVisKillStrengthMax>50.0</fVisKillStrengthMax>
                    <HitEffect>ART_DEF_VEFFECT_PURITY_RED_IMPACT_XLG_$(TERRAIN)</HitEffect>
                    <fHitEffectScale>0.1</fHitEffectScale>
                    <fHitRadius>17.0</fHitRadius>
                    <WeaponTypeTag>EXPLOSIVE</WeaponTypeTag>
                    <WeaponTypeSoundOverrideTag>EXPLOSION6POUND</WeaponTypeSoundOverrideTag>
                    <bTargetGround>1</bTargetGround>
                </Weapon>
            </Combat>
            <MaterialTypeTag>METAL</MaterialTypeTag>
            <MaterialTypeSoundOverrideTag>METALLG</MaterialTypeSoundOverrideTag>
        </UnitMemberArtInfo> 
    </GameData>


    Spoiler cardboard.fxsxml :

    Code:
    <Asset>
        <Mesh file="Cardboard.gr2"/>
        <Animation file="Cardboard_Aim_L.gr2" ec="1700"/>
        <Animation file="Cardboard_Aim_R.gr2" ec="1705"/>
        <Animation file="Cardboard_Aim_Center.gr2" ec="1710"/>
        <Animation file="Cardboard_IdleA.gr2" ec="1000"/>
        <Animation file="Cardboard_FidgetA.gr2" ec="1040"/>
        <Animation file="Cardboard_IdleA_Trans_IdleB.gr2" ec="1020"/>
        <Animation file="Cardboard_IdleB.gr2" ec="2000"/>
        <Animation file="Cardboard_FidgetB.gr2" ec="2040"/>
        <Animation file="Cardboard_IdleB_Trans_IdleA.gr2" ec="2020"/>
        <Animation file="Cardboard_Fortify.gr2" ec="1500"/>
        <Animation file="Cardboard_Fortify_Idle.gr2" ec="1520"/>
        <Animation file="Cardboard_Fortify_Idle_Fidget.gr2" ec="1540"/>
        <Animation file="Cardboard_Fortify_Idle_Trans_Combat_Ready_Idle.gr2" ec="1560"/>
        <Animation file="Cardboard_Fortify_Idle_Trans_IdleA.gr2" ec="1580"/>
        <Animation file="Cardboard_Combat_Ready.gr2" ec="1600"/>
        <Animation file="Cardboard_Combat_Ready_Idle.gr2" ec="1620"/>
        <Animation file="Cardboard_Combat_Ready_Idle_Trans_IdleA.gr2" ec="1640"/>
        <Animation file="Cardboard_Charge_Run.gr2" ec="1120"/>
        <Animation file="Cardboard_Run_Hover.gr2" ec="1400"/>
        <Animation file="Cardboard_Stop_Run.gr2" ec="1440, 1140"/>
        <Animation file="Cardboard_Attack_City.gr2" ec="1160"/>
        <Animation file="Cardboard_Bombardment.gr2" ec="1180"/>
        <Animation file="Cardboard_AttackA.gr2" ec="1100"/>
        <Animation file="Cardboard_AttackB.gr2" ec="2100"/>
        <Animation file="Cardboard_Attack_Air.gr2" ec="1130"/>
        <Animation file="Cardboard_Victory.gr2" ec="1800"/>
        <Animation file="Cardboard_Bombard_Defense.gr2" ec="1280"/>
        <Animation file="Cardboard_Bombard_Defense_Idle.gr2" ec="1285"/>
        <Animation file="Cardboard_Bombard_Defense_Idle_Trans_IdleA.gr2" ec="1290"/>
        <Animation file="Cardboard_DeathA.gr2" ec="1200"/>
        <Animation file="Cardboard_DeathA_Idle.gr2" ec="1220"/>
        <Animation file="Cardboard_DeathB.gr2" ec="2200"/>
        <Animation file="Cardboard_DeathB_Idle.gr2" ec="2220"/>
        <Texture file="Cardboard_DIFF.dds"/>
        <Texture file="Cardboard_SREF.dds"/>
        <Texture file="Cardboard_DMG_DIFF.dds"/>
        <Texture file="Cardboard_DMG_SREF.dds"/>
        <Texture file="Unit_Environment_Dull.dds"/>
        <Texture file="Unit_Environment_Sharp.dds"/>
        <Texture file="Unit_Sunlight_Irradiance.dds"/>
        <StateMachine file="MECHANIZED_AIM_STATE_01.fsmxml"/>
        <AnimGraph file="AIM_IDLE_OFFSET_CONTINUE_TRUE_GRAPH.dge"/>
        <AnimGraph file="AIM_FIDGETS_GRAPH.dge"/>
        <AnimGraph file="AIM_START_RUNNING.dge"/>
        <AnimGraph file="AIM_STOP_RUNNING.dge"/>
        <AnimGraph file="AIM_TRANSITIONS_FOR_IDLES.dge"/>
        <AnimGraph file="AIM_COMBAT_READY_GRAPH.dge"/>
        <AnimGraph file="AIM_FORTIFY_LEAVE_GRAPH.dge"/>
        <AnimGraph file="AIM_ENTER_COMBAT_READY_GRAPH.dge"/>
        <AnimGraph file="AIM_LEAVE_COMBAT_READY.dge"/>
        <AnimGraph file="AIM_DEATH_GRAPH.dge"/>
        <AnimGraph file="AIM_ENTER_BOMBARD_DEFEND_GRAPH.dge"/>
        <AnimGraph file="AIM_RUNNING_LOOP.dge"/>
        <AnimGraph file="AIM_BOMBARD_DEFEND_LOOP_GRAPH.dge"/>
        <AnimGraph file="AIM_DEATH_FINAL_GRAPH.dge"/>
        <AnimGraph file="AIM_LEAVE_BOMBARD_DEFEND_TRANS_IDLE_A_GRAPH.dge"/>
        <AnimGraph file="AIM_ATTACK_TO_RUN_GRAPH.dge"/>
        <AnimGraph file="AIM_ATTACK_CITY_TO_RUN.dge"/>
        <AnimGraph file="AIM_ENTER_FORTIFY.dge"/>
        <AnimGraph file="AIM_FORTIFY_FIDGET_GRAPH.dge"/>
        <AnimGraph file="AIM_MELEE_ATTACKS.dge"/>
        <AnimGraph file="AIM_IDLE_GRAPH.dge"/>
        <AnimGraph file="AIM_FORTIFY_GRAPH.dge"/>
        <TimedTrigger file="fx_triggers_levdestroyer.ftsxml"/>
        <BoneUsage>
            <Bone name="point_WORLD"/>
            <Bone name="Ship"/>
            <Bone name="FX_Muzzle_FrntGun_01"/>
            <Bone name="FX_Muzzle_FrntGun_02"/>
            <Bone name="FX_MUZZ_R_01"/>
            <Bone name="FX_MUZZ_R_02"/>
            <Bone name="FX_MUZZ_R_03"/>
            <Bone name="FX_MUZZ_R_04"/>
            <Bone name="FX_MUZZ_R_05"/>
            <Bone name="FX_MUZZ_R_06"/>
            <Bone name="FX_Missile_R_01"/>
            <Bone name="FX_Missile_R_02"/>
            <Bone name="FX_Missile_R_03"/>
            <Bone name="FX_Missile_R_04"/>
            <Bone name="FX_Missile_R_05"/>
            <Bone name="FX_Missile_R_06"/>
            <Bone name="AIM_DR"/>
            <Bone name="FX_MUZZ_L_01"/>
            <Bone name="FX_MUZZ_L_02"/>
            <Bone name="FX_MUZZ_L_03"/>
            <Bone name="FX_MUZZ_L_04"/>
            <Bone name="FX_MUZZ_L_05"/>
            <Bone name="FX_MUZZ_L_06"/>
            <Bone name="FX_Missile_L_01"/>
            <Bone name="FX_Missile_L_02"/>
            <Bone name="FX_Missile_L_03"/>
            <Bone name="FX_Missile_L_04"/>
            <Bone name="FX_Missile_L_05"/>
            <Bone name="FX_Missile_L_06"/>
            <Bone name="Engine_R_R"/>
            <Bone name="bone_hover_BL"/>
            <Bone name="bone_hover_FL"/>
            <Bone name="Cannon_F_R"/>
            <Bone name="Cannon_F_L"/>
            <Bone name="Lev_R"/>
            <Bone name="bone_ammobox"/>
            <Bone name="FX_proj_FrntGun_02"/>
            <Bone name="FX_VENT_FrontGun_L_01"/>
            <Bone name="FX_VENT_FrontGun_R_01"/>
            <Bone name="Turbine_R_F"/>
            <Bone name="Missle_L_D"/>
            <Bone name="FX_Explosion_05"/>
            <Bone name="FX_Explosion_02"/>
            <Bone name="FX_Explosion_03"/>
            <Bone name="FX_Explosion_00"/>
            <Bone name="FX_Explosion_01"/>
            <Bone name="World_Center"/>
            <Bone name="FX_Explosion_04"/>
            <Bone name="Turbine_L_R"/>
            <Bone name="Engine_L_M"/>
            <Bone name="Turbine_R_R"/>
            <Bone name="Engine_L_F"/>
            <Bone name="Missle_L_C"/>
            <Bone name="Lev_L"/>
        </BoneUsage>
    </Asset>
     
  2. Ryika

    Ryika Lazy Wannabe Artista

    Joined:
    Aug 30, 2013
    Messages:
    9,398
    Marine is the fallback-Art, so that usually means there something wrong with your art definitions.

    In this case, one error is easy to spot:

    cardboarddestroyerart.xml
    -> Must be <UnitArtInfos>, not <GameData>.

    There may be more that I'm not seeing immediately.


    Note that cardboarddestroyerart.xml and cardboard.fxsxml must not be added that way, but instead need to be loaded by setting "Import into VFS" (or whatever it's called) to true.
     
    Last edited: Jun 9, 2018
  3. liquid_plane

    liquid_plane Chieftain

    Joined:
    Nov 6, 2014
    Messages:
    4
    Fixed. Still the same. When i tried to looks in other mods structure that use new units,they do it in different ways.
     
  4. Ryika

    Ryika Lazy Wannabe Artista

    Joined:
    Aug 30, 2013
    Messages:
    9,398
    My bad, this whole part...

    ...is nonsense, I remembered it incorrectly. Try only fixing the <GameData>-Thing and see if that produces the results you are looking for.
     
    Last edited: Jun 9, 2018
  5. liquid_plane

    liquid_plane Chieftain

    Joined:
    Nov 6, 2014
    Messages:
    4
    Tried it. UnitArtInfos and UnitMemberArtInfos instead GameData. Problem starts when I define custom art info even if fxsxml and member art info are not custom. I'm Keeping on on figuring out the mistakes. Mutant unit mod I choose orient to uses a bit another tags (artdefine_unitinfo etc) , different from vanilla xmls. Also unitartinfo in mutant unit mod also under GameData tags.
     
  6. Ryika

    Ryika Lazy Wannabe Artista

    Joined:
    Aug 30, 2013
    Messages:
    9,398
    I took some time and looked into it properly now, and yes, you cannot use the default file format that is being used by the game itself in a mod. Instead, you have to use a different format, which I think was a workaround they added back in Civ5, probably because they hadn't planned for custom models at release or something like that.

    Here's an example of the tags used in the correct file format from one of my mods (Immersive Armies):

    Spoiler :
    Code:
    <GameData>
       <ArtDefine_UnitInfos>
           <Row>
               <Type>ART_DEF_UNIT_RYIKA_THRONE</Type>
               <DamageStates>3</DamageStates>
               <Formation>TwoBigGuns</Formation>
               <UnitFlagAtlas>UNIT_FLAG_ATLAS</UnitFlagAtlas>
               <UnitFlagIconOffset>62</UnitFlagIconOffset>
               <UnitFlagHeightAdjust>0</UnitFlagHeightAdjust>
               <PortraitAtlas>UNIT_ATLAS_2</PortraitAtlas>
               <PortraitIndex>3</PortraitIndex>
               <PortraitCamera>ART_DEF_PORTRAIT_CAMERA_VEHICLE_LG</PortraitCamera>
           </Row>
       </ArtDefine_UnitInfos>
       <ArtDefine_UnitInfoMemberInfos>
           <Row>
               <UnitInfoType>ART_DEF_UNIT_RYIKA_THRONE</UnitInfoType>
               <UnitMemberInfoType>ART_DEF_UNIT_MEMBER_RYIKA_THRONE</UnitMemberInfoType>
               <NumMembers>1</NumMembers>
           </Row>
       </ArtDefine_UnitInfoMemberInfos>
       <ArtDefine_UnitMemberInfos>
           <Row>
               <Type>ART_DEF_UNIT_MEMBER_RYIKA_THRONE</Type>
               <Scale>0.145</Scale>
               <Model>assets/DLC/Expansion1/Units/_PurityHarmony Unique Units/Throne/Throne.fxsxml</Model>
               <MaterialTypeTag>CLOTH</MaterialTypeTag>
               <MaterialTypeSoundOverrideTag>FLESH</MaterialTypeSoundOverrideTag>
           </Row>
       </ArtDefine_UnitMemberInfos>
       <ArtDefine_UnitMemberCombats>
           <Row>
               <UnitMemberType>ART_DEF_UNIT_MEMBER_RYIKA_THRONE</UnitMemberType>
               <EnableActions>Idle Attack RunCharge AttackCity Bombard Death BombardDefend Run Fortify CombatReady Walk AttackCharge Victory AttackSurfaceToAir AttackSurfaceToAir</EnableActions>
               <ShortMoveRadius>12.0</ShortMoveRadius>
               <ShortMoveRate>0.349999994039536</ShortMoveRate>
               <TargetHeight>8.0</TargetHeight>
               <HasShortRangedAttack>1</HasShortRangedAttack>
               <HasStationaryAirAttack>1</HasStationaryAirAttack>
               <HasRefaceAfterCombat>1</HasRefaceAfterCombat>
               <ReformBeforeCombat>1</ReformBeforeCombat>
           </Row>
       </ArtDefine_UnitMemberCombats>
       <ArtDefine_UnitMemberCombatWeapons>
           <Row>
               <UnitMemberType>ART_DEF_UNIT_MEMBER_RYIKA_THRONE</UnitMemberType>
               <Index>0</Index>
               <SubIndex>0</SubIndex>
               <HitEffect>ART_DEF_VEFFECT_LASER_AUTO_CANNON_HIT_MD_$(TERRAIN)</HitEffect>
               <HitRadius>15.0</HitRadius>
               <HitEffectScale>0.11</HitEffectScale>
               <WeaponTypeTag>BULLET</WeaponTypeTag>
               <WeaponTypeSoundOverrideTag>LASERLG</WeaponTypeSoundOverrideTag>
           </Row>
           <Row>
               <UnitMemberType>ART_DEF_UNIT_MEMBER_RYIKA_THRONE</UnitMemberType>
               <Index>1</Index>
               <SubIndex>0</SubIndex>
               <HitEffect>ART_DEF_VEFFECT_LASER_AUTO_CANNON_HIT_MD_$(TERRAIN)</HitEffect>
               <HitEffectScale>0.11</HitEffectScale>
               <WeaponTypeTag>BULLET</WeaponTypeTag>
               <WeaponTypeSoundOverrideTag>LASERLG</WeaponTypeSoundOverrideTag>
           </Row>
       </ArtDefine_UnitMemberCombatWeapons>
    </GameData>
    


    So GameData was correctly after all, but the rest of the entries must be split and sorted into different tables (and then updated in the database, not imported into VFS). Whoward69 has converted all the default Units (from the Base Game) into the correct format and made the files available here, they're a useful starting point, even for custom units.

    Note that the <UnitFlagIconOffset>62</UnitFlagIconOffset> in my example above is a new entry in Rising Tide, but it will likely make the XML-File invalid if used without Rising Tide, so in that case you might have to remove it.

    Given that you're indeed working with the <GameData> and putting new entries into tables, you can use logging to find errors in these defines. They should show up in:

    Documents\My Games\Sid Meier's Civilization Beyond Earth\Logs\Database.log, which can be opened with any text editor.
     
  7. liquid_plane

    liquid_plane Chieftain

    Joined:
    Nov 6, 2014
    Messages:
    4
    Thank you very much, Ryika! That was very helpfull, and after some issues with dds I figuried everything out and it's worked correctly. So I go forward with custom meshes and aniamation.
     

Share This Page