Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Closed TopicStart new topic
> [RGSS2/3]MSX - XP Characters on VX/VXAce
Melosx
post Jan 1 2012, 06:35 AM
Post #1


Level 1
Group Icon

Group: Member
Posts: 9
Type: Scripter
RM Skill: Intermediate




MSX - XP Characters on VX/VXAce

Version: 1.0
Author: Melosx

Introduction
You can use XP characters whit VX and VXAce. Rename the image by adding $xp at the beginning of the name.
Example: 001-Fighter01.png -> $xp001-Fighter01.png

p.s.: sorry for my bad english sad.gif

Script
Script
CODE
#==========================================================================
# ** MSX - XP Characters in VX/VXAce
#==========================================================================
# Author: Melosx
# English Translation: TheBen
# Version: 1.0
# Compatable with VX and VXAce
#==========================================================================
#  *Description
# --------------------------------------------
# The script permits the use of XP sprites in VX.  All you have to do is insert the tag
#  "$xp" at the start of the filename.
# You can then use the VX-style sprites right alongside the ones of RPGXP.
#
#==========================================================================
# *Instructions
# --------------------------------------------------------------------------
# Insert the script below Materials and above Main.  Add the tag "$xp" (no quotes)
# to the beginning of the filename of XP sprites you want to use.
#
#==========================================================================


#==========================================================================
# ** Sprite_Character
#==========================================================================
class Sprite_Character < Sprite_Base

  def update_bitmap
    if @tile_id != @character.tile_id or
      @character_name != @character.character_name or
      @character_index != @character.character_index
      @tile_id = @character.tile_id
      @character_name = @character.character_name
      @character_index = @character.character_index
      if @tile_id > 0
        sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32;
        sy = @tile_id % 256 / 8 % 16 * 32;
        self.bitmap = tileset_bitmap(@tile_id)
        self.src_rect.set(sx, sy, 32, 32)
        self.ox = 16
        self.oy = 32
      else
        self.bitmap = Cache.character(@character_name)
        sign = @character_name[/^[!$]./]
        if sign != nil and sign.include?('$')
          @cw = bitmap.width / 3
          @ch = bitmap.height / 4
        else
          @cw = bitmap.width / 12
          @ch = bitmap.height / 8
        end
        if @character_name != nil and @character_name.include?('$xp')
          @cw = bitmap.width / 4
          @ch = bitmap.height / 4
        end
        self.ox = @cw / 2
        self.oy = @ch
      end
    end
  end
        
  def update_src_rect
    if @character_name != nil and @character_name.include?('$xp')
      if @tile_id == 0
        pattern = @character.pattern > 0 ? @character.pattern - 1 : 3
        sx = pattern * @cw
        sy = (@character.direction - 2) / 2 * @ch
        self.src_rect.set(sx, sy, @cw, @ch)
      end
    else
      if @tile_id == 0
        index = @character.character_index
        pattern = @character.pattern < 3 ? @character.pattern : 1
        sx = (index % 4 * 3 + pattern) * @cw
        sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
        self.src_rect.set(sx, sy, @cw, @ch)
      end
    end
  end
end


#==========================================================================
# ** Window_Base
#==========================================================================

class Window_Base < Window

  def draw_character(character_name, character_index, x, y)
    return if character_name == nil
    bitmap = Cache.character(character_name)
    sign = character_name[/^[!$]./]
    if character_name != nil and character_name.include?('$xp')
      cw = bitmap.width / 4
      ch = bitmap.height / 4
      n = character_index
      src_rect = Rect.new(0, 0, cw, ch)
    else
      if sign != nil and sign.include?('$')
        cw = bitmap.width / 3
        ch = bitmap.height / 4
      else
        cw = bitmap.width / 12
        ch = bitmap.height / 8
      end
      n = character_index
      src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
    end
    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  end

end


Compatibility
Rpg maker VX/VXAce.

Screenshot
Screenshot


Terms and Conditions
You are free to adapt this script.

This post has been edited by Melosx: Feb 6 2012, 05:40 AM
Go to the top of the page
 
+Quote Post
   
Eric&TheCheat
post Jan 8 2012, 03:06 PM
Post #2


Level 1
Group Icon

Group: Member
Posts: 7
Type: None
RM Skill: Beginner




Nice. Maybe I could find use of this sometime in the future if I ever decide to get VX ace. ^^


__________________________
Go to the top of the page
 
+Quote Post
   
TheBen
post Feb 4 2012, 06:20 AM
Post #3


Intolerable Noob
Group Icon

