Últimos temas
» Necesito Charas de Aves para VX
por ChronoTXT Hoy a las 2:17 am

» Ayuda con el temporizador
por navivy Ayer a las 9:44 pm

» Eventos comunes que siga en todo los mapas
por navivy Ayer a las 5:11 pm

» [MV]Butterfly Paradox
por DopellSerch Mar Sep 17, 2019 6:29 am

» INSANE (juego de terror y puzzles)
por GRECO21 Lun Sep 16, 2019 4:25 am

» [Engine Vx Ace] Forzar Cerraduras (Versión 1.3)
por IvalteK_Dev Dom Sep 15, 2019 10:48 pm

» Como cambio esto?...
por Shy_Cream Dom Sep 15, 2019 9:05 pm

» [MV] ¿Cómo mover un sprite?
por DopellSerch Dom Sep 15, 2019 8:14 pm

» Zaza no konpasu (La Brújula de Zaza) [VXACE]
por Pocari Dom Sep 15, 2019 7:17 pm

» Pokemon Destiny
por Xaveguex Dom Sep 15, 2019 7:07 pm

» El Dia Z - Demo
por EdwarPlay Sáb Sep 14, 2019 8:08 pm

» Animación Habilidad de Enemigos RPGMAKER VX ACE
por Metatron Sáb Sep 14, 2019 3:16 am


[VX] Frames Adicionales

Ir abajo

[VX] Frames Adicionales  Empty [VX] Frames Adicionales

Mensaje por ZororoWhite el Jue Mayo 15, 2014 10:11 pm

Pues básicamente es un script que permite añadir frames adicionales a aquellos charas que queramos.

-----------------
¿Cómo funciona?
-----------------


Debes colocarle un nombre al archivo del chara que quieras editar de la siguiente manera:

!$%[<número de frames animadas>]<Nombre normal>

En el ejemplo quedaría algo así:

!$%[8]Major

--------------
Instrucciones
--------------

Copiar y pegar encima de Main (no tiene más complicaciones xDD).

--------------
Script
--------------

Código:
#==============================================================================
#  Extra Movement Frames v. 1.0
#  Author: modern algebra (rmrk.net)
#  Date: January 20, 2008
#------------------------------------------------------------------------------
#  Instructions:
#    Insert this script above main in the database. To add a character with
#    extra movement frames, simply rename the character graphic to something
#    of the form:
#          !$%[<number of movement frames>]<Regular name>
#
#    Example: !$%[4]001-Fighter01   
#    That would make the graphic 001-Fighter01 be interpreted as having 4 frames
#------------------------------------------------------------------------------
# ** Game_Character
#------------------------------------------------------------------------------
#  Summary of changes:
#    aliased methods - update_animation
#    new class variables - height divisor, width divisor
#    new methods - calculate_divisors
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader :height_divisor  # The height of a single frame
  attr_reader :width_divisor  # number of frames in the x direction
  attr_reader :char_frames
  #--------------------------------------------------------------------------
  # * Calculate Divisors
  #--------------------------------------------------------------------------
  #  Sets up the instance variables required
  #--------------------------------------------------------------------------
  def calculate_divisors
    return unless @previous_character.nil? || @previous_character != @character_name
    bitmap = Cache.character (@character_name)
    sign = @character_name[/^[\!\$].[\%]\[\d*\]/]
    if !sign.nil? && sign.size > 5
      @original_pattern = 0
      @width_divisor = sign[4, sign.size - 5].to_i
      @height_divisor = 4
      @char_frames = @width_divisor
    elsif !sign.nil? && sign.include? ('$')
      @width_divisor = 3
      @height_divisor = 4
      @char_frames = 3
    else
      @width_divisor = 12
      @height_divisor = 8
      @char_frames = 3
    end
    @previous_character = @character_name
  end
  #--------------------------------------------------------------------------
  # * Update Animation
  #--------------------------------------------------------------------------
  #  Change the hard coded values to ones dependent on character graphic format
  #--------------------------------------------------------------------------
  alias ma_extra_movement_frames_anim_upd update_animation
  def update_animation
    if @width_divisor == 12 || @width_divisor == 3
      ma_extra_movement_frames_anim_upd
      return
    end
    saved_anime_count = @anime_count
    pattern_original = @pattern
    speed = @move_speed + (dash? ? 1 : 0)
    ma_extra_movement_frames_anim_upd
    if (saved_anime_count > (18 - speed * 2)) && (@step_anime || (@stop_count <= 0))
      @pattern = (pattern_original + 1) % @char_frames
    end
  end
end

#==============================================================================
# * Sprite Character
#------------------------------------------------------------------------------
#  Summary of changes:
#    aliased methods - update_src_rect, update_bitmap
#==============================================================================

class Sprite_Character
  #--------------------------------------------------------------------------
  # * Update Src Rect
  #--------------------------------------------------------------------------
  #  Interpret multiple movement frames: Changed pattern
  #--------------------------------------------------------------------------
  alias ma_extra_movement_frames_src_rect_upd update_src_rect
  def update_src_rect
    if @tile_id == 0
      ma_extra_movement_frames_src_rect_upd
      index = @character.character_index
      pattern = @character.pattern < @character.char_frames ? @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
  #--------------------------------------------------------------------------
  # * Update Bitmap
  #--------------------------------------------------------------------------
  #  Change hard coded values to ones dependent on character graphic
  #--------------------------------------------------------------------------
  alias ma_extra_movement_frames_bmp_upd update_bitmap
  def update_bitmap
    @character.calculate_divisors
    saved_tile_id = @tile_id
    saved_character_name = @character_name
    saved_character_index = @character_index
    ma_extra_movement_frames_bmp_upd
    if saved_tile_id  != @character.tile_id or
      saved_character_name != @character.character_name or
      saved_character_index != @character.character_index
      unless @tile_id > 0
        @cw = bitmap.width / @character.width_divisor
        @ch = bitmap.height / @character.height_divisor
        self.ox = @cw / 2
        self.oy = @ch
      end
    end
  end
end

#==============================================================================
# ** Window Base
#------------------------------------------------------------------------------
#  Summary of changes:
#    overwritten methods - draw_character
#==============================================================================

class Window_Base
  #--------------------------------------------------------------------------
  # * Draw Charater (overwritten for extra movement frames)
  #    character_name  : the name of the character file
  #    character_index : the index of the character in the file
  #    x              : the x position to draw
  #    y              : the y position to draw
  #--------------------------------------------------------------------------
  def draw_character(character_name, character_index, x, y)
    return if character_name == nil
    bitmap = Cache.character(character_name)
    sign = character_name[/^[\!\$].[\%]\[\d*\]/]
    if !sign.nil? && sign.size > 5
      cw = bitmap.width / sign[4, sign.size - 5].to_i
      ch = bitmap.height / 4
    elsif 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)
    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  end
end

-----------
Créditos
-----------

Los créditos van a Modern Algebra.

------------
Screenshots
------------

No las veo necesarias, además de que no se puede mostrar una animación en una imagen (no pienso hacer un gif D:<).

-------------
Demo
-------------

Descarga aquí.

Pues eso es todo. Espero que a alguno le sea de utilidad xDD (Una pena que no haya para Ace...).

Saludos, Zororo.
ZororoWhite
ZororoWhite
PJ Principal
PJ Principal

Masculino
España
RPG Maker : Ace
Mensajes : 477
Monedas : 3136
Reputación : 71
Edad : 20
Localización : En Hysura, quemando RoH 4

Volver arriba Ir abajo

Volver arriba


 
Permisos de este foro:
No puedes responder a temas en este foro.