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

script Spoiler
  1. =begin
  2.   *  Change Name / Graphic or Zoom Character Graphic - XP VX
  3.      by Kyonides-Arkanthos alias Kyonides, Shadowball
  4.      03.07.2010
  5.      
  6.      Script Calls:
  7.      
  8.      $game_party.actors[0].change_graphic(2) # Aluxes is now Basil
  9.      
  10.      $game_party.actors[0].old_graphic # The same old (stupid) Aluxes
  11.  
  12.      $game_party.actors[0].old_name # Falls back to hero's old name if any
  13.      
  14.      $game_player.zoom_xy(2.0,2.0) # Player gets double sized...  Fat is bad!
  15.      
  16.      $game_map.events[1].zoom(1.5,1.5) # Event 1 is 50% bigger
  17. =end
  18. module DBASE
  19.   ACTORS = load_data('Data/Actors.rxdata')
  20. end
  21.  
  22. class Game_Actor
  23.   def name=(name)
  24.     @old_name = @name # It stores your hero's old name
  25.     @name = name # Changes hero's name as always
  26.   end
  27.  
  28.   def old_name
  29.     return if @old_name.nil?
  30.     @name = @old_name # Falls back to the old name
  31.   end
  32.  
  33.   def change_graphic(graphic, value=0)
  34.      if File.exist?('Data/Actors.rxdata')
  35.        @old_graphic = [@character_name, @battler_name, value]
  36.      else
  37.        @old_graphic = [@character_name, @battler_name, @face_index]
  38.      end
  39.      # XP - Pass Character Graphic, Hue, Battler Graphic, Hue values
  40.      # VX -Pass Character Graphic, Index, Face Graphic, Index values
  41.      graphic = DBASE::ACTORS[graphic].character_name
  42.      self.set_graphic(graphic, value, graphic, value) # Change graphic
  43.      $game_player.refresh # Refresh player
  44.   end
  45.  
  46.   def old_graphic
  47.     return if @old_graphic.nil?
  48.      # XP - Pass Character Graphic, Hue, Battler Graphic, Hue values
  49.      # VX -Pass Character Graphic, Index, Face Graphic, Index values
  50.      self.set_graphic(@old_graphic[0], @old_graphic[2],
  51.        @old_graphic[1], @old_graphic[2])
  52.      $game_player.refresh
  53.   end
  54. end
  55.  
  56. class Game_Character
  57.   attr_reader :zooms
  58.   alias kyon_gm_char_ini initialize
  59.   def initialize
  60.     @zooms = [1.0, 1.0]
  61.     kyon_gm_char_ini
  62.   end
  63.  
  64.   def zoom_xy(x,y); @zooms = [x, y]; end
  65.   alias :zoom :zoom_xy
  66. end
  67.  
  68. class Sprite_Character
  69.   alias character_zoom_update update
  70.   def update
  71.     character_zoom_update
  72.     if self.zoom_x != @character.zooms[0] or self.zoom_y != @character.zooms[1]
  73.       self.zoom_x, self.zoom_y = @character.zooms
  74.     end
  75.   end
  76. end
Expand to see the code.


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.
Quote:
- 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.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=70156