Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Problem with CMS draw_actor_portrait [Partially Resolved]

EDIT: I figured out what was going wrong... well kinda. It seems the problem was, I added my actors in an event using a script command instead of the normal event command to add actors to party.

Code:
$game_party.add_actor(1)
$game_party.add_actor(2)
$game_party.add_actor(3)
$game_party.add_actor(4)

But it does lead to another question that is bothering me (because I still don't know why it did it when I added them via script command and not change party command.)

Does anybody have any idea why it wacked out like that when I added actors via call script? I only need to know for future reference when I start making the CMS Scene_Party.


I'm having a problem with my CMS drawing actor portraits. I didn't have this problem before tonight, because it was working fine earlier, but now for some reason it doesn't want to draw actor's face graphics. The method searches for the face via constant defined at the top of the script, and works with 1 actor but doesn't work when theres more than 1 actor to be shown (on Scene_Menu, works fine in Scene_Item) The code in question is this one (added to Window_Base).

http://i224.photobucket.com/albums/dd28 ... 1-face.png[/img]

Code:
def draw_actor_portrait(actor, x, y, width = 96, height = 96)
    # Determine CMS Portrait : String
    @type = CMS_Portrait_Type
    if @type == 'name' 
      @type = 0 
    elsif @type == 'character' 
      @type = 1
    elsif @type == 'battler'
      @type = 2
    end
    # Determine CMS Portrait : numeral
    case @type
    # 0: Search by Name
    when 0
      @portrait = actor.name
    # 1: Search by Character Graphic
    when 1
      @portrait = actor.character_name 
    # 2: Search by Battler Graphic
    when 2
      @portrait = actor.battler_name
    # Else: Reset type to '0: Name'
    else
      @type = 0
    end
    # Determine CMS Portrait Extention
    @ext = CMS_Portrait_Ext
    if @ext != nil
      # Search for ext + filename based off type
      bitmap = RPG::Cache.picture(@portrait + @ext)
    else
      # Search for filename based off actor name
      bitmap = RPG::Cache.picture(@portrait)
    end
    # Fix if face file doesn't exist
    if FileTest.exist?(bitmap.to_s) != false
      fix_face
      return
    end
    # Create Cursor Rect
    src_rect = Rect.new(0, 0, width, height)
    self.contents.blt(x, y, bitmap, src_rect)
  end
  #---------------------------
  # * Fix Face (Rescue Method)
  #---------------------------
  def fix_face
    bitmap = RPG::Cache.picture("")
  end
end

It seems any time I want to call anything, such as actor.name, actor.character_name, etc, the error pops. I don't get why, everything worked fine when I went to work.

I even have it defined in the Window(s) that calls the actor, 'actor = $game_party.actors[ i ]' is written before the 'draw_actor_portrait(actor, x, y)' so I don't know what else is wrong (no, theres no space between the 'i' and the brackets, I just wrote it that way so the forum doesn't think I'm trying to do italics).

Anybody have an idea what I'm doing wrong?
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top