[RMVXA][RESOLVED] selecting actor issue

Started by bigace, May 08, 2013, 01:17:04 am

Previous topic - Next topic

bigace

May 08, 2013, 01:17:04 am Last Edit: May 08, 2013, 02:23:22 am by bigace
Okay the issue I"m having that's been bothering me the whole day that I can't figure out in rmvxace is selecting an actor. What I was doing was when you select an actor from the list in Window_MenuStatus, the game should take you to that selected actors skill window, however, it doesn't do that and it only shows the first actors information. Originally VXAce menu selects the actor from Window_MenuStatus and then sends you straight to a new scene where it gives you the selected actors info.

Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window_Party
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window_Party < Window_Selectable
def initialize(help_window)
   @help_window = help_window
   dy = @help_window.height
super(0, dy, Graphics.width, Graphics.height - dy)
select(0)
activate
refresh
end
def item_max
   return @data ? @data.size : 1
 end
def item
   return @data && index >= 0 ? @data[index] : nil
 end
 def item_rect(index)
   rect = Rect.new
   rect.width = item_width
   rect.height = item_height
   rect.x = index % col_max * (item_width + spacing)
   rect.y = item_height + (index / col_max * item_height)
   rect
 end
def refresh
make_item_list
create_contents
   draw_header
draw_all_items
end
 def draw_header
   reset_font_settings
   change_color(system_color)
   rect = Rect.new(24, 0, contents.width, line_height)
   draw_text(rect, 'Name')
   rect.x += 156
   draw_text(rect, 'HP')
   rect.x += 180
   draw_text(rect, 'MP')
 end
def make_item_list
@data = []
   $game_party.all_members.each {|member| @data << member.id if !member.nil?}
 end
def draw_item(index)
   return if @data[index] == 0
rect = item_rect(index)
actor = $game_actors[@data[index]]
draw_actor(actor, rect)
end
def draw_actor(actor, rect)
   change_color(normal_color)
draw_text(rect.x+24, rect.y, contents.width, line_height, actor.name)
   draw_actor_hp(actor, rect.x + 180, rect.y)
   draw_actor_mp(actor, rect.x + 360, rect.y)  
end
 def select_last
   select(@data.index($game_party.menu_actor.index) || 0)
 end
 def show
   @help_window.show
   super
 end
 def hide
   select_last
   @help_window.hide
   super
 end
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Scene_Status
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Scene_Status < Scene_MenuBase
 def start
   super
   create_help_window
   create_party_window
   create_status_window
   refresh_help_window
 end
 def create_help_window
   @help_window = Window_Help.new(1)
   @help_window.viewport = @viewport
 end
 def create_party_window
   @party_window = Window_Party.new(@help_window)
   @party_window.set_handler(:ok,     method(:select_actor))
   @party_window.set_handler(:cancel, method(:return_scene))
 end
 def user
   @party_window.item
 end
 def select_actor
   @party_window.hide.deactivate
   @status_window.show.activate
 end
 def create_status_window
   @status_window = Window_Status.new(@actor)
   @status_window.set_handler(:cancel,   method(:on_status_cancel))
   @status_window.set_handler(:pagedown, method(:next_actor))
   @status_window.set_handler(:pageup,   method(:prev_actor))  
   @status_window.deactivate.hide
 end
 def on_status_cancel
   @party_window.show.activate.select(0)
   @status_window.hide.deactivate
 end
 def on_actor_change
   @status_window.actor = @actor
   @status_window.activate
 end
 def refresh_help_window
   @help_window.contents.clear
   @help_window.draw_text_ex(4, 0, "Whose status will you view?")
 end
end



I just want to know what I'm missing as I need to do this in three other scenes in the menu script for my game.


Use Dropbox to upload your files. Much simpler than other upload sites, you can simply place a folder on your desktop that will sync with your DropBox account.

KK20

  def select_actor
    $game_party.menu_actor = $game_actors[@party_window.item] #<= So when pressing L and R, it will go to the appropriate actor
    @status_window.actor = $game_actors[@party_window.item] #<= Draws the status for the selected actor
    @party_window.hide.deactivate
    @status_window.show.activate
  end

This is what I got after messing around with the code a bit. Kinda funny how I don't use VXA at all nor have I studied how the classes work, yet the problem was clearly obvious to me. :uhm:

But I will agree that VXA makes things stupid complicated compared to XP.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

bigace

Thank you for the help again 8) :facepalm:
I had this at one point:
$game_party.menu_actor = $game_actors[@party_window.item]


but it wasn't working, because I didn't think of the second part:
@status_window.actor = $game_actors[@party_window.item]

:facepalm:.


Use Dropbox to upload your files. Much simpler than other upload sites, you can simply place a folder on your desktop that will sync with your DropBox account.