Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

It looks pretty reasonable, but you both update and delete daddy.daddy... I think you meant this? (destroying the "are you sure?" menu and the "what do you want to do?" menu)

instance_destroy()
instance_destroy(daddy)

(also of course you need to set my_monster to the AMP_ID (index in the Active Monster Party array) of the monster you want to delete when you create the menu that eventually runs mev_pause_monsters_release_confirm() , so the variable has a valid value... I presume you're doing this?)

(2 edits)

Yeah to both parts, but the list seems to not get updated. The msg pops up saying the correct monster get released and the correct menus get destroyed. Just the party list doesn't update correctly. Say I delete a monster in the middle of the list. It'll show a blank spot there, but then you won't be able to navigate pass that blank spot. Also I noticed after releasing if I hit 'X' to select a monster I get an error, but also if I hit 'Z' to go back it'll show the monster I just released back in the party. If I hit 'Z' one more time and then select the party again to bring up the list it shows it as gone and the menu functions as normal with the exception of navigating pass the blank spot in the list. Hopefully that makes sense.

Looked around in the code...

  • The reason there's a "gap" in the list is because msh_spawn_monster_list stops whenever the monster ID is NONE, and after you clear the data, the monster in the middle will have all its data set to NONE. You can fix that by looping from the now-empty ID to c <= AMP_FIRST_ACTIVE + PARTYSIZE_ACTIVE - 2, and for each slot, copy data from the next slot, and then finally erase the data in the AMP_FIRST_ACTIVE + PARTYSIZE_ACTIVE - 1'th slot. (So basically, for all monsters in the party, shift them to the previous slot). You can check out mev_pause_monsters_switch_confirm() for an example on how to swap two monsters' data.
  • Not sure what the "hit Z to go back shows the monster back in the party" bug is caused by, but it sounds like the party list isn't updated properly so it uses old data. Just to check if you've got the right object in the variable, you could try setting the object you think has the list's:
ggui_frame_l[0] += 32

after updating the monster list. This should make the menu jump a little bit to the right, allowing you to check if it's the right menu you've updated.

Also if you get the error message again, could you please copypaste it here?

(1 edit) (+1)

Made some progress. Everything seems to be working accept for the issue of hitting 'Z'. Made a video of what it's doing here: https://drive.google.com/file/d/14YL4eN2oUNu5DP-6giVcNU2JN-MR8qo_/view?usp=shari....

Also, here was the code I was using:

function mev_pause_monsters_release_confirm() {     with(instance_create_depth(x,y,depth-1,obj_gguimenu)){         daddy = other.id         message_spawn(tsprintf(                     "You released %.",                     amp_get_monster_name(other.my_monster)))          amp_clear_monster(other.my_monster)                  for(var c = AMP_FIRST_ACTIVE; c < AMP_FIRST_ACTIVE + PARTYSIZE_ACTIVE; c++){             if(global.active_monster_party[c,amp_MONID] == NONE){                 array_delete(global.active_monster_party,c,1)                 c-- //Deleting shifted everything back one step so re-check                 break;             }         }         msh_spawn_monster_list(mev_pause_monsters)                  instance_destroy(daddy)         instance_destroy(daddy.daddy)     } }

Okay, I figured it out. The problem is that you spawn a new menu and update that's list, but the original menu has an un-updated list (which is why the monster comes back when you cancel, because you destroy the new menu with the updated list and go back to the old menu)

Also good point re: array_delete, we can just delete the entire entry from the array to get around the whole mess with manually sorting it.

Try this code:

function mev_pause_monsters_release_confirm(){
        daddy = other.id
        message_spawn(tsprintf("You released %.",amp_get_monster_name(my_monster)))
        array_delete(global.active_monster_party,my_monster,1)
        array_insert(global.active_monster_party,AMP_FIRST_ACTIVE + PARTYSIZE_ACTIVE - 1,[])
        amp_clear_monster(AMP_FIRST_ACTIVE + PARTYSIZE_ACTIVE - 1)
        with(daddy.daddy){
            msh_spawn_monster_list(mev_pause_monsters)
        }
        instance_destroy(daddy)
        instance_destroy()
}

Unfortunately that doesn't seem to work either. I mean it works but the display is still not updating. Here is short video of what it did: https://drive.google.com/file/d/1yrzS_DidhAWInRyBDVVcpFdlcJOPQtHR/view?usp=shari...

(1 edit)

Could you please do the following?

In msh_spawn_monster_list, add a line:

show_debug_message("Spawn list:" + string(id))

In mev_pause_monsters_release_confirm, add some code after "amp_clear_monster":

show_debug_message("Update:" + string(daddy.daddy))
with(obj_gguimenu){
  show_debug_message(tsprintf("ID: %, %x%",id,menu_w,menu_h))
}

Then when releasing a monster, check the "Output" window and it'll print some messages with the ID data.

The IDs used for the "Spawn list" and "Update" printouts should be the same (I suspect you forget to set "daddy" accordingly in one of the menus when creating the child menu), and we print ALL the IDs (with menu size alongside it) just in case the results are still weird.

Here are the results:

Spawn list:100073
Update:100073
ID: 100075, 1x2
ID: 100074, 1x5
ID: 100073, 1x4
ID: 100072, 1x6

Also, figured I'd include the two scripts (release and release confirm). Here is first:

///mev_pause_monsters_release() function mev_pause_monsters_release() {     with(instance_create_depth(x,y,depth-1,obj_gguimenu)){         daddy       = other.id         my_monster    = other.my_monster         ggui_frame(other.ggui_frame_l[0] + 96,other.ggui_frame_t[0] + 48,128,64,spr_messagebox)         ggui_menu_preallocate(1,2)         ggui_element_text_settings(font_mainmsg,c_white,0,0)         ggui_menu_add_option_text(mev_pause_monsters_release_confirm, "Release", "")         ggui_menu_add_option_text(mev_cancel, "Cancel",    "")     }  }

and the second:

///mev_pause_monsters_release_confirm() function mev_pause_monsters_release_confirm() {     show_debug_message("Update:" + string(daddy.daddy))     with(obj_gguimenu){       show_debug_message(tsprintf("ID: %, %x%",id,menu_w,menu_h))     }         daddy = other.id         message_spawn(tsprintf("You released %.",amp_get_monster_name(my_monster)))         array_delete(global.active_monster_party,my_monster,1)         array_insert(global.active_monster_party,AMP_FIRST_ACTIVE + PARTYSIZE_ACTIVE - 1,[])         amp_clear_monster(AMP_FIRST_ACTIVE + PARTYSIZE_ACTIVE - 1)         with(daddy.daddy){             msh_spawn_monster_list(mev_pause_monsters)         }         instance_destroy(daddy)         instance_destroy()  }
(+1)

It looks like the ID is right in the printout, but we change it later (and then there's no second printout when we UPDATE daddy.daddy, so the reference is to something that doesn't exist?) so I think changing mev_pause_release_confirm like this should fix it:

///mev_pause_monsters_release_confirm() function mev_pause_monsters_release_confirm() {     var granddad = daddy.daddy;              message_spawn(tsprintf("You released %.",amp_get_monster_name(my_monster)))         array_delete(global.active_monster_party,my_monster,1)         array_insert(global.active_monster_party,AMP_FIRST_ACTIVE + PARTYSIZE_ACTIVE - 1,[])         amp_clear_monster(AMP_FIRST_ACTIVE + PARTYSIZE_ACTIVE - 1)         with(granddad){             msh_spawn_monster_list(mev_pause_monsters)         }         instance_destroy(daddy)         instance_destroy()  }
(+1)

It seems like that has fixed it. Thank you for all your help.