[BNW] Help in modding Civ BE Units in Civ V

With or without Aliens?


  • Total voters
    13

Electric_Gamers

Chieftain
Joined
Oct 15, 2018
Messages
62
Location
Portugal
Hi, I'm new (as a member) to the CivFanatics center and thus I don't know if this is the correct sub-forum to post-this.

Ok, so I have both Civ V and Civ Beyond Earth installed and since they use the same game engine I figured out if I could make a futuristic mod for Civ V using the units from BE.
(Kind of a Late-Game expansion, where you would upgrade the Modern Armor to the hover tanks of BE and the other units, using new Techs, and some of the latest ones, i.e. Particle Physics -> Tanks; Nano Tech -> Soldiers; Nuclear Fusion -> Ships, being the three afinnities unlockable at the same tech but with different stats, making the choice a matter of strategy.)

However, to test the unit adding method, I decided to test only one unit, the Combat Rover (cavalry01). I managed to change the stats and make it spawn in-game, but when I select it (using IGE to spawn it) it appears, and moves, and sounds, like pikemen. (The stats have changed to what I set, though.) I've tried different approaches on the ArtDef and ArtDefMember files to select the .fxsxml from civ BE that I put inside the mod folder (shown below) but for some reason none of it works...

Could anyone please tell me what I am doing wrong and how do I fix this issue?
Cheers!
Note: Here are some of the tutorials I followed.
Add a new unit in the game (using SQL) by Gedemon
HOWTO: New Unit Creation by lemmy101


My main xml file:

"
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 10/14/2018 2:04:51 PM -->
<GameData>

