Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: LiTTleDRAgo on September 11, 2013, 09:32:36 pm

Title: [XP][VX][VXA] Character Sprite Access
Post by: LiTTleDRAgo on September 11, 2013, 09:32:36 pm
Character Sprite Access
Authors: LiTTleDRAgo
Version: 1.01
Type: Graphical Add-on
Key Term: Misc Add-on



Introduction

This script can make you have a full access to character sprite in map


Features




Screenshots

(http://2.bp.blogspot.com/-9mCEbbfoIFE/UjC0N_K8gII/AAAAAAAAAUw/I11TeIgZ9uM/s1600/character_sprite_access.png)


Script

Here (http://littledrago.blogspot.com/2013/09/rgss23-character-sprite-access.html)


Instructions

Spoiler: ShowHide
To change character sprite with other image
(XP uses RPG::Cache while VX and VX-A uses Cache)

$game_map.events[1].bitmap = RPG::Cache.battler('001-Fighter01')
$game_map.events[2].bitmap = RPG::Cache.icon('001-Potion01')

$game_map.events[3].bitmap = Cache.system('Iconset')
$game_map.events[3].bitmap.src_rect.set(24,0,24,24)


To add an effect to character sprite

$game_map.events[1].bitmap.invert! 
$game_map.events[1].bitmap.frost!
$game_map.events[1].bitmap.clear


You can use all kind of methods in Bitmap class

To reset bitmap back to normal

$game_map.events[1].bitmap.reset_bitmap





Compatibility

Will cause trouble with something that alters Sprite_Character
Will cause trouble with ABSEAL


Credits and Thanks




Author's Notes

Enjoy ~
Title: Re: [XP][VX][VXA] Character Sprite Access
Post by: ForeverZer0 on September 11, 2013, 11:02:18 pm
I always hated how RMXP designed the scripts to make it so hard to access the sprites/bitmaps of the characters on the screen, it seems like such a commonsense thing.

The script seems a little overly complicated to me, though. Something like this has the same effect and does not have any other script dependencies.

Spoiler: ShowHide
class Game_Character
 
  def bitmap
    return if !$scene.is_a?(Scene_Map)
    char = $scene.spriteset.character_sprites.find {|c| c.character == self }
    if char != nil
      return char.bitmap
    end
  end
 
  def bitmap=(arg)
    return if !$scene.is_a?(Scene_Map)
    char = $scene.spriteset.character_sprites.find {|c| c.character == self }
    char.bitmap = arg
  end
end

class Scene_Map
  attr_accessor :spriteset
end


class Spriteset_Map
  attr_accessor :character_sprites
end
Title: Re: [XP][VX][VXA] Character Sprite Access
Post by: LiTTleDRAgo on September 12, 2013, 01:53:07 am
If I'm doing it like that, character who shared the same graphic will also be affected

$game_player.character_name = '001-Fighter01'
$game_map.events[1].character_name = '001-Fighter01'


$game_player.bitmap.invert!


with your script, $game_map.events[1] bitmap would also inverted, and when changing scene, the changed graphics would reset back to normal

Title: Re: [XP][VX][VXA] Character Sprite Access
Post by: ForeverZer0 on September 12, 2013, 06:31:59 am
Oh, yes, I see what you are saying, forgive me, I didn't pay too close attention.  I was under the impression it was simply making the sprite accessible, and didn't think it all through.