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

How do you make it so only the monsters that entered the battle will get exp?

How do you make in battle the move you used next time you are on the same move? So that when next turn can just press x twice in a row to do the same move again?

(+1)

Both of these will need you to track some additional data, I think two global arrays with AMP_PARTYSIZE_ACTIVE slots will be enough: global.party_was_in_battle and global.party_last_move_selected.

  • In obj_battlecontrol's create event, fill these both with 0's in all slots.
  • For only earning EXP in battle:
    • In obj_battlecontrol's step event bcontrolstate_WIN_STEP section, change "if(amp_has_monster(exp_monster)){" to "if(amp_has_monster(exp_monster) && global.party_was_in_battle[exp_monster]){"
    • In obj_battlemonster's step event after the "//Monster's been seen in battle! Add to list." comment, add "if(amp_id < AMP_PARTYSIZE_ACTIVE){global.party_was_in_battle[amp_id] = true;}"
  • For remembering the last move selected:
    • In mev_battle_attack_select, right at the top add "global.party_last_move_selected[obj_battlecontrol.action_monster.amp_id] = menuvalue_x + 2*menuvalue_y"
    • In mev_battle_attack, at the end of the "if(validmoves > 0)" block somewhere, append a switch state like
if(obj_battlecontrol.action_monster.amp_id < AMP_PARTYSIZE_ACTIVE){
switch(global.party_last_move_selected[obj_battlecontrol.action_monster.amp_id]){
  case 0:
    menuvalue_x = 0
    menuvalue_y = 0
  break;
  case 1:
    menuvalue_x = 1
    menuvalue_y = 0
  break
  case 2:
    menuvalue_x = 0
    menuvalue_y = 1
  break
  case 3:
    menuvalue_x = 1
    menuvalue_y = 1
  break
}
}
(1 edit)

Thanks! I got the move to remember which one it uses. I almost got the part with exp. I just it to only give exp to each individual monster based on which one they went against. How do you get for the ID of the opposing monster? So like if it's the first monster they sent out or the second.  

if amp_id == 412 {
for (var i = 0; i < array_length(global.exp_to_grant_in_battle_to_each_monster); ++i) {
if global.party_was_in_battle7[i] == true {
global.exp_to_grant_in_battle_to_each_monster[i] += ceil(exploot);}}}

Code I think will work to check which ones where in the active at the right time:


if opposingMonsterID == 0 {
global.party_was_in_battle1[amp_id]
}
if opposingMonsterID == 1 {
global.party_was_in_battle2[amp_id]
}
if opposingMonsterID == 2 {
global.party_was_in_battle3[amp_id]
}
if opposingMonsterID == 3 {
global.party_was_in_battle4[amp_id]
}
if opposingMonsterID == 4 {
global.party_was_in_battle5[amp_id]
}
if opposingMonsterID == 5 {
global.party_was_in_battle6[amp_id]
}


How would I get the player monster level and the opposing monster level in obj_battlemonster: Step? Something like this? 

global.active_monster_party[amp_id,amp_LEVEL]
global.active_monster_party[0,amp_LEVEL]
(2 edits)

The enemy amp_id's start at AMP_FIRST_ENEMY and then go upwards from there, until they end at AMP_FIRST_ENEMY+PARTYSIZE_MAX_ENEMY.

So the first monster that was sent out is in global.active_monster_party[AMP_FIRST_ENEMY], the second is in global.active_monster_party[AMP_FIRST_ENEMY+c], and so on.

(IDs that don't have a monster in them has an amp_MONID of NONE, otherwise amp_MONID contains the monster ID and amp_LEVEL the level)

(PARTYSIZE_MAX_ENEMY is 12 by default but if you use the constant to figure out how long arrays you need it should work out regardless)

Thanks! I got the exp for only the monster who was in the battle working. 

Bug: When using a item like a potion on the overworld, if you use it on a monster and hold right or left it will scroll the items 30 times a second(You can hear it scroll like crazy). 

How would I make when I use a item on the overworld the screen would stay on the monster select thing instead of closing that and going to the items menu?

The script that applies the selected item is mev_pause_items_use_actually_use, in that you'd want to remove this code at the end which destroys the current menu and the preceding one (the "use/throw away/hold" menu):

instance_destroy(daddy)
instance_destroy()

I don't see the buggy behavior in the engine source file (ggui_menu_handle also has a check that only runs the left/right handler if you've allocated a menu that's 2 at least slots wide so it shouldn't even attempt to move the cursor in the monster menu which is fully vertical) so it might be something you've changed?

(+1)

Tried the original and you will only hear the sound of the scrolling left or right. To do go on item, then use, with the monster you use it on make sure to be holder left or right and and at too. The sound will stop if you let go of left or right.

OK, I can see it now... seems to be a lot of weird things going on, a dialogue box gets created below the other menu and that's what's responding to the button presses (or rather it also affects the inventory menu so there's two active menus at once?)

Okay, I figured it out! The problem is the order mev_pause_items_use_actually_use does things (looks like something has changed in how Game Maker processes the Create event so the dialogue box taking top priority doesn't work now), rearranging it so we destroy the daddy menus before we spawn the dialogue box fixes the glitch:

(for this to work we need to get a reference to daddy.daddy first before we destroy this menu and its parent, otherwise we can't refer to it later - this is what new variable dd is for)