<!-- My Unit -->
<UnitClasses>
<Row>
<Type>UNITCLASS_CAVALRY01</Type>
<Description>TXT_KEY_UNIT_CAVALRY01</Description>
<DefaultUnit>UNIT_CAVALRY01</DefaultUnit>
</Row>
</UnitClasses>
<Units>
<Row>
<Class>UNITCLASS_CAVALRY01</Class>
<Type>UNIT_CAVALRY01</Type>
<PrereqTech>TECH_PARTICLE_PHYSICS</PrereqTech>
<Combat>85</Combat>
<Cost>450</Cost>
<Moves>3</Moves>
<Range>4</Range>
<CombatClass>UNITCOMBAT_ARMOR</CombatClass>
<Domain>DOMAIN_LAND</Domain>
<DefaultUnitAI>UNITAI_FAST_ATTACK</DefaultUnitAI>
<Description>TXT_KEY_UNIT_CAVALRY01</Description>
<Civilopedia>TXT_KEY_CIV5_ANTIQUITY_CAVALRY01_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_CAVALRY01_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_HELP_CAVALRY01</Help>
<MilitarySupport>true</MilitarySupport>
<MilitaryProduction>true</MilitaryProduction>
<Pillage>true</Pillage>
<ObsoleteTech></ObsoleteTech>
<AdvancedStartCost>80</AdvancedStartCost>
<XPValueAttack>3</XPValueAttack>
<XPValueDefense>3</XPValueDefense>
<UnitArtInfo>ART_DEF_UNIT_CAVALRY01</UnitArtInfo>
<UnitFlagIconOffset>0</UnitFlagIconOffset>
<IconAtlas>TECH_ATLAS_1</IconAtlas>
<PortraitIndex>0</PortraitIndex>
</Row>
</Units>
<Unit_AITypes>
<Row>
<UnitType>UNIT_CAVALRY01</UnitType>
<UnitAIType>UNITAI_FAST_ATTACK</UnitAIType>
</Row>
<Row>
<UnitType>UNIT_CAVALRY01</UnitType>
<UnitAIType>UNITAI_DEFENSE</UnitAIType>
</Row>
</Unit_AITypes>
<Unit_ClassUpgrades>
</Unit_ClassUpgrades>
<Unit_Flavors>
<Row>
<UnitType>UNIT_CAVALRY01</UnitType>
<FlavorType>FLAVOR_DEFENSE</FlavorType>
<Flavor>10</Flavor>
</Row>
<Row>
<UnitType>UNIT_CAVALRY01</UnitType>
<FlavorType>FLAVOR_OFFENSE</FlavorType>
<Flavor>20</Flavor>
</Row>
<Row>
<UnitType>UNIT_CAVALRY01</UnitType>
<FlavorType>FLAVOR_MOBILE</FlavorType>
<Flavor>12</Flavor>
</Row>
</Unit_Flavors>
<Unit_FreePromotions>
<Row>
<UnitType>UNIT_CAVALRY01</UnitType>
<PromotionType>PROMOTION_ONLY_DEFENSE</PromotionType>
</Row>
</Unit_FreePromotions>
<Language_en_US>
<Row Tag="TXT_KEY_UNIT_CAVALRY01">
<Text>Cavalry</Text>
</Row>
<Row Tag="TXT_KEY_UNIT_HELP_CAVALRY01">
<Text>help</Text>
</Row>
<Row Tag="TXT_KEY_CIV5_ANTIQUITY_CAVALRY01_TEXT">
<Text>historical info</Text>
</Row>
<Row Tag="TXT_KEY_UNIT_CAVALRY01_STRATEGY">
<Text>strategy</Text>
</Row>
</Language_en_US>
</GameData>
"
My ArtDef File
"
<?xml version="1.0" encoding="utf-8"?>
<GameData>
<ArtDefine_UnitInfos>
<Row>
<Type>ART_DEF_UNIT_CAVALRY01</Type>
<DamageStates>1</DamageStates>
<Formation>Vehicle</Formation>
</Row>
</ArtDefine_UnitInfos>
<ArtDefine_UnitInfoMemberInfos>
<Row>
<UnitInfoType>ART_DEF_UNIT_CAVALRY01</UnitInfoType>
<UnitMemberInfoType>ART_DEF_UNIT_MEMBER_CAVALRY01</UnitMemberInfoType>
<NumMembers>3</NumMembers>
</Row>
</ArtDefine_UnitInfoMemberInfos>
<ArtDefine_UnitMemberInfos>
<Row>
<Type>ART_DEF_UNIT_MEMBER_CAVALRY01</Type>
<Scale>0.100000001490116</Scale>
<Model>cavalry01.fxsxml</Model>
<MaterialTypeTag>METAL</MaterialTypeTag>
<MaterialTypeSoundOverrideTag>METALSM</MaterialTypeSoundOverrideTag>
</Row>
</ArtDefine_UnitMemberInfos>
<ArtDefine_UnitMemberCombats>
<Row>
<UnitMemberType>ART_DEF_UNIT_MEMBER_CAVALRY01</UnitMemberType>
<EnableActions>Idle Attack RunCharge AttackCity Bombard Death BombardDefend Run Fortify CombatReady</EnableActions>
<HasShortRangedAttack>1</HasShortRangedAttack>
<HasStationaryMelee>1</HasStationaryMelee>
<HasRefaceAfterCombat>0</HasRefaceAfterCombat>
<ReformBeforeCombat>1</ReformBeforeCombat>
<HasIndependentWeaponFacing>1</HasIndependentWeaponFacing>
</Row>
</ArtDefine_UnitMemberCombats>
<ArtDefine_UnitMemberCombatWeapons>
<Row>
<UnitMemberType>ART_DEF_UNIT_MEMBER_CAVALRY01</UnitMemberType>
<Index>0</Index>
<SubIndex>0</SubIndex>
<VisKillStrengthMin>25.0</VisKillStrengthMin>
<VisKillStrengthMax>50.0</VisKillStrengthMax>
<HitEffect>ART_DEF_VEFFECT_TANK_IMPACT_$(TERRAIN)</HitEffect>
<WeaponTypeTag>EXPLOSIVE</WeaponTypeTag>
<WeaponTypeSoundOverrideTag>EXPLOSION20POUND</WeaponTypeSoundOverrideTag>
</Row>
</ArtDefine_UnitMemberCombatWeapons>
<ArtDefine_StrategicView>
<Row>
<StrategicViewType>ART_DEF_UNIT_CAVALRY01</StrategicViewType>
<TileType>Unit</TileType>
<Asset>SV_ModernArmor.dds</Asset>
</Row>
</ArtDefine_StrategicView>
</GameData>
"
 

Attachments

  • on mods folder.png
    on mods folder.png
    175.9 KB · Views: 207
  • inside mod folder.png
    inside mod folder.png
    140.1 KB · Views: 268
  • inside civ5be folder.png
    inside civ5be folder.png
    110.7 KB · Views: 211
  • on XML.png
    on XML.png
    208 KB · Views: 232
  • ig mods.png
    ig mods.png
    1.5 MB · Views: 341
  • ig game.png
    ig game.png
    3.5 MB · Views: 14,607
