def next_monster
refresh
@monster_window.monster = @enemy_list[@enemy_index]
@monster_list_window.select(@enemy_index)
@command_window.activate
end
It's this part.
@enemy_index is not being used properly. I threw a
print @enemy_index in this to see what was going on.
Firstly, when you select a monster to view its in-depth bio, you should change @enemy_index to equal this monster's index.
Secondly, this
@monster_list_window.select(@enemy_index)
is the reason why you keep saying it doesn't go to the correct monster in the list (
but it actually does).
When I exit out of the monster's bio when @enemy_index = 5, it puts my cursor on the list to the SIXTH item in the list, which makes sense since arrays go 0,1,2,3,4,
5 (hence, sixth position). It's pretty unconventional when trying to work with two arrays going like this
a1 = [1,2,5,8,15]
a2 = [nil, 1, 2, nil, nil, 5, nil, nil, 8, nil, nil, nil, nil, nil, nil, 15]
EDIT:
Make these changes:
def next_monster
refresh
@monster_window.monster = @enemy_list[@enemy_index]
@monster_list_window.select($data_enemies.index(@enemy_list[@enemy_index])-1) ### Changed ###
@command_window.activate
end
def open_list
if !@monster.nil?
$game_system.se_play($data_system.decision_se)
@monster_list_window.deactivate.hide
@monster_info_window.hide; @controls.hide
@header.hide; @spirit_window.hide; @enemy_select.hide
@monster_window.show
@monster_window.monster = @monster
@enemy_index = @enemy_list.index(@monster) ### Added ###
@command_window.activate.show
else $game_system.se_play($data_system.buzzer_se)
end
end