Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(1 edit)

New question. Once I've selected a move and it brings up the menu for selecting a 'target to attack' from the menu, where can I grab the monster id of the proposed target (the one highlighted in the menu) as in, the monster the player is thinking of attacking before it's confirmed? 

I'm implementing a battle cursor so that it highlights the enemy visually but I can only find the initial creation of the menu listing all the targets, not what the current proposed target is going to be based on this menu. If I'm going about it the wrong way feel free to correct me.

(2 edits)

The script mev_battle_attack_select will build this menu (listing only the targets that are valid depending on the move), and it creates an array "my_target" in the menu instance, which the menu later uses to slate the action when you confirm. Each entry in this array is the instance ID of a battle monster object, so you could just copy it (after it's been completely built) to your cursor object and then get positions etc by going through the instance IDs.

Now, your main question is how to keep this in sync with what you're selecting in the menu. It's pretty simple: script_step. Menu objects will execute this script after their regular menu-handing behavior if it's not NONE. (There's a whole bunch of these customizable behavior scripts for more complicated menus - check parent_menu's create event - but most of the time we only change script_draw)

Make a script that tells the battle cursor what the currently highlighted item in the menu is, and in mev_battle_attack_select, set the script_step variable in the menu to this script. (Heck, you could forgo the array-in-cursor entirely and just tell it to focus on an instance ID by having the menu check the array... that's probably easier?)

Also, you could use this to make the cursor automatically get destroyed when the menu is closed: in its create event and in this script, set an alarm to 2 steps. When the alarm happens, instance_destroy(). As long as the target menu exists, it will keep resetting the alarm before it can trigger, but when it's destroyed (after you confirm the target or cancel out), the alarm will run out and also destroy the target cursor.

(1 edit)

Excellent thank you for the in depth reply, I'll have a look into what you've suggested. For my next question, is there an easy way to add the 'box' functionality into the main menu instead of accessing it from a specific place etc?

Yeah, I belive just adding the menu option to the main menu should do it.

Open up the script cc_terminal and copy the code from there, except the csc_proceed() line, and then just paste it into a new script "mev_pause_boxes", then go to obj_player's Step event to find the code where the pause menu is created when you press the pause button - add a new line here that adds that new mev_pause_boxes option.

(+1)

Awesome thanks I'll try it out, appreciate the quick and professional support especially considering the sheer volume of my questions, sorry about that 😅

No problem at all!