Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

[Solved] Gamebreaking Bug with Magic after Gamemaker 2023.1 Release

A topic by Envy2331 created Feb 01, 2023 Views: 291 Replies: 6
Viewing posts 1 to 6
(1 edit)

I've tried completely reverting changes, re-extracting the zip, everything pretty standard, but for some reason I get the following error even after returning the project to it's completely original state. The Bug seems to have something to do with magic, as whenever I completely remove spells from global.party actions[], the game runs fine (just without fire or ice etc. of course).

___________________________________________

############################################################################################

ERROR in

action number 1

of  Step Event0

for object oBattle:

trying to index a variable which is not an array

 at gml_Script_anon_anon_anon_gml_Object_oBattle_Create_0_1502_gml_Object_oBattle_Create_0_3955_anon_gml_Object_oBattle_Create_0_1502_gml_Object_oBattle_Create_0_4001_anon_anon_gml_Object_oBattle_Create_0_1502_gml_Object_oBattle_Create_0_3955_anon_gml_Object_oBattle_Create_0_1502_gml_Object_oBattle_Create_0 (line 139) -                                           if (_option[0] == "Attack") return 99;

############################################################################################

gml_Script_anon_anon_anon_gml_Object_oBattle_Create_0_1502_gml_Object_oBattle_Create_0_3955_anon_gml_Object_oBattle_Create_0_1502_gml_Object_oBattle_Create_0_4001_anon_anon_gml_Object_oBattle_Create_0_1502_gml_Object_oBattle_Create_0_3955_anon_gml_Object_oBattle_Create_0_1502_gml_Object_oBattle_Create_0 (line 139)

gml_Script_anon_anon_gml_Object_oBattle_Create_0_1502_gml_Object_oBattle_Create_0_3955_anon_gml_Object_oBattle_Create_0_1502_gml_Object_oBattle_Create_0 (line 146) -                                    return _Priority(_b) - _Priority(_a);

gml_Script_anon_gml_Object_oBattle_Create_0_1502_gml_Object_oBattle_Create_0 (line 135)

gml_Object_oBattle_Step_0 (line 42) -               if (!instance_exists(oMenu)) DoTurn(units[turn]);

Another thing to note, the crash only happens at the start of the turn involving the party member with spells like fire or ice.

Hey!  I'm having the exact same issue

Developer

Thanks! Will take a look at this asap

Developer

Ok I've found the issue, it's because I was setting menuOptions[i] to be the new top level action when compiling the menu. This means if we did a sub-menu action in between two top level actions (like magic) when the next top level action is added, i has increased by more than 1 and there will be 0s added in between.  For some reason this never threw an error previously. I'm really not sure why it didn't! This probably also explains why a similar error appeared for another user in HTML5. Thanks for the report, I'll upload a fix for this now.

Developer (1 edit)

This fix has now been uploaded: https://shaunjs.itch.io/shauns-turn-based-battle-system/devlog/484288/hotfix-for... please let me know if you still have issues!

If you want you can quickly implement the fix for yourself if you don't want to replace the project.  Change line 120 of oBattle's create event to read as follows:

if (_action.subMenu == -1) array_push(_menuOptions,[_nameAndCount, SelectAction, [_unit, _action], _available]);

Fix works perfectly, thanks.