[RMVX ACE] BUG WITH YANFLY'S ACE MENU ENGINE

Posts

Pages: 1
So I was trying to use yanfly's script for showing only 3 characters at a time in the menu, it's just what I was looking for, but when I put it on my game...



It shows only the MP and not the HP (and it shows the wrong amount, but that's caused by another script)

So I thought that maybe it was caused by another script, so I tried it with a empty project and...



It looks worse

Is there any solution for this? Or at least there are other alternatives that let me change the party size / show 3 characters at a time in the menu?
Marrend
Guardian of the Description Thread
21781
I put in...

class Window_MenuStatus < Window_Selectable
  def item_max
    #$game_party.members.size
    # You can make the above equal to three, but, for now...
    3
    # ...we FORCE IIIIIIT!
  end

  def draw_item(index)
    actor = $game_party.members[index]
    enabled = $game_party.battle_members.include?(actor)
    rect = item_rect(index)
    draw_item_background(index)
    #draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)
    draw_actor_face(actor, rect.x + 1, rect.y + line_height + (index*line_height), enabled)
    #draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
    draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height + (index*line_height))
  end
end

...this into an empty/new code-space, and with three people in the party as a reference. The spacing doesn't seem too terrible to me?
author=Marrend
I put in...

CODE

...this into an empty/new code-space, and with three people in the party as a reference. The spacing doesn't seem too terrible to me?

Thanks! But I tried it and...

Script "Window_Base" line 435: NoMethodError ocurred.
undefined method "face_name" for nil:NilClass

Sorry, I know nothing about scripting
Marrend
Guardian of the Description Thread
21781
Okay, from what I gather, the error message is being generated from within...

def draw_actor_face(actor, x, y, enabled = true)
  draw_face(actor.face_name, actor.face_index, x, y, enabled)
end

...this function of Window_Base. Now, the cross-reference would be...

actor = $game_party.members[index]
draw_actor_face(actor, rect.x + 1, rect.y + line_height + (index*line_height), enabled)

...these statements within the Window_MenuStatus.draw_item function as above. The "actor" variable is being passed into the Window_Base.draw_face function, and replaces any instance of the "actor" variable in Window_Base. So, logically, if "actor" in the context of Window_Base.draw_face is an instance of the Nil class (ie: is empty) then, "actor" in the context of Window_MenuStatus.draw_item should as well. Off-hand, the only values where "actor" would be nil in the context of Window_MenuStatus.draw_item is if a value greater than the party's size was passed into "index" in the statement $game_party.members[index]?

*Edit: It is technically possible for players to have more party members that then the "$game_party.max_battle_members" function indicates. However, as one can guess, only that many are active participants in battle.


*Edit2: I guess the override of the item_max function was completely unnecessary.
Uh... what? Sorry, I don't understand too much of this, are you saying that I have more than 3 characters in the party? (I only have one, the one from the empty project) Or that I should change some variables? Sorry
Marrend
Guardian of the Description Thread
21781
First, I apologize for being too technical. Second, there are a few methods you can use to figure out what's going on. The one I commonly use is to print a system-message-box with the variables I want to know about. So, in your case, it might look something like...

class Window_MenuStatus < Window_Selectable
  def draw_item(index)
    msgbox(index)
    actor = $game_party.members[index]
    msgbox(actor)
    enabled = $game_party.battle_members.include?(actor)
    rect = item_rect(index)
    draw_item_background(index)
    #draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)
    draw_actor_face(actor, rect.x + 1, rect.y + line_height + (index*line_height), enabled)
    #draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
    draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height + (index*line_height))
  end
end


...this. In this example, when accessing the menu, a message will pop up with whatever value is passed into "index" as a point of general information. You'll also see another message popping up after "actor" is defined box that tells you what it's value is. The type of value that should go through without too many complications should mention something about "Game_Actor" in some way.

The ultimate idea of this exercise is to see what values of "index" make "actor" nil. If "actor" is never nil, and you still get that error, that... that might be interesting!
0
#Game_Actor:0x76d0540


I tested with and without the yanfly script and it showed the same message, I tried changing the amount of actors in the party and it showed a 0, 1, or 2 before the #Game_Actor, I guess it's referencing each actor in the party
Marrend
Guardian of the Description Thread
21781
Referencing each party member is what we want to do. However, if it still gives you the error message regarding "face_name" not being a member of nil::NilClass, then, in theory, the message box should print "nil" before then. If it does not, and you're still getting that error, something really weird is going on!
Pages: 1