Group: Revolutionary
Posts: 344
Type: Developer
RM Skill: Beginner




Cognates are wonderful (as is Google Translate), so I've decided to *Ahem* transcribe the introduction to the script for English users.
CODE
#==========================================================================
# ** MSX - XP Characters in VX/VXAce
#==========================================================================
# Author: Melosx
# Version: 1.0
# Compatable with VX and VXAce
#==========================================================================
#  *Abstract
    # ---------------------------------------------------------------------
    # The script permits the use of XP sprites in VX.  All you have to do is insert the tag
    #  "$xp" at the start of the filename.
    # You can then use the VX-style sprites right alongside the ones of RPGXP.
    #
    #==========================================================================
# *Instructions
    # --------------------------------------------------------------------------
    # Insert the script below Materials and above Main.  Add the tag "$xp" (no quotes)
    # to the beginning of the filename of XP sprites you want to use.
    #
    #==========================================================================


    #==========================================================================
    # ** Sprite_Character
    #==========================================================================
    class Sprite_Character < Sprite_Base

      def update_bitmap
        if @tile_id != @character.tile_id or
           @character_name != @character.character_name or
           @character_index != @character.character_index
          @tile_id = @character.tile_id
          @character_name = @character.character_name
          @character_index = @character.character_index
          if @tile_id > 0
            sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32;
            sy = @tile_id % 256 / 8 % 16 * 32;
            self.bitmap = tileset_bitmap(@tile_id)
            self.src_rect.set(sx, sy, 32, 32)
            self.ox = 16
            self.oy = 32
          else
            self.bitmap = Cache.character(@character_name)
            sign = @character_name[/^[!$]./]
            if sign != nil and sign.include?('$')
              @cw = bitmap.width / 3
              @ch = bitmap.height / 4
            else
              @cw = bitmap.width / 12
              @ch = bitmap.height / 8
            end
            if @character_name != nil and @character_name.include?('$xp')
              @cw = bitmap.width / 4
              @ch = bitmap.height / 4
            end
            self.ox = @cw / 2
            self.oy = @ch
          end
        end
      end
        
      def update_src_rect
        if @character_name != nil and @character_name.include?('$xp')
          if @tile_id == 0
            pattern = @character.pattern > 0 ? @character.pattern - 1 : 3
            sx = pattern * @cw
            sy = (@character.direction - 2) / 2 * @ch
            self.src_rect.set(sx, sy, @cw, @ch)
          end
        else
          if @tile_id == 0
            index = @character.character_index
            pattern = @character.pattern < 3 ? @character.pattern : 1
            sx = (index % 4 * 3 + pattern) * @cw
            sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
            self.src_rect.set(sx, sy, @cw, @ch)
          end
        end
      end
    end


    #==========================================================================
====
    # ** Window_Base
    #==========================================================================
====
    class Window_Base < Window

      def draw_character(character_name, character_index, x, y)
        return if character_name == nil
        bitmap = Cache.character(character_name)
        sign = character_name[/^[!$]./]
        if character_name != nil and character_name.include?('$xp')
          cw = bitmap.width / 4
          ch = bitmap.height / 4
          n = character_index
          src_rect = Rect.new(0, 0, cw, ch)
        else
          if sign != nil and sign.include?('$')
            cw = bitmap.width / 3
            ch = bitmap.height / 4
          else
            cw = bitmap.width / 12
            ch = bitmap.height / 8
          end
          n = character_index
          src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
        end
        self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
      end

    end


Oh, and this is a great script. Thanks for putting it up - it was always one of the things that irked me about RPGVX.


__________________________
QUOTE
Great people talk about IDEAS
Average people talk about THINGS
Small people talk about OTHER PEOPLE

- A plaque on a BBQ restaurant in VA
Go to the top of the page
 
+Quote Post
   
Nufuz
post Feb 4 2012, 03:14 PM
Post #4


Level 1
Group Icon

Group: Member
Posts: 8
Type: Scripter
RM Skill: Intermediate




wow this is an Amazing script thumbsup.gif
after looking for so long
and I found also smile.gif

thanks for the script biggrin.gif


__________________________
<<This signature are cencored>>
Go to the top of the page
 
+Quote Post
   
Melosx
post Feb 6 2012, 05:57 AM
Post #5


Level 1
Group Icon

Group: Member
Posts: 9
Type: Scripter
RM Skill: Intermediate




Thanks so much for the translation. Updated first post with the script translated.
Go to the top of the page
 
+Quote Post
   

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 21st May 2013 - 09:08 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker