Help adding unit

Midnight-Blue766

The filidh that cam frae Skye
Joined
Sep 24, 2007
Messages
3,467
Location
Trotland the Brave
All right, I'm making another foray into CIV modding. I've added a Fusilier unit in between the Musketman (renamed the Arquebusier) and Rifleman and added a tech called Military Tradition that it requires. Without the Fusilier, the Military Tradition tech works fine, but I can't get the Fusilier unit to appear at all, and the Military Tradition vanishes from the tech tree. Once again, I'm not sure what I'm doing wrong here, and I can't find a clear, concise tutorial about how to add units to BNW. Any help?
 
Though I haven't checked every last thing, the most glaring issue is in Fusilier.xml, and it's related to how you're changing the Musketman, Rifleman, Musketeer, etc.

As a rule, whenever you're updating already-existing definitions (like the Musketman or Rifleman), you do not use <Row>; you use <Update>. This is because <Row> will attempt to add a new Musketman to the database, but since it already exists, Civ5 discards your definition and the whole file it's in (such are the perils of XML).

<Update> removes a lot of the hassle and won't cause errors that conflict with the existing game database. For simplicity's sake, let's assume you're just changing the obsolete tech (to account for the Fusilier's existence and the new tech), and it would follow this structure:
Code:
<Units>
	<Update>
		<Where Type="UNIT_MUSKETMAN" />
		<Set ObsoleteTech="TECH_MILITARY_TRADITION" />
	</Update>
</Units>
Rinse and repeat for each unique Musketman/Rifleman you have to replace, and the structure is the same for anything else you may want to change--search for where you want to change something, then change the specific field you want.

Similarly, for renaming the Musketman to the Arquebusier:
Code:
<Language_en_US>
	<Update>
		<Where Tag=TXT_KEY_UNIT_MUSKETMAN" />
		<Set Text="Arquebusier" />
	</Update>
</Language_en_US>
This mistake is also present in other areas (like <Unit_Flavors>, where you're changing the flavors of the Musketman).
As you might guess, because the Fusilier does not already exist, using <Row> tag to add it is perfectly alright.

There's a similar issue in your definition of the Military Tradition tech, because you use <Row> to try to change TECH_RIFLING (except it already exists). I don't know what exactly you're trying to change at a glance, but use the <Update> statement as shown above instead of <Row>.

This is true of everywhere you're trying to modify something that already exists in-game; in those cases, use <Update> instead of <Row>.
 
Thanks, I ran through the mod and fixed everything (and then some), and everything loads. However, I've run into another error: even though I've added the Art defines and set the Granny to the civ5_genmm1.fxsxml file, the Fusilier shows up as Spearmen for some reason:



Once again, I've attached the build.
 

Attachments

  • Over the Hills and Far Away.rar
    170.3 KB · Views: 28
Based on your .modinfo file, the reason your unit is appearing as a Spearman (which is the default "something has gone wrong" appearance Civ uses) is because you didn't set VFS=true for your art files. .dds, .gr2, and .fxsxml files all need to be imported into the file server to be accessed, and you also need to check "Reload Landmark System" and "Reload Unit System" in your Project properties for it to all work.

You can read up on when to use VFS, reload systems, etc. in whoward's post here. (also related: you don't need your art XML file to have VFS set to true, only the art files themselves)
 
EDIT: I think I got it, let's just see if it works and...

It still seems to be spearmen? Okay, how exactly does this import into file server thing work? I thought dragging the files into the modbuddy and then checking true for VFS would work, but no...
 
  1. We need the built version of the mod as it is in the game's MODS folder. The entire modbuddy project is actually of no value to us because this is not what the game gets and sees. whoward69's zip your mods and attach tutorial
  2. You have not actually added to your modbuddy project any of the art files or fxsxml files that the unit's ART_DEF needs in order to function correctly. Common Novice-Modder Mistakes -- ""PLOPPING" FILES INTO THE MODBUDDY PROJECT FOLDER FROM THE BROWSER INSTEAD OF ADDING THEM WITHIN MODBUDDY". Nothing in your Project's "ART" folder is making into the actual built version of the mod, and this is the most common cause/misunderstanding related to that.
    • You need to use the "Add New Item" / "Add Existing Item" dropdown menu in the toolbar and select "Add Existing Item" which opens a browser dialog where you can find and select the pre-existing file(s) you need to add to the project. If you select your ART folder first before doing this, the files will be added within your ART folder. Or you can right-click the ART folder and this brings up a dropdown menu with "ADD" > "Existing Item" as a choice.
  3. You need to check the 'Reload Unit System' checkbox in modbuddy. Common Novice-Modder Mistakes -- "NOT CHECKING THE REQUIRED MODBUDDY CHECK-BOXES"
  4. You are using outdated XML-methods for adding a unit Art Definition to the game: Common Novice-Modder Mistakes -- "USING OUTDATED FILE STRUCTURES (For Unit Art Defines especially)"
  5. You are using incorrect "activation" file-settings within modbuddy: whoward69's what ModBuddy setting for what file types tutorial
Given the need to fix all this first before proceeding farther, I did not look in the actual code of your XML-files.
 
Thank you. I am working on it right now.

EDIT: AAAND IT WORKS! Thank you, LeeS and thank you Cyphose for your advice and patience! :goodjob:

Now my next task is to replace that hideous Austrian red with a beautiful white...
 
Top Bottom