New Unit Artdef Cooking Error

Joined
Jan 10, 2019
Messages
2,795
My first attempts on a real unit. Begin with Units.Artdef

The Fusilier... Yes basically 'Redcoat' with team colour outfit and Cavalry helmet. (I'll explain later why I pick this choice, but I think this choice fits every races well). this Units.Artdef is done by ModBuddy tools (through Copy and Paste buttons with some modifications... ) I've done all what I need, when I hit a 'cook' button, the error comes... for beginner like me this is the actual project after two of Leugi's tutorials to do.

And I think this one associated with how the units aren't displayed correctly in real game.

This is New Unit mod. can anyone elaborate this error message please and where in the Artdef file should I look at?
Cooking Error1.jpg


EDIT: I haven't expand (to show the entire hierachial trees in each of every folders) any directory yet. but i'm sure all neccessary foldiers are filled, yes C&P and adapt with few helmet details.
 
The lower One simply says that you referenced „DIS_CTY_RNWY_PALACE“, but it does not exist in the xlp file (hero_buildings.xlp). have you created a xlp file with that name? if not, do so. if yes, then you need to make an entry of that Palace.
 
1. i think so. An xlp file basically tells ModBuddy or the Asset Editor, what to cook into the blp file, as far as i know.
i dont know whether its necessary if you use just base game assets, but i think its worth a try to create a xlp, right?
2 and 3: you open Asset Editor, click on new file and then xlp, or new and then file and then xlp
then you give a name and a package name, but attention: the package name must be a specific one, depends on what you are trying to do.

but wait a moment...you said you actually trying to do a new unit, but this error message actually tells that there is a building, more correct a hero building is not referenced in this xlp file? Wow. I have absolutely no idea whats going on there from far away.

do nothing. You have two options now. send your whole modbuddy project folder to me or attach it to a comment here and i will take a look and then tell you whats wrong actually. OR you wait for Deliverator if you prefer...he got like a sixth sense in these kind of issues on how to solve them.
 
Maybe right. if hitting 'cook' button and error doesn't shown up then it should works.
and YES i'm trying to do a new unit (This time is MY unit and not Leugi's tutorials). using a very no brainer initiatives beyond 'What it should looks like to match historical appearances and functions' . There's also other works to do to define how will this unit works as actual unit ('late renaissance' anti cav unit for VANILLA. availables with civics (Enlightenment) rather than tech (to match history. AGAIN), stronger than Pike&Shot in RF but slightly below Redcoats (i'd like to tune them down abit too, they're UU available to Vicky (and not English, Ellie may not have access to it) but they ain't elits), also have limited range attack with a strengh of musketmen (representing regimental cannons permanently attached to it, adding SOME fire support just enough for any situations when actual field guns of artillery battery is not present yet) ) to assign its actual name (Unit portrait and icon is yet to be made),... etc.

OK Ryu, you got a greenlight.
 

Attachments

already searched for mistakes in your project...but there arent mistakes :)
at least not in the units.artdef. i just dont get why on earth you click on "cook"...i never did that, and my mods work, at least the art stuff. why do you want to click on cook?

other than that, i would say, try to ignore that cook button and the error messages, and continue with the xml coding. if you dont make a mistake here, then it should actually work ingame.
so...your units.artdef looks fine to me.
 
^ Why? Because I believe that the 'cook' button has to be clicked or it might not work meow. (in which case the 'cook' button must be clicked to finalize)

Now on to XML Coding. (I'm very new to it, i don't like programming but AFAIK this one requires manual typing and understanding the programming language the XML file uses)

1. Which one of the XML files concerns with how unit actually works? (in game name, costs, attacks, defense, upkeep, prerequisite techs/civics/resources, unit class and lineages (upgrades from and to) )
2. If I want this unit to perform 'range and melee' attack like what Persian Immortals and Privateers with homing torpedoes :p. codes (and lines) to dictate that the unit performs this mode of attack. With this, codes to declare the this unit perform a melee or range at a default rightclick?
And do Melee and Range attack uses the same strengh? is it possible to code that the range attack is slightly weaker (actually I've browsed Civ6 wikia (is it a correct referrence sources to get all attributes and profile numbers from?) I want this unit to have a melee strengh of, let say... 60 (Cavs melee strengh), ranged str. of 55 (as Musketmen have) )?
3. Which one concerns with unit portraits and icons? (I'm about to make it).. Is it possible to 'borrow' the existing portraits and icons for this purpose and edit later once the final pieces are completed.
4. If I use a default asset as a basis, do I have to add Unit_Bins.Artdef in Artdef folder too?
 
Last edited:
1. your NewUnit_Gameplay.xml
2. you must often look into the game files to see how things have to be done. So simply look into the game xml files, i believe units.xml in this case.
3. your newUnit_Icons.xml
4. nope.

PS: i think in your case, not NewUnit_......, but Fusilier_Gameplay/Icons/Text

i would really skip that „cook“ button step, and see if it will work without. I also believe the cook button will only work if you have setup everything correctly.
 
Got it.
Is this the correct gameplay code for my new unit? (This unit is intended to be a part of bigger mod that will re adjust unit lineages to be more historical, but rightnow no other new units are made for this mod yet so this unit mod is for VANILLA and is an insertion between Pikemen and AT Crew at this moment (other units are planned, including the Riflemen will be of this class as well).) I.E. Upgrades from Pikeman and to AT Crew.

<?xml version="1.0" encoding="utf-8"?>
<GameData>
<!-- Almost all gameplay types should first be added to the types table. -->
<!-- This serves as a central way to reference any type -->
<Types>
<Row Type="UNIT_FUSILIER" Kind="KIND_UNIT" />
</Types>

<!-- Define the actual unit. -->
<Units>
<Row>
<UnitType>UNIT_FUSILIER</UnitType>
<Name>LOC_UNIT_FUSILIER_NAME</Name>
<Description>LOC_UNIT_FUSILIER_DESCRIPTION</Description>
<BaseSightRange>2</BaseSightRange>
<BaseMoves>2</BaseMoves>
<Combat>60</Combat>
<RangedCombat>55</RangedCombat>
<Range>1</Range>
<Domain>DOMAIN_LAND</Domain>
<FormationClass>FORMATION_CLASS_LAND_COMBAT</FormationClass>
<PromotionClass>PROMOTION_CLASS_ANTI_CAVALRY</PromotionClass>
<PurchaseYield>"YIELD_GOLD"</PurchaseYield>
<PrereqCivic>CIVIC_THE_ENLIGHTENMENT</PrereqCivic>
<MandatoryObsoleteTech>TECH_CHEMISTRY</MandatoryObsoleteTech>
<StrategicResource>RESOURCE_NITER</StrategicResource>
<Maintenance>4</Maintenance>
<Cost>330</Cost>

</Row>
</Units>
</GameData>
 
UnitType have to be the same name as in your units.artdef under „Units“, so in units.artdef it was „UNIT_FUSILIER“ and here in your xml its the same, so thats correct.

for the rest of the code i am not sure, currently have no access to my pc, but do you use Notepad ++ ? in this program you can search entries of a given name.

so your new unit should be similar to for instance persian Immortal, then search for it, and then copy and paste the code from the game units.xml to your xml, and then change the names.

i am not sure if you have to add modifiers to your xml for have the unit work perfectly fine, but i am sure that this code you have right now, should be enough to test the unit art ingame...so long speak short sense: this code should be enough for testing your unit art, try it :)
 
too bad you're not on your PC at this moment.

And yes I did try. loading a new game, vanilla rules. (Starts at Industrial Era), instead of leader briefings (I choose Teddy, yes he leads the USA, a civ that actually begins at Industrial Era).. this error shown up.
Mod Error1.jpg

I believe I did something wrong, VERY wrong either on coding on one of any files (Yes I hit 'Build Solution' button to finalize the works), particularly on ICONS file where I need a makeshift icons and portraits that fits this unit bests (right now I use Musketmen icon and Redcoat portrait). even if I check combatibility on (This mod is designed for VANILLA, another setting headaches that I want this mod to run in game but the mod only takes effect in VANILLA game and not expansions... I'd prefer separate versions over one mod fits all expansions and DLC)
and I'm very sure this message came because of my mod. (and no other mods installed, only vanilla and other DLCs in Civ6 Gold packages i've bough last month when there's a discount promo on STEAM.)
 

Attachments

i would need your database.log please. you should find this file here: Documents\My Games\Sid Meier's Civilization VI\Logs
 
Here you are meow. I don't know if I've f___ed up some files unintentionally during the ARTDEF mod making process involving a massinve copy&paste stages .

Additionally. which codes and methods are needed to write down a civilopedia entry of a unit?
 

Attachments

Found whats causing the issue.

Look, in your database.log the decisive lines in your case are:

[2145740.932] [Localization] ERROR: Database::XMLSerializer (Fusilier_Text.xml): Cannot parse file. Error at Line = 0, col = 0
[2145743.943] [Gameplay] ERROR: FOREIGN KEY constraint failed
[2145743.943] [Gameplay] ERROR: FOREIGN KEY constraint failed
[2145743.943] [Gameplay]: Validating Foreign Key Constraints...
[2145743.962] [Gameplay] ERROR: Invalid Reference on Units.PurchaseYield - ""YIELD_GOLD"" does not exist in Yields
[2145743.962] [Gameplay] ERROR: Invalid Reference on Units.PurchaseYield - ""YIELD_GOLD"" does not exist in Yields

it tells you that something is wrong with your YIELD_GOLD entry.

Then i looked into your gameplay.xml and searched for a line with YIELD_GOLD in it, this way i found: <PurchaseYield>"YIELD_GOLD"</PurchaseYield>

compared to the base game entry for YIELD_GOLD in Yields.xml it have to be YIELD_GOLD instead of "YIELD_GOLD"....here from your xml: <PurchaseYield>"YIELD_GOLD"</PurchaseYield>

so thats wrong: <PurchaseYield>"YIELD_GOLD"</PurchaseYield>

and thats correct: <PurchaseYield>YIELD_GOLD</PurchaseYield>

just dont type " at the beginning and the end of the entry in this case.

and thats it, tested the unit ingame, and the game load, and the unit art also shows up ingame. Good Job! :)

attached is your gameplay.xml with my changes, if you want just copy and paste it into your project folder.

and for Civilopedia...i think it should look like this in your text.xml :

<Row Tag="LOC_PEDIA_UNITS_PAGE_UNIT_FUSILIER_CHAPTER_HISTORY_PARA_1">
<Text>Your Text you want to have ingame</Text>
</Row>

always bear in mind: the database.log is worth gold sometimes
 

Attachments

Let me try one. But right now I've finally completed a civilopedia entry for this unit. an unusually long one that covers every deeps and breadth of Fusiliers (and Fusils as a name of flintlock muskets).

<?xml version="1.0" encoding="utf-8"?>
<GameData>
<LocalizedText>
<!-- The name of the unit. -->
<Row Tag="LOC_PEDIA_UNITS_PAGE_UNIT_FUSILIER_NAME" Language="en_US">
<Text>Fusilier</Text>
</Row>

<!-- It's description. -->
<Row Tag="LOC_PEDIA_UNITS_PAGE_UNIT_FUSILIER_DESCRIPTION" Language="en_US">
<Text>A generic line infantry with anti cavalry ability. A direct descendants to Pikemen that capable of decent, weak, short ranged attacks (Isn't it better to shoot cavalrymen from a far than to charge them on foot? Horses can outmove human legs but not a shot, you know) that made possible with a combined, standardized musketry drill, permanently attached lightweight cannons, and rigid linear drills. this dual benefits however requires Niter for their gunpowders, both in training and actual uses.</Text>
</Row>

<Row Tag="LOC_PEDIA_UNITS_PAGE_UNIT_FUSILIER_CHAPTER_HISTORY_PARA_1" Language="en_US">
<Text>Fusilier is a name given to various kinds of foot soldiers; its meaning depends on the historical context. (Foundings, Functions,), originally means one who are armed with guns (Fusil, a French word originally means type of flintlock musket � now the term refers to a variety of firearms; including but not limited to repeating rifles and shotguns) the term has been used in contrasting ways in different countries and at different times, orginally artillery escorting foot soldiers (Fusils--which are flitlock firearms--are safer to carry around on active duty than matchlock firearms. Simply because flintlocks uses flint ignition to set off propelling powder rather than a hot naked firey chords matchlock uses and thus no accident via unintentional contacts between slowly burning chords and blackpowder storages possible when guarded by a fusilier), over time, Line Infantry, and even various elite units, are named 'Fusiliers', either the name is inherited, or simply because the name sounds cool. Over time all Line Infantry are technically fusiliers (due to aforemented firearms became common). Each of these regiments of Fusiliers (or Line Infantry in general) not only composed of 1,000 men with fusils, but also with one or two pieces of lightweight cannons (usually 3 or 4 pounders) called Infantry Guns or Regimental Guns, which marched along as part of Infantry regiment rather than Artillery battery.</Text>
</Row>
<Row Tag="LOC_PEDIA_UNITS_PAGE_UNIT_FUSILIER_CHAPTER_HISTORY_PARA_2" Language="en_US">
<Text>Fusil (which came from Latin "foisil", means a piece of flint), was introduced as firearms in 1610 by French court gunsmith Marin le Bourgeoys, he made a 'fusil' for King Louis XIII (Yes the same weak king present in Alexander Dumas Jr. 'The Three Musketeers'). Flint ignition mechanism for firearms however, dated back to 1500 with the introduction of Wheel lock firearms (The first that doesn't use hot glowing match to fire the gun) which were rather (still) cumbersome (but could be made concealabe for an assassin) and custom made (requires a huge deal of precision craftmanship, a gunsmith that made wheel lock guns were also a clock maker). eventually easier to use snaping flint ignition firearms were made as evolutionalry stages--Snap lock (1540s, originated in what's now Southern Germany) Snaphance (1550s, also from the same South Germany), and Miquelet (1580s, common in Mediterranean countries, possibly originated in Spain). While these flint ignition firearms are proven superior to matchlocks (safer and quicker to operate, less susceptible to weather constrains). the le Bourgeoys desing of 1610 was proven the cheapest and easiest to mass produce.. but only after the end of Thirty-Years' War. By that time, the distinctions of military-grade firearms--the Arquebuses, and Muskets--which were once easily identified by the need (or not need) to use monopoles-- where Muskets were once referred to heavier, large bore firearms that requires monopoles to support its weight, while Arquebus doesn't, became blurred out particularly with ironworking techniques of the 17th century that reduces a required proportions of iron to make a gun barrel. Eventually by the 1680s, Matchlock firearms are phased out from Europe, and replaced by superior and more reliable Flintlocks, either through a total replacements, or by converting the existing flintlock guns (many early flintlock muskets carried by soldiers by then still have fishtail stocks, which are common among matchlock muskets and arquebuses). Even so Military grade flintlock firearms are muzzle loaders and thus still low on rate of fire (one or two rounds per minute, well trained shooters may do 3 by flintlocks).</Text>
</Row>
<Row Tag="LOC_PEDIA_UNITS_PAGE_UNIT_FUSILIER_CHAPTER_HISTORY_PARA_3" Language="en_US">
<Text>Another no less important 'inventions' (rather aVicomte de Puys?gur.n accidential discovery) was a Bayonet, (A blade that attaches to the muzzle end of a firearm). The earliest bayonets are simply a knife or dagger with its shaft fit enough to plug the gun muzzle, first appeared in the world in 16th Century China, but its use in Europe was observed in Thirty-Years' War (Remember that, the war was the zenith of Pike and Shot infantry formations because, as mentioned before, firearms at that time were all slow-loading muzzle loaders, and pikemen are needed as close combat defensive measures (especially against cavalry charges), but in some instances pikemen aren't available, one simple solution, fitting a secondary weapon--any bladed weapons with its shaft into gun muzzle and musketmen instantly became pikemen (or more correctly, spearmen... muskets and arquebuses have the total lenghts about the same as a spear) and these guns can revert back to its original firearms function simply by removing that previously inserted blade). This solution did considered seriously in Europe (particularly through the memoirs of Jacques de Chastenet, Vicomte de Puys?gur.) and eventually, plug bayonet became standardized per orders of General Martinet of Royal French Army in 1671, issued to newly raised Fusilier regiment, followed by English in 1672 (issued to Dragoons), and Royal Fusiliers (an elite foot guards) in 1685. While plug bayonets were innovative solution, it was rather 'an ingenuity of complete fools'. plugging a blade into gun barrel disables the weeapon's ranged ability outright until the blade is removed (which aren't easy for a blade with its shaft fits into gun barrel by friction alone, and again this friction doesn't hold the blade shaft with the barrel that tight! also Insertion stage isn't a quick action either). Simply put, plug bayonets aren't reliable, as proven in Battle of Killiecrankie in 1689--where British Line Infantry and some pro-Brits Scotsmen lost that battle against Jacobite rebellion, where Jacobite swordsmen (supported by musketmen) charged downhills against British Line Infantry before the latter can fit a bayonet into their guns. Yet this shortcomings did lead to an evolutionary stage that further distincts military grade firearms from civilian ones--Ring Bayonets (a long spike forged into a barrel-sized ring, fitted outside the muzzle), Socket bayonets (the first with dedicated bayonet mounts) and Sword or Knife Bayonets, and so on (whenever ingeunities of gunsmits can bring, and... no barrel obstructions). With reliable bayonets (since Socket Bayonets), so ended Pike and Shot formations (except rebellions, less developed tribes, city states, kingdoms, republics, and empires outside Europe and in dire (and rare) situations by the states themselves).</Text>
</Row>
<Row Tag="LOC_PEDIA_UNITS_PAGE_UNIT_FUSILIER_CHAPTER_HISTORY_PARA_4" Language="en_US">
<Text>However, Flintlock muskets and bayonets don't make a fusilier (or Line Infantry of any kind). Technologies can make better weapons, but not better army. While bayonet can eliminate the needs of pikemen, bayonet drills certainly will. the reduced reach in melee combat means different melee combat patterns in every situations (including against cavalry charges) and thus came a new model bayonet drills. With this dual-purpose weapons came in common use, a foot soldier is required to get close order drill (considerably modified from pikemen drills), and musketry (inheriting from musketmen of previous era, volley fire commpensates an inaccuracy of smoothbore muskets with numbers of lead balls rushing out in each instances, fire by rank (developed from rolling volley of previous era) adds rate of fire to a given unit.. etc). European merchants sold a set of fusils worldwide, many of which sales came with bayonets as a default accessory (and maybe manuals). Many client countries and tribes might have exposed to/learned the existence of firearms before, they may know how to use guns, but had no idea what bayonets do. in 18th century Outside Europe and other whitemen domains, Fusils are treated as just another weapon for any previously avaialbe musketmen and Pike and shot units. Socket Bayonets often repurposed as a blade tip for polearms. Line Infantry requires not only these new weapons, but also military reorganizations, these aforemented drills require tighter disciplines, which... again requires a dedicated military services and not just a seasonal levy of peasantry. see? new army also requires civics too! By 18th Cetury, Asians and Middle Eastern domains didn't have any kind of line infantry even with european flintlock muskets periodically purchased. It was the second wave of Colonization that introduced these new form of footsloggers to them, through outright conquests by white conquerors, (where native troops are raised to serve), unequal treaties brought by humiliated defeat (particulary the First Opium War (1839�1842) which was a rude wake-up call to other Asian powers and steer them towards modernization efforts), or invasion potentials... and yes, these new armies are trained by either Europeans or American advisors.</Text>
</Row>
<Row Tag="LOC_PEDIA_UNITS_PAGE_UNIT_FUSILIER_CHAPTER_HISTORY_PARA_5" Language="en_US">
<Text>Fusiliers, as Line Infantry became a backbone of European Empires since 1680s, Inhertited to Continental American Nations by various names since their respecitve victories in their wars of Independence and onto the same era, while in Asia, Middle East and elsewhere, such introdictions were delayed until the second wave of colonizations since 1830s onwards. Firearms themselves didn't cease to develop. The introduction of breech loading (and later bolt action repeating) rifles into regular services in 1880s (made possible with the inventions of percussion primer made out of mercury fulminates in 1800) made linear formations (particularly with close order lines) impractical in combat. (Particularly when repeating rifles and associated ammunitions are very user friendly and are relatively cheap, rebellions outlaws and tribesmen already made extensive uses of repeating rifles around the same time). yet these legacies from the old days remain with us today, through basic military training, parades, and even some infantry units are still named 'Fusiliers'.</Text>
</Row>
</LocalizedText>
</GameData>

I still need additional commands that adds symbols (production, gold, resources needed... etc) to the civilopedia entry. and What do you think of my Civilopedia entry? can you make it better? (so many historical bits I tried to cram, but still much longer than standard Civilopedia entry of any other units).

Also. how can I edit any preexisting units? Do I need to make files and override directives and how? (like reorganizing Bombards into Medieval Era, made available with Engineering (which reveals Niter) MGs in Modern Era available with Replaceable Parts... for example).

EDIT: Tested (and a few Trial and Error with Civilopedia entry and I learn one or two things in coding). and the unit appears in the way it should be. (Yes. Line Infantry / Fusilier did wear cavalry leather helmet of this style too! some units and/or countries (particularly some Germanic Kingdoms at that time issued this helmets to infantrymen to some units and shakos to another, Austria did the same too)

MOD UnitTest2 (the way it should work).jpg
Mod Fusilier Test2 (civilopedia).jpg
The rest is setting upgrade routes (how? Which files must be make and which command lines must be written?), and ... yes. proper portraits and icons!!!

Ideas for Icon (Basically a musket with bayonet fixed to it)
Brownbess and bayonet2.jpg
Portrait
Fusilier_Portrait1.jpg
 
Last edited:
Back
Top Bottom