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.

Change Name / Graphic or Zoom Character Graphic XP VX

Change or Zoom Character Graphic XP VX
Version: 0.1.0
By Kyonides-Arkanthos alias Kyonides, Shadowball

Introduction

A collection of scriptlets!

Change any hero's graphic and keep it saved in a variable so he or she can go back to normal (script call based).

You can also change any character sprite's current zoom.

Screenshots

Do you really need one?

Demo

None needed.

Script

[rgss]<span style="color:#000080; font-style:italic;">=begin
<span style="color:#000080; font-style:italic;">  *  Change Name / Graphic or Zoom Character Graphic - XP VX
<span style="color:#000080; font-style:italic;">     by Kyonides-Arkanthos alias Kyonides, Shadowball
<span style="color:#000080; font-style:italic;">     03.07.2010
<span style="color:#000080; font-style:italic;">     
<span style="color:#000080; font-style:italic;">     Script Calls:
<span style="color:#000080; font-style:italic;">     
<span style="color:#000080; font-style:italic;">     $game_party.actors[0].change_graphic(2) # Aluxes is now Basil
<span style="color:#000080; font-style:italic;">     
<span style="color:#000080; font-style:italic;">     $game_party.actors[0].old_graphic # The same old (stupid) Aluxes
 
<span style="color:#000080; font-style:italic;">     $game_party.actors[0].old_name # Falls back to hero's old name if any
<span style="color:#000080; font-style:italic;">     
<span style="color:#000080; font-style:italic;">     $game_player.zoom_xy(2.0,2.0) # Player gets double sized...  Fat is bad!
<span style="color:#000080; font-style:italic;">     
<span style="color:#000080; font-style:italic;">     $game_map.events[1].zoom(1.5,1.5) # Event 1 is 50% bigger
<span style="color:#000080; font-style:italic;">=end
module DBASE
  ACTORS = load_data('Data/Actors.rxdata')
end
 
class Game_Actor
  def name=(name)
    @old_name = @name # It stores your hero's old name
    @name = name # Changes hero's name as always
  end
 
  def old_name
    return if @old_name.nil?
    @name = @old_name # Falls back to the old name
  end
 
  def change_graphic(graphic, value=0)
     if File.exist?('Data/Actors.rxdata')
       @old_graphic = [@character_name, @battler_name, value]
     else
       @old_graphic = [@character_name, @battler_name, @face_index]
     end
     # XP - Pass Character Graphic, Hue, Battler Graphic, Hue values
     # VX -Pass Character Graphic, Index, Face Graphic, Index values
     graphic = DBASE::ACTORS[graphic].character_name
     self.set_graphic(graphic, value, graphic, value) # Change graphic
     $game_player.refresh # Refresh player
  end
 
  def old_graphic
    return if @old_graphic.nil?
     # XP - Pass Character Graphic, Hue, Battler Graphic, Hue values
     # VX -Pass Character Graphic, Index, Face Graphic, Index values
     self.set_graphic(@old_graphic[0], @old_graphic[2],
       @old_graphic[1], @old_graphic[2])
     $game_player.refresh
  end
end
 
class Game_Character
  attr_reader :zooms
  alias kyon_gm_char_ini initialize
  def initialize
    @zooms = [1.0, 1.0]
    kyon_gm_char_ini
  end
 
  def zoom_xy(x,y); @zooms = [x, y]; end
  alias :zoom :zoom_xy
end
 
class Sprite_Character
  alias character_zoom_update update
  def update
    character_zoom_update
    if self.zoom_x != @character.zooms[0] or self.zoom_y != @character.zooms[1]
      self.zoom_x, self.zoom_y = @character.zooms
    end
  end
end
[/rgss]

Instructions

Script Calls

$game_party.actors[0].change_graphic(2) # Aluxes is now Basil
$game_party.actors[0].old_graphic # The same old (stupid) Aluxes
$game_party.actors[0].old_name # Falls back to hero's old name if any

FAQ

You tell me...

Compatibility

It should be compatible with anything that does not modify Game_Actor or Game_Character classes.

Credits and Thanks

Well, thanks to Falcao that gave me an idea of how to change a character's x and y zoom by looking at his script. I didn't like the way he dealt with it so I made my own scriptlet because of that.

Author's Notes

Nothing yet.

Terms and Conditions

Not intended for Commercial Use and must include my name (Kyonides-Arkanthos).
 
In spite of the fact I'll rant about a few things here and there in a few seconds, I think the ideas of saving your previous actor graphic and a short snippet for changing the scaling factor aren't too off at all and definately worth scripting. There are a few questions that are arising while reading through your post, though...

- why wouldn't you do the previous graphic storage as an update of the already built-in graphic change in Interpreter class, and only the old graphic call as a Call Script command?
- why isn't the scaling an independent script, so people who need the previous graphics only don't have to have this in their project, and vice versa?
- doesn't this more belong in here?

Other than that, you have a inconsistent coding style, which you might wanna work on considering I can tell that in a sub-100-lines script (then again, I'm picky on that...). For example, you have your commenting sometimes above, sometimes in the same line, and even below (!) the commented code.

Also, your terms and conditions are rather disencouraging. First, you ask to include your name, while providing four different nicknames in here - kyonides, Kyonides-Arkanthos, Kyonides and Shadowball. That equals to a Burger King clerk, telling you you get the cap for your drink if you solve a mathematical question... aka is totally consumer-unfriendly (and no, that never happened to me ;) ).
The URL part is completely mysterious to me. At first, I thought you want people to include this threads URL in their game (which would be completely pointless... have you ever seen a commercial game spamming you with the webpage adress of it's engine components?), which I ruled out for the reasons in brackets, as well as because you wrote "if theres any URL at all" (are there occasions where you can get this script without actually browsing for it on the internets? If so, what would keep me from just not including the URL?). I can't possibly imagine any other URL you'd want people to include though, so you might wanna work on that part a bit.
Sorry I'm bragging mostly about that, but if you want people to take your conditions seriously, make sure they aren't skyhigh.
 
- why wouldn't you do the previous graphic storage as an update of the already built-in graphic change in Interpreter class, and only the old graphic call as a Call Script command?
Actually I've been thinking about that, but didn't do it, yet, because I'm busy with my gosu project.

Well, this kind of snippet was there at first, but I posted it just in case someone needed that for some reason. The main purpose of this post was to include all my snippets in a single post... but yeah, I can divide the original post in two parts to achieve the same goal in a more liberal fashion.

I do have a website... but it looks terrible and I should definitely revamp it... if I get some free time to do it... Anyway, I deleted that part of the end notes and make sure it let the reader know which name they should use in order to comply with my single condition.
 

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