Last edited:
1. Not the right subforum; this is where completed models are shared. I've alerted the moderators.
2. The spearman is the default unit if the .fxsxml isn't found. I suspect that you didn't set VFS=True for the art files (i.e., the .fxsxml file, the .ftsxml trigger file, and the .gr2 models/animations and .dds textures) in ModBuddy.
3. Even with VFS=True it still wouldn't have worked, as there was the addition of a string database in BE that isn't used in Civ5. This requires you to resave the gr2s. You're going to need to do some conversion using Nexus Buddy 2 (be sure to see this post). You're also going to need to add the sound effects files (also VFS=True), and unless you want to make your mod a quasi-DLC, you're going to want to replace the particle effects from BE with approximations using the effects from Civ5.
 
Moderator Action: Welcome to CivFanatics. Moved to the main C&C forum as that is where questions belong. Best of luck with your modding.
 
1. Not the right subforum; this is where completed models are shared. I've alerted the moderators.
2. The spearman is the default unit if the .fxsxml isn't found. I suspect that you didn't set VFS=True for the art files (i.e., the .fxsxml file, the .ftsxml trigger file, and the .gr2 models/animations and .dds textures) in ModBuddy.
3. Even with VFS=True it still wouldn't have worked, as there was the addition of a string database in BE that isn't used in Civ5. This requires you to resave the gr2s. You're going to need to do some conversion using Nexus Buddy 2 (be sure to see this post). You're also going to need to add the sound effects files (also VFS=True), and unless you want to make your mod a quasi-DLC, you're going to want to replace the particle effects from BE with approximations using the effects from Civ5.


Thank you very much. Tomorrow I might try and change the VFS settings. As for the gr2 conversion, I also had checked out that specific thread yet did not understar what the OP meant with it, going to try it ASAP but I'm running out of time today so might have to finish tomorrow.
 
The sounds is something that I need to take care of, they have also been decompressed, I just need to sort them. The particle effects is what has got me more intrigued. How do I do it?
 
See this thread. It'll involve tweaks to the .ftsxml trigger file and some bone scaling in Nexus Buddy.


Yes, this is also necessary.
Have you tried reloading the unit system? It's in the project properties in modbuddy.


Okay guys, did what you said and.... It worked (see pictures below)
However, in order for it to load I have to go to the mod properties and add actions when the mod is loaded to update the database and the user data.(see below) Is this normal?
 

Attachments

  • IG PHASE 1.png
    IG PHASE 1.png
    4.8 MB · Views: 272
  • mb.png
    mb.png
    113.8 KB · Views: 250
Also, I don't seem to find where I am supposed to place the Sound files. In a separate folder or in the art folder? And do I have to specify them in a .xml file or do they come attached to the unit?
 
Is this normal?
That's how Civ5 mods work. Either a file is in VFS (the game's virtual file system), or it uses the properties to set an action to add it to the database or to set a Lua entry point. Without one of those, the file doesn't really exist in the game. See this thread.

Also, I don't seem to find where I am supposed to place the Sound files. And do I have to specify them in a .xml file or do they come attached to the unit?
The sound files are VFS=True, and folders basically don't matter to the VFS [the only exception is if the game is trying to distinguish between 2 files with the same name; this is why you want to ensure you're using unique filenames for VFS=True files]. Sounds and effects are called using triggers in the .ftsxml, or they're referenced in the art defines (which is why you're referencing, e.g., the "METAL" material type and "EXPLOSI[ON]" weapon type).
 
That's how Civ5 mods work. Either a file is in VFS (the game's virtual file system), or it uses the properties to set an action to add it to the database or to set a Lua entry point. Without one of those, the file doesn't really exist in the game. See this thread.


The sound files are VFS=True, and folders basically don't matter to the VFS [the only exception is if the game is trying to distinguish between 2 files with the same name; this is why you want to ensure you're using unique filenames for VFS=True files]. Sounds and effects are called using triggers in the .ftsxml, or they're referenced in the art defines (which is why you're referencing, e.g., the "METAL" material type and "EXPLOSI[ON]" weapon type).

So, I have to create an entry on the ArtDefine file? And what do I put in them? Is there a template of some sort of what I'm supposed to put on each sound (like what critical categories of sound are required)?
 
