Get actor graphic and save it....

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

Previous topic - Next topic

jcsnider

With a character maker or w/e it changes the players graphic just like it would if u Set Move route Player change graphic... but when you add a different acotr is changes to that graphic... is there a script or something that it gets the same of your actors graphic and never lets it change?

Thanks

Fantasist

You can do it, but I'm just curious... why do you need it? There might be a better way.
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




Blizzard

He's making a pokemon game where the player sprite needs to be independent from actor sprites.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

jcsnider

Maybe even change it a little it might be able to do something like this... In a common event at the start of hte game run a conditional branch that does like a script...
If actor.character.graphic = ""
Controll switches "100" = On
Else

End
Would that be posssible?

Fantasist

QuoteWould that be posssible?

I don't get what you're saying there, but I'll try this out :)
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

July 26, 2008, 10:17:28 am #5 Last Edit: July 26, 2008, 10:34:19 am by Blizzard
maybe this will clear it up some...
Spoiler: ShowHide


SO it finds out what the current character graphic is and if it is a certant one it turns a switch on...

Does this clear it up some?

by Blizzard: Use spoilers for images. -_-

Fantasist

It clears up everything but the point of it, but that's none of my concern, but here's the code needed to check the player's graphic:
$game_party.actors[0].character_name


Use it like this in a conditional branch:
$game_party.actors[0].character_name = '001Fighter01'


If it doesn't work, try adding the fle extension to the filename (like "001Fighter01.png").
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




Blizzard

Wrong, this would be the first actor again. You have to use "$game_player" instead of "$game_party.actors[0]". And the extension must be omitted.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

jcsnider

now i have an undefined method for character_name im testing this in a nomral project not the neptlay right now.

Blizzard

You need to add this extra script first:

class Game_Character
  attr_accessor :character_name
end
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

jcsnider

what that is doing is just changing my char sprite to that sprite... I need it so it finds out what sprite I have and then do something if it is and something else if it isnt... Like...

If it IS 001-Fighter01.png then Controll switch 1 to on

else controll switch 2 ot on or something like that...

Fantasist

July 26, 2008, 10:56:17 am #11 Last Edit: July 27, 2008, 01:24:31 am by Fantasist
Old confusing post: ShowHide
Yeah, realized that, I was looking through the code just now. The Game_Player#refresh needs to be modded too. I considered the following code:

FIX_MAP_GRAPHIC_SWITCH = 12 #####

class Game_Character
 attr_accessor :character_name, :character_hue
end

class Game_Player
 
 alias fts_jcsnider_fix_map_graphic_refresh refresh
 def refresh
   if $game_switches[FIX_MAP_GRAPHIC_SWITCH] #####
     @opacity, @blend_type = 255, 0
   else     #####
     fts_jcsnider_fix_map_graphic_refresh #####
   end #####
 end
 
end


But I get an "Undefined local var or method 'refresh' for Game_Player:class" :?


Here you go:


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


There's a good chance the player might be invisible at the beginning of the game, so set the graphic when the game starts.

You can't use the 'Change Graphic' event command anymore on the player. You can use it to change your pokemons' graphics, though. For changing the player's graphic, use this code in a call script command:

$game_player.character_name = '001-Fighter01'
$game_player.character_hue = 0 (a number b/w 0 and 360, both included)


You won't need to change the hue if I'm right, since you'll be using a customized graphic anyway.

For checking the name of the graphic, use this in a Conditional Branch:
$game_player.character_name == '001-Fighter01'


Don't forget to use the double '=' when checking for the graphic.
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

Yes in a normal project it works... but when I tried it in my netplay project... I can't call the change player graphic without knowing what the players graphic is... that is why I wanted this script.... before you are even to the first map you go through a char select which changes your graphic to what you choose then you go right into the game. But when you do the sprite is now invisable so it dosn't lemme call the script to figure out what the actors sprite is... Is there anyway to make it so it dosnt become an invisable sprite?

Fantasist

July 27, 2008, 09:03:17 am #13 Last Edit: July 28, 2008, 06:53:43 am by Fantasist
Okay, you just need to edit the character select script. Can you post/PM it?

EDIT:

Oh boy! Netplay has totally bizzare stuff and I have no idea what's going on (not that I really tried). I can only guess how to make it work, because I can't test it. So here's what you try:

In the Scripts.rxdata you gave me, find the script slot named: "[SC] Scene_Character". Find "$game_player.refresh" (should be somewhere near line 225) and add these lines:

$game_player.character_name = @character
$game_player.character_hue = @hue


Remember this change, just in case. (just add a comment to the right so you can find it).
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

I sent a link to you... did you receive it?

Fantasist

If you mean your scripts file, I did, and my last post is edited, check it out. I think it should work.
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

ok now it seems to work but when you try to add a character you get an error in this script

#==============================================================================
# ** Game_Player
#==============================================================================

class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * 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


on the line  when 'Name'
      txt = $game_party.actors[0].name


undefined method name... it happens when you try to add a char to the party...


It also changes the char's name when the char is added... is there a way so when u choose ur char before you enter the game it shows the name of your character and not the first actor in the party.. so really I want it so while ur in the game and in the menu it shows the actors name and when u are choosing ur char it shows the name you choose in the first place? If you need my scripts I cna send them to anyone that cna help.

Berans

with that error, does it happen to say something like "for nil:Nilclass" after what you said?


Berans

Figures lol, I've had to deal with a lot of those in my own scripts....errr....lets see. It means that at some point $game_party.actors[0] is called before the actors are loaded...you can try changing the line to
when Name
  unless $game_party.actors[0] == nil
    txt = $game_party.actors[0].name
  end


but since I didn't write the script I don't know what that exactly will do apart from stopping the error from ocurring :P
maybe you can send me the script, I'll see if I can find out.