Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Second term as in "global.weapon_data[c][pstat_UPGRADESMAX]".

Hmm, judging by the message everything wasn't set up as expected (the upgrades_obtained array is too short), it should be a two-dimensional array that's got as many slots on the first axis as the number of weapons the player can obtain, and the second axis should have PWD_LOCALDATA_MAX elements (now I'm realizing that's not actually correct, you want this number to be the max number of different upgrade choices any weapon can have - we're addressing by upgrade index and not by stat - but so far none of them has 12 upgrade paths so it should be fine).

But either way, global.weapon_upgrades_obtained should be at least a 6-by-12 element array, but it's only 2 elements along one axis, so something's weird there. The first step would be to print its contents with show_debug_message(global.weapon_upgrades_obtained) at the start of the function and see what's actually in it when the game crashes. (Note that it's not enough to just set array[5][11] to 0 when initializing it, that'll give you a 6 element array which contains a 12-element array in the 6th slot and the number 0 in the prior five slots - 2D arrays are just arrays of 1D arrays so if you want the inner arrays to have the same length you need to manually put one in every slot of the outer array)

Oh yeah, and another issue, you're checking global.weapon_upgrades_obtained[c], but you should check global.weapon_upgrades_obtained[c][d] because upgrade level is per-upgrade now instead of shared for the entire weapon. (You'll need to move this check into the loop over array_length(ups) as well)