So, I have to create an entry on the ArtDefine file? And what do I put in them? Is there a template of some sort of what I'm supposed to put on each sound (like what critical categories of sound are required)?
NVM, just had to get the ftsxml file from the bunch of converted files. The thing is, the ftsxml file has all these event tags that require "ART_DEF_VEFFECT" Files, which I presume are the effects, and "AS3D_UNIT_CAVALRY" which I think are the sound files. The thing is, where do I find those ART_DEF_VEFFECT amd AS3D entries?
upload_2018-10-17_18-29-33.png


Edit: So I found the AS3D files from the modern armor and used the 3ds scripts file as a base for the AS3D's, but even after changing them I still don't get any sound from the unit
sound.png


Edit2: So apparently, in game the only sound is the explosions on target...I wonder why that is the case?
 
Last edited:
You don't actually need to update user data, right? Only update the database. I've never modded units before, so I don't know
 
[UPDATE]
So, by changing the Sounds in the FTSXML files to the mechanized infantry ones, I was able to put it with sound, and effects aswell. Now all I need to take care are the Flag Atlas Symbols... I created a made-up file using png images from the Civ Wiki (see below). Put them in a dds file, and called it atlas.dds.
I then created an Atlases.xml file (shown below) and described the atlas as being FLAG_ATLAS_BE.
I set the parameters and changes the flag atlas designation in the cavalry.xml file to FLAG_ATLAS_BE. But it isn't showing up... I even set the .xml file to true. What is happening here?

Here's the Atlases.xml File
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 10/18/2018 5:00:30 PM -->
<GameData>
<IconTextureAtlases>
<Row>
<Atlas>FLAG_ATLAS_BE</Atlas>
<IconSize>256</IconSize>
<Filename>Atlas.dds</Filename>
<IconsPerRow>4</IconsPerRow>
<IconsPerColumn>4</IconsPerColumn>
</Row>
</IconTextureAtlases>
</GameData>
 

Attachments

  • aTLAS.png
    aTLAS.png
    117.4 KB · Views: 190
  • aTLAS2.png
    aTLAS2.png
    796.4 KB · Views: 245
  • aTLAS3.png
    aTLAS3.png
    105 KB · Views: 182
Since you are using paint.net, save icons with no mipmapping, or they won't work. But your problem is most likely icon sizes. This thread here says you also need 128, 80, 64, and 45 icon sizes for your atlas. Also, note unit action and unit sv icon sizes.
https://forums.civfanatics.com/threads/icon-and-screen-pixel-dimension-reference.499400/

You will have to create a new row in the IconTextureAtlases table for each new icon size. Alternatively, you could use sql:
Code:
INSERT INTO IconTextureAtlases
    (Atlas, IconSize, Filename, IconsPerRow, IconsPerColumn)
VALUES
    ('FLAG_ATLAS_BE', 256, 'Atlas256.dds', 4, 4),
    ('FLAG_ATLAS_BE', 128, 'Atlas128.dds', 4, 4),
    ('FLAG_ATLAS_BE', 80, 'Atlas80.dds', 4, 4),
    ('FLAG_ATLAS_BE', 64, 'Atlas64.dds', 4, 4),
    ('FLAG_ATLAS_BE', 45, 'Atlas45.dds', 4, 4);

Unrelated but also don't save with DXT3 or 5 compression or you will get artifacts (copy this to pdn and zoom way in):
sj9yooz.png

I'm not horsehockeyting on DXT here, it is great for larger image textures, but generally is not a good idea for small images, such as the icons that civ uses. Save using A8R8G8B8 instead
 
NVM, just had to get the ftsxml file from the bunch of converted files. The thing is, the ftsxml file has all these event tags that require "ART_DEF_VEFFECT" Files, which I presume are the effects, and "AS3D_UNIT_CAVALRY" which I think are the sound files. The thing is, where do I find those ART_DEF_VEFFECT amd AS3D entries?

Like art defines, the way that Firaxis gets to do it is different from how we need to do it for a mod. So to add your .wav files as an AS3D entry, you add them to the database like so (this is from Deliverator's T-Rex unit, note you do not provide the .wav file extension to the filename):
Spoiler :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<GameData>
  <Audio_Sounds>
    <Row>
      <SoundID>SND_UNIT_TREX</SoundID>
      <Filename>trex</Filename>
      <LoadType>DynamicResident</LoadType>
    </Row>
    <Row>
      <SoundID>SND_UNIT_TREX_STEP</SoundID>
      <Filename>trexstep</Filename>
      <LoadType>DynamicResident</LoadType>
    </Row>
  </Audio_Sounds>
  <Audio_3DSounds>
    <Row>
      <ScriptID>AS3D_UNIT_TREX</ScriptID>
      <SoundID>SND_UNIT_TREX</SoundID>
      <SoundType>GAME_SFX</SoundType>
      <MaxVolume>70</MaxVolume>
      <MinVolume>45</MinVolume>
      <IsMusic>0</IsMusic>
    </Row>
    <Row>
      <ScriptID>AS3D_UNIT_TREX_STEP</ScriptID>
      <SoundID>SND_UNIT_TREX_STEP</SoundID>
      <SoundType>GAME_SFX</SoundType>
      <MaxVolume>55</MaxVolume>
      <MinVolume>40</MinVolume>
      <IsMusic>0</IsMusic>
    </Row>
  </Audio_3DSounds>
</GameData>

Make sure you set Reload Audio System, the XML you add the above to is set to UpdateDatabase, and your .wav files are VFS=True.

Edit2: So apparently, in game the only sound is the explosions on target...I wonder why that is the case?
The reason for this was that the explosion sound is from the art defines as I mentioned above, not the .ftsxml.
 
Like art defines, the way that Firaxis gets to do it is different from how we need to do it for a mod. So to add your .wav files as an AS3D entry, you add them to the database like so (this is from Deliverator's T-Rex unit, note you do not provide the .wav file extension to the filename):
Spoiler :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<GameData>
  <Audio_Sounds>
    <Row>
      <SoundID>SND_UNIT_TREX</SoundID>
      <Filename>trex</Filename>
      <LoadType>DynamicResident</LoadType>
    </Row>
    <Row>
      <SoundID>SND_UNIT_TREX_STEP</SoundID>
      <Filename>trexstep</Filename>
      <LoadType>DynamicResident</LoadType>
    </Row>
  </Audio_Sounds>
  <Audio_3DSounds>
    <Row>
      <ScriptID>AS3D_UNIT_TREX</ScriptID>
      <SoundID>SND_UNIT_TREX</SoundID>
      <SoundType>GAME_SFX</SoundType>
      <MaxVolume>70</MaxVolume>
      <MinVolume>45</MinVolume>
      <IsMusic>0</IsMusic>
    </Row>
    <Row>
      <ScriptID>AS3D_UNIT_TREX_STEP</ScriptID>
      <SoundID>SND_UNIT_TREX_STEP</SoundID>
      <SoundType>GAME_SFX</SoundType>
      <MaxVolume>55</MaxVolume>
      <MinVolume>40</MinVolume>
      <IsMusic>0</IsMusic>
    </Row>
  </Audio_3DSounds>
</GameData>

Make sure you set Reload Audio System, the XML you add the above to is set to UpdateDatabase, and your .wav files are VFS=True.


The reason for this was that the explosion sound is from the art defines as I mentioned above, not the .ftsxml.
Since you are using paint.net, save icons with no mipmapping, or they won't work. But your problem is most likely icon sizes. This thread here says you also need 128, 80, 64, and 45 icon sizes for your atlas. Also, note unit action and unit sv icon sizes.
https://forums.civfanatics.com/threads/icon-and-screen-pixel-dimension-reference.499400/

You will have to create a new row in the IconTextureAtlases table for each new icon size. Alternatively, you could use sql:
Code:
INSERT INTO IconTextureAtlases
    (Atlas, IconSize, Filename, IconsPerRow, IconsPerColumn)
VALUES
    ('FLAG_ATLAS_BE', 256, 'Atlas256.dds', 4, 4),
    ('FLAG_ATLAS_BE', 128, 'Atlas128.dds', 4, 4),
    ('FLAG_ATLAS_BE', 80, 'Atlas80.dds', 4, 4),
    ('FLAG_ATLAS_BE', 64, 'Atlas64.dds', 4, 4),
    ('FLAG_ATLAS_BE', 45, 'Atlas45.dds', 4, 4);

Unrelated but also don't save with DXT3 or 5 compression or you will get artifacts (copy this to pdn and zoom way in):
sj9yooz.png

I'm not ****ting on DXT here, it is great for larger image textures, but generally is not a good idea for small images, such as the icons that civ uses. Save using A8R8G8B8 instead

Alright, thank you guys! I will try the mipmapping method and as for the sounds, might replace them, but for now, I'm just testing the basic combat and seeing if I can add a second unit.(Oh, BTW Nutty I didn't know you were the one who created the camerarotation mod but I've got to say I've been using it for years and It's fantastic)
 
Back
Top Bottom