Get actor graphic and save it....

Started by jcsnider, July 25, 2008, 08:20:44 pm

Previous topic - Next topic

jcsnider

no i just get another error... and if it gets the error on .name wont it happen on .class... .hp and the rest?


the error I got this time is right when I start the game
Uninstlalized content Game_player::Player_text

here r my scripts....
http://www.sendspace.com/file/p2y16b

it is in the event text display script


thanks

Berans

July 28, 2008, 10:32:06 pm #21 Last Edit: July 28, 2008, 10:44:55 pm by Berans
I figured something like that would happen lol, always worth a try :P
I'll have a look into it and see if I can come up with something...
EDIT: wow...you have a lot of scripts lol
anyway, I don't think I know quite enough about scripting yet to really find the root of your problem, so I guess you'll have to wait till fantasist comes back, was definitely worth a look though...
seriously, lots of scripts :P

Fantasist

July 29, 2008, 09:58:39 am #22 Last Edit: July 29, 2008, 11:00:16 am by Fantasist
I'm downloading the script but are you absolutely positive that the error showed up after you changed what I said? It could be totally something else. I'll see what I can do anyway.
Quoteno i just get another error... and if it gets the error on .name wont it happen on .class... .hp and the rest?

But if .name was called first, RMXP stops evaluating any code after that and shows an error.

EDIT:

Okay. You need to add these lines to the script you posted in page 1 (the Game_Player stuff, Seph's event text script). Just after
class Game_Player < Game_Character


add these lines:

  # Player_Color: Constant used in refresh method
  Player_Color = Color.new(128, 128, 255)
 
  # Player_Name: Check the refresh method after the comment 'Determines Text'.
  #                      Change it here accordingly if needed.
  Player_Text = 'Name'


Basically, Player Text is not defined, or it does not have any valye when it's being used. You just need to define the constants.

If you get a syntax error in the same script (I got one), just comment out the very last "end".
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




jcsnider

Weird now i get tihs error...


Here is wat the txt display script looks like now...
#==============================================================================
# ** Game_Player
#==============================================================================

class Game_Player < Game_Character
  # Player_Color: Constant used in refresh method
  Player_Color = Color.new(128, 128, 255)
 
  # Player_Name: Check the refresh method after the comment 'Determines Text'.
  #                      Change it here accordingly if needed.
  Player_Text = 'Name'

  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_characterdisplay_gplayer_refresh refresh
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    # Original Refresh Method
    seph_characterdisplay_gplayer_refresh
    # Gets First Actor
    actor = $game_party.actors[0]
    # Determines Text
    case Player_Text
    when 'Name'
      txt = $game_party.actors[0].name
    when 'Class'
      txt = actor.class_name
    when 'Level'
      txt = "Level: #{actor.level}"
    when 'Hp'
      txt = "HP: #{actor.hp} / #{actor.maxhp}"
    when 'Sp'
      txt = "SP: #{actor.sp} / #{actor.maxsp}"
    else
      txt = ''
    end
    @text_display = [txt, Player_Color]
  end
end

#==============================================================================
# ** Sprite_Character
#==============================================================================

class Sprite_Character < RPG::Sprite
 
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_characterdisplay_scharacter_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Original update Method
    seph_characterdisplay_scharacter_update
    # Character Display Update Method
    update_display_text
   
    if $game_temp.new_guild
    @_g_display = nil if @_g_display != nil
    $game_temp.new_guild = false
    end
   
  end
  #--------------------------------------------------------------------------
  # * Create Display Sprite
  #--------------------------------------------------------------------------
  def create_display_sprite(args)
    # Creates Display Bitmap
    bitmap = Bitmap.new(160, 24)
    bitmap.font.size = 16
     
    # Draws Text Shadow
    if bitmap.font.respond_to?(:draw_shadow)
      bitmap.font.draw_shadow = false
    end
    # Changes Font Color
    bitmap.font.color = args[1]
    # Draws Text
    bitmap.draw_text(0, 0, 160, 24, args[0], 1)
    # Creates Display Text Sprite
    @_text_display = Sprite.new(self.viewport)
    @_text_display.bitmap = bitmap
    @_text_display.ox = 80
    @_text_display.oy = 24
    @_text_display.x = self.x
    @_text_display.y = self.y - self.oy / 2 - 24
    @_text_display.z = 30001
    @_text_display.visible = self.visible #true
  end
 
  def create_display_guild(args)
    # Creates Display Bitmap
    bitmap = Bitmap.new(160, 24)
    bitmap.font.size = 16
     
    # Draws Text Shadow
    if bitmap.font.respond_to?(:draw_shadow)
      bitmap.font.draw_shadow = false
    end
    # Changes Font Color
    bitmap.font.color = args[1]
    # Draws Text
    bitmap.draw_text(0, 0, 160, 24, args[0], 1)
    $old_guild = args[0]
    # Creates Display Text Sprite
    @_g_display = Sprite.new(self.viewport)
    @_g_display.bitmap = bitmap
    @_g_display.ox = 80
    @_g_display.oy = 24
    @_g_display.x = self.x
    @_g_display.y = self.y - self.oy / 2 - 24
    @_g_display.z = 30001
    @_g_display.visible = self.visible #true
  end
 
  #--------------------------------------------------------------------------
  # * Dispose Display Sprite
  #--------------------------------------------------------------------------
  def dispose_display_text
    unless @_text_display.nil?
      @_text_display.dispose
    end
  end
 
  #--------------------------------------------------------------------------
  # * Update Display Sprite
  #--------------------------------------------------------------------------
  def update_display_text
   unless @character.text_display.nil?
      if @_text_display.nil?
        create_display_sprite(@character.text_display)
      end
      @_text_display.x = self.x
      @_text_display.y = self.y - self.oy / 2 - 24
   else
      unless @_text_display.nil?
        dispose_display_text
      end
    end

   unless !@character.is_a?(Game_Player)
    if $old_guild != $game_temp.guild_name and @_g_display != nil
      @_g_display.dispose
      @_g_display = nil
      create_display_guild([$game_temp.guild_name,Color.new(0,128,255)])
    end
    if $game_temp.guild_name != ""
      if @_g_display.nil?
        create_display_guild([$game_temp.guild_name,Color.new(0,128,255)])
      end
      @_g_display.x = self.x
      @_g_display.y = self.y - self.oy / 2 - 35
    end
   else
      unless @_g_display.nil?
      @_g_display.dispose
      end
    end
  end
 
end

#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
#end




Line 134 is this
unless @character.text_display.nil?




THE ERRORS NEVER END!!!  :angry:

lol :D

Fantasist

July 31, 2008, 08:44:24 am #24 Last Edit: July 31, 2008, 08:51:55 am by Fantasist
I didn't get any error, did you change/add anything else? Because I've tested that code in the above post in the Scripts.rxdata file you gave me and I got no error... I guess this is beyond my power now (-_-)'

EDIT: Wait, when did you get this error? I'm guessing just after you go into a map (new game or load game). Did this error occur even before you tried my script?
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




jcsnider

Right after you choose your character and click on play when it sends u to the map it now gives me that error

Fantasist

Okay, i'm starting to get more and more confused. I don't know if that error occured even before you used my code, but here's one blind guess of mine. Remember this script:

class Game_Player
 
  attr_accessor :character_name, :character_hue
 
  def refresh
    @opacity, @blend_type = 255, 0
  end
 
end


The first line: class Game_Player

Change it to class Game_Player < Game_Character
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews