Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when trying to make an in-match menu. #1870

Open
FranticFairy opened this issue Jan 21, 2025 · 0 comments
Open

Crash when trying to make an in-match menu. #1870

FranticFairy opened this issue Jan 21, 2025 · 0 comments

Comments

@FranticFairy
Copy link

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]);
    }
};
@FranticFairy FranticFairy changed the title Crash when trying to make an in-battle menu. Crash when trying to make an in-match menu. Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant