[XP][VX][VXA] Character Sprite Access

Started by LiTTleDRAgo, September 11, 2013, 09:32:36 pm

Previous topic - Next topic

LiTTleDRAgo

September 11, 2013, 09:32:36 pm Last Edit: September 11, 2013, 10:52:10 pm by LiTTleDRAgo
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


  • Look at Instruction




Screenshots




Script

Here


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


  • LiTTleDRAgo




Author's Notes

Enjoy ~

ForeverZer0

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
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

LiTTleDRAgo

September 12, 2013, 01:53:07 am #2 Last Edit: September 20, 2014, 12:07:30 pm by LiTTleDRAgo
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


ForeverZer0

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.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.