Description
So, I know this is a mod crash, but I also just... don't really understand how to avoid this one.
I'm trying to make a menu, similar to the build units menu, but this time showing off the perks a CO has active, and I'm running into an issue that I've run into a few times now; the game is very... picky about what icons it will allow me to display.
Am I doing something wrong, and trying to use images that the game does not support putting in this menu? Is there a bug somewhere in the game itself? Or is there a bug in my code itself?
I'd really like to know if I'm doing something wrong here, or if the game just doesn't support showing some things - and in which case, how can I tell what it does and does not support showing.
20250121-143532 Commander Wars Crash.log
(Yes I know there's no proper checks to make sure there actually are perks to display, this is test code, and I know there are perks in the situation I'm testing in).
this.getStepData = function (action, data, map) {
var player = map.getCurrentPlayer();
var co = player.getCO(0);
var perks = co.getPerkList();
var perkData = [];
for (i = 0; i < perks.length; i++) {
var forPerk = perks[i];
var cost = Global[forPerk].getCosts();
perkData.push([cost, perks[i]]);
}
for (i = 0; i < perkData.length; i++) {
var name = Global[perkData[i][1]].getName();
var icon = Global[perkData[i][1]].getIcon().toUpperCase();
GameConsole.print(icon,1);
/*
GameConsole.print("i, 0tS: " + perkData[i][0].toString(),1);
GameConsole.print("i, 1: " + perkData[i][1],1);
GameConsole.print("i, 1: " + perkData[i][1],1);
GameConsole.print("i, 0: " + perkData[i][0],1);
//data.AddData(text, actionID, icon, costs, enabled)
*/
//data.addData(name + " " + perkData[i][0].toString(), perkData[i][1], "icon_fire", perkData[i][0]); <- This one works
data.addData(name + " " + perkData[i][0].toString(), perkData[i][1], icon, perkData[i][0]);
}
};