Hello there,
i would like to build a mod showing the current worker count on a mill or a plantation.
However I am new to modding AoE3. Maybe somebody can help me fixing my problems. The mod is displayed within the mod interface in the game but I am not sure whether it is even noticed by the game. I tried writing some wrong code into the .xml. Since it didnt crash I think my code is not used instead of the vanilla code of Data.XMB like it should be possible in AoE3 DE.
Is there a way to test if Additive Data Mods is working properly?
https://support.ageofempires.com/hc/en-us/articles/360062106732-Additive-Data-Mods
Thanks for some advice!!
My folder structure looks like this:
…\Age of Empires 3 DE\76561198013146205\mods\local\WorkerDisplayMod
C:.
│ mod.png
│ modinfo.json
│
├───Data
│ protomods.xml
│
├───resources
│ └───scripts
│ worker_display.xs
│
└───ui
└───ingame
worker_display.xml
modinfo.json
{
“name”: “WorkerDisplayMod”,
“version”: “1.0”,
“description”: “Zeigt Arbeiterzahl über Mühlen und Plantagen an.”,
“author”: “Weizen”,
“type”: “Data”
}
protomods.xml
<unit name="Plantation">
<UIOverlay file="ui/ingame/worker_display.xml"/>
</unit>
worker_display.xs
// ===============================
// Arbeiter zählen
// ===============================
int GetWorkerCount(int buildingID)
{
int count = 0;
int i = 0;
int total = kbUnitCount(cUnitTypeSettler);
for (i = 0; i < total; i++)
{
int id = kbUnitGetIDByIndex(cUnitTypeSettler, i);
if (kbUnitGetTargetUnitID(id) == buildingID)
{
count++;
}
}
return count;
}
// ===============================
// Anzeige aktualisieren
// ===============================
rule UpdateWorkerDisplay
minInterval 1
active
{
// Gebäude-IDs holen
int mill = kbUnitGetIDByType(“Mill”);
int plantation = kbUnitGetIDByType(“Plantation”);
// Arbeiter zählen
int millWorkers = GetWorkerCount(mill);
int plantationWorkers = GetWorkerCount(plantation);
// UI aktualisieren
uiSetText("WorkerDisplayTextMill", "Mühle (" + millWorkers + ")");
uiSetText("WorkerDisplayTextPlantation", "Plantage (" + plantationWorkers + ")");
}
worker_display.xml
<Text id="WorkerDisplayTextPlantation"
style="OverlayText"
position="0.0 0.0"
anchor="CENTER"
color="255 255 255"
fontsize="100"/>
The “Mill”-syntax is from Data.XMB from protoy.xml.xmb - Intentionally I didn’t write id=“287”.
