Thanks so much for the help, really appreciate it! Just got a moment to debug as suggested with breakpoints on the AI script, and it confirms the issue--"actions" is undefined each time before a crash. (Screenshot attached). It's strange because, again, it defines itself just fine for several turns before something goes wrong. I'll keep messing around in debug and see what I can find!
lena102
Recent community posts
Hi Shaun! Thanks so much for your work on this project--I've been watching the YouTube releases and have found the source code incredibly helpful as I follow along and learn from how you've built these systems!
I realize that you are unlikely to respond to every dummy like me who is struggling with implementing the code, but as I suspect many others will also be trying to mesh this project with elements from your ARPG series, I thought starting a thread might be helpful in case anyone else comes across this particular issue. I have been getting the following error message:
############################################################################################
ERROR in
action number 1
of Step Event0
for object oBattle:
Variable <unknown_object>.actions(100162, 0) not set before reading it.
at gml_Script_anon____struct___19____struct___18_gml_GlobalScript_GameData_5117____struct___19____struct___18_gml_GlobalScript_GameData (line 238) - var _action = actions[0];
############################################################################################
gml_Script_anon____struct___19____struct___18_gml_GlobalScript_GameData_5117____struct___19____struct___18_gml_GlobalScript_GameData (line 238)
gml_Script_BattleStateSelectAction_gml_Object_oBattle_Create_0 (line 188) - var _enemyAction = _unit.AIscript();
gml_Object_oBattle_Step_0 (line 1) - battleState();
_______
Running version IDE v2023.2.1.75.
The crash happens when the enemy acts using the AI function, as the message says, and the first enemy encounter is never affected. It's only happening during subsequent encounters--after escaping from the enemy and fighting it again, while fighting other instances of the same enemy type, or after leaving the test room and returning to battle the respawned defeated enemy a second time. Even then, it's inconsistent in when it happens; sometimes the AI will work fine for a turn or two before crashing. I will also occasionally receive errors like the above, only referencing seemingly random objects in my test room (prop objects--trees and whatever with nothing on them but collision) rather than the <unknown_object> as above. Occasionally the error message will instead be the "trying to index a variable which is not an array" message. All other aspects of the battle have been working fine.