On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(+1)

It's been so long I've completely lost my original train of thought (happy 100-day anniversary!) but just looking at the last line in my last post, I think there's a clue here:

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)

I.e. if the loop fails because you don't set d, it's probably actually a symptom that you still only loop over one variable (you need to loop over all weapons, and then inside that loop, have another loop that loops over all the upgrades defined for that weapon).


(In case you're wondering about the names, I always name my first loop counter c because then I get to write "c++" for the increment statement and I find that funny. And then for subsequent inner loops I use d, e, f and so on because I ran out of programming languages and it's easier just cycling through all letters)

(+1)

I greatly apologize for that delay: and interesting tidbit, actually. I have only used 'i' for local variables or a relavant title because of some mental carry over from RPG Maker.


That aside: You're a god. I just moved the code to be:

for(var c = 0; c < WID_MAX; c++){

if(playerweapon_has(c)){

if(include_weapons_we_have){

var ups = global.weapon_data[c][pstat_POSSIBLEUPGRADES];

for(var d = 0; d < array_length(ups); d++){

if((global.weapon_upgrades_obtained[c][d]  < global.weapon_data[c][pstat_POSSIBLEUPGRADES][d][dbupgd_MAXUPGRADES]) || allow_surpassing_max_level){ //Can we upgrade it further?

At the top of that function and it seems to be working perfectly. Now I'm just going to add some text to show the current 'level' of that upgrade for visual clarity. Thank you so very much for helping me out and your patience.

No problem! Glad you finally got it working ^__^