Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Actually, the reverse is working (horde battles working, 1v1 battles are not) but I tried adding that condition but then got a similar error to what I have been  getting: 

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

ERROR in

action number 1

of Draw Event

for object obj_battlemonsterhud:

Push :: Execution Error - Variable Index [-12341] out of range [419] - -5.active_monster_party(100075,-12341)

 at gml_Script_amp_read_var (line 3) -        return global.active_monster_party[argument0,argument1];

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

gml_Script_amp_read_var (line 3)

gml_Script_monster_get_name (line 4) -        var s = amp_read_var(amp_id,amp_NICKNAME);

gml_Object_obj_battlemonsterhud_Draw_0 (line 12) -               draw_text(xx,yy,monster_get_name(amp))

sorry for the trouble! I really appreciate your help as I am still trying to make sense of the ins and outs of the battle system

(1 edit)

Either way it's still caused by there being NONE monster IDs in the list of enemies to fight. Weird.

I had a little dig in the codebase and I think I have another idea for what could cause this. The code that checks for valid monsters to send out only checks if HP > 0. If the matching AMP ID's amp_MONID is NONE then we have an invalid monster ID and reading data from that will cause issues.

Do you set up / clear data for totems properly (similar to how the engine handles enemy data in random encounters)? It feels like there might be something going on with partially initialized data that causes this.

One idea might be to extend battle_get_valid_reinforcements a bit so that line 6 checks this condition instead:

if(global.active_monster_party[mon,amp_HP] > 0 && global.active_monster_party[mon,amp_MONID] != NONE){

It's not fixing the core issue that causes the invalid data but it at least stops trying to spawn a nonexistant monster. Maybe it'll be enough, since most other AMP manipulation scripts checks if the monster ID is NONE to check if a slot is valid.