แปลง animation ของ VX ACE มาใช้ใน XP - Nazuth -  09-16-2013
 
 
====================================================== 
การนำอนิเมชั่นของ VX ACE มาใช้ใน XP 
====================================================== 
 
บทความนี้เกิดจากการทดลองของผมนะครับเพราะเดิมทีนี่เป็นสคริปท์ที่ใช้แปลงอนิเมชั่น VX เป็น XP แต่ผมลองเอาของ VX ACE มาใช้แทนก็พบว่าใช้ได้เหมือนกันทีนี้ก็หมดปัญหาที่ว่าอนิเมชั่นของVX ACE สวยกว่าของXPมากแต่ดันมีเลเยอร์แม็พให้แค่2เลเยอร์ 
 
1.เริ่มต้นจากการนำไฟล์ animations.rvdata2  
มาจากโฟลเดอร์ DATA ในโปรเจ็คของเราใน RMVX ACE 
 
![[Image: DjI8iir.png]](http://i.imgur.com/DjI8iir.png)  
 
2.จากนั้นเอาไปวางในโฟลเดอร์โปรเจ็คที่เราต้องการใช้ใน RMXP 
 
![[Image: kyNGi4v.png]](http://i.imgur.com/kyNGi4v.png)  
 
3.ต่อไปก็เปิดตัวจัดการโปรเจ็คแล้วก็อปสคริปท์นี้ไปใส่ไว้ก่อนหน้า main 
สคริปท์ 
 
[hide] 
		Show ContentSpoiler: 
		Code: #==============================================================================   
# ** Animation Converter   
# v. 1.0   
# Author: Kread-EX   
# ------------------------------------------------------------------------------   
# Converts vxdata animations files to rxdata.   
#==============================================================================   
    
# This script makes animations created with RMVX useable with RMXP.   
# "What the point ?", you might ask.   
# Well, I had to make this for my own use, so I release it in case others need it.   
    
# Basically, RMVX animations use 2 bitmap files which is great. If you have animated battlers   
# with a lot of special moves, you might end up with tons of bitmap files to bloat your   
# project's size.   
# In that case, you can create animation data in RPG VX and convert them to the XP format.   
    
### INSTRUCTIONS ###   
    
# 1 - Copy the script and paste it just above Main.   
# 2 - Make your animation file with RPG Maker VX.   
# 3 - Create a backup for all your animation files, you never know what might happens.   
# 4 - Locate the file named "Animations.rvdata" in the "Data/Animations/" folder of your VX   
# project and paste it in your XP project folder.   
# 5 - Run your RMXP game executable from the editor.   
# 6 - Copy the resulting "Animations.rxdata" file into the "Data/Animations/" folder of your   
# XP project.   
# 7 - Although you won't see the result in the editor, both bitmaps will be loaded by the game.   
    
# NOTE: RPGXP Editor will not read the second bitmap of the animation but the game will.   
    
#--------------------------------------------------------------------------   
# * Converts the rvdata file   
#--------------------------------------------------------------------------   
  module RPG   
  class Animation   
    attr_accessor(:animation1_name, :animation1_hue, :animation2_name, :animation2_hue)   
    class Timing   
      attr_accessor(:se)   
    end   
  end   
  class SE   
    attr_reader(:name, :volume, :pitch)   
  end   
  end   
  if $DEBUG && FileTest.exist?('Animations.rvdata2')   
  array = [nil]   
  a = load_data('Animations.rvdata2')   
  a.each {|anim|   
  next if anim == nil   
  b = anim   
  c = RPG::Animation.new   
  c.id = b.id   
  c.name = b.name   
  c.animation_name = b.animation1_name   
  c.animation_hue = b.animation1_hue   
  c.position = b.position   
  c.frame_max = b.frame_max   
  c.frames = b.frames   
  c.timings = b.timings   
  (0..c.timings.size-1).each {|i| c.timings[i].se = RPG::AudioFile.new(b.timings[i].se.name,   
  b.timings[i].se.volume, b.timings[i].se.pitch)}   
  c.animation2_name = b.animation2_name   
  c.animation2_hue = b.animation2_hue   
  array.push(c)}   
  save_data(array, 'Animations.rxdata')   
  end   
    
#--------------------------------------------------------------------------   
# * This part will allow the game to read the animation   
#--------------------------------------------------------------------------   
  module RPG   
  #--------------------------------------------------------------------------   
  class Sprite < ::Sprite   
    #--------------------------------------------------------------------------   
    # * Process the animation   
    #--------------------------------------------------------------------------   
    def animation(animation, hit)   
      dispose_animation   
      @_animation = animation   
      return if @_animation == nil   
      @_animation_hit = hit   
      @_animation_duration = @_animation.frame_max   
      animation_name = @_animation.animation_name   
      animation_name2 = @_animation.animation2_name   
      animation_hue = @_animation.animation_hue   
      animation_hue2 = @_animation.animation2_hue   
      @bitmap = RPG::Cache.animation(animation_name, animation_hue)   
      @bitmap2 = RPG::Cache.animation(animation_name2, animation_hue2) rescue @bitmap2 = nil   
      if @@_reference_count.include?(@bitmap)   
        @@_reference_count[@bitmap] += 1   
      else   
        @@_reference_count[@bitmap] = 1   
      end   
      if [email protected]?   
        if @@_reference_count.include?(@bitmap2)   
          @@_reference_count[@bitmap2] += 1   
        else   
          @@_reference_count[@bitmap2] = 1   
        end   
      end   
      @_animation_sprites = []   
      if @_animation.position != 3 or not @@_animations.include?(animation)   
        for i in 0..15   
          sprite = ::Sprite.new(self.viewport)   
          sprite.visible = false   
          @_animation_sprites.push(sprite)   
        end   
        unless @@_animations.include?(animation)   
          @@_animations.push(animation)   
        end   
      end   
      update_animation   
    end   
    #--------------------------------------------------------------------------   
    # * Sets the sprites   
    #--------------------------------------------------------------------------   
    def animation_set_sprites(sprites, cell_data, position)   
      for i in 0..15   
        sprite = sprites[i]   
        pattern = cell_data[i, 0]   
        if !pattern.nil? && pattern < 100   
          sprite.bitmap = @bitmap   
        elsif !pattern.nil?   
          sprite.bitmap = @bitmap2   
        end   
        if sprite == nil or pattern == nil or pattern == -1   
          sprite.visible = false if sprite != nil   
          next   
        end   
        sprite.visible = true   
        sprite.src_rect.set(pattern % 5 * 192, pattern % 100 / 5 * 192, 192, 192)   
        if position == 3   
          if self.viewport != nil   
            sprite.x = self.viewport.rect.width / 2   
            sprite.y = self.viewport.rect.height - 160   
          else   
            sprite.x = 320   
            sprite.y = 240   
          end   
        else   
          sprite.x = self.x - self.ox + self.src_rect.width / 2   
          sprite.y = self.y - self.oy + self.src_rect.height / 2   
          sprite.y -= self.src_rect.height / 4 if position == 0   
          sprite.y += self.src_rect.height / 4 if position == 2   
        end   
        sprite.x += cell_data[i, 1]   
        sprite.y += cell_data[i, 2]   
        sprite.z = 2000   
        sprite.ox = 96   
        sprite.oy = 96   
        sprite.zoom_x = cell_data[i, 3] / 100.0   
        sprite.zoom_y = cell_data[i, 3] / 100.0   
        sprite.angle = cell_data[i, 4]   
        sprite.mirror = (cell_data[i, 5] == 1)   
        sprite.opacity = cell_data[i, 6] * self.opacity / 255.0   
        sprite.blend_type = cell_data[i, 7]   
      end   
    end   
    #--------------------------------------------------------------------------   
  end   
  #--------------------------------------------------------------------------   
end 
	 
[/hide] 
 
![[Image: kB8AHmd.png]](http://i.imgur.com/kB8AHmd.png)  
 
4.จากนั้นก็ลองกดทดสอบรันเกมดูพอขึ้นแล้วก็ปิดไปเพื่อให้สคริปท์รัน 
 
![[Image: xuQk0YO.png]](http://i.imgur.com/xuQk0YO.png)  
 
5.เราจะได้ไฟล์ animations.rxdata ที่เป็นไฟล์อนิเมชั่นของ RMXP มา 
 
![[Image: BOwX4BA.png]](http://i.imgur.com/BOwX4BA.png)  
 
6.ให้เราก็อปไปใส่แทนไฟล์เดิมใน DATA ทับของเดิมไปเลย  
(ข้อควรระวังถ้ามีอนิเมชั่นที่ทำเองอยู่ด้วยควรใส่ในโปรเจ็คอื่นแล้วค่อยก็อปมาอีกทีมิฉะนั้นข้อมูลเดิมจะหายหมด) 
 
![[Image: uvGvAjN.png]](http://i.imgur.com/uvGvAjN.png)  
 
7.จากนั้นให้เราไปก็อปปี้ RTP ของ VX ACE เฉพาะแค่ animation กับ sound effect มาใส่ในโปรเจ็คของ XP จะไปก็อปมาจากโฟลเดอร์RTPโดยตรงหรือกดส่งออกจากโปรเจ็คก็ได้ จากนั้นให้ปิดโปรเจ็คของXPลงครั้งหนึ่ง แล้วเปิดขึ้นมาใหม่จะพบว่ามีอนิเมชั่นของ VX ACE มาให้ใช้ได้แบบชิลๆแล้ว 
 
![[Image: 9EzecrP.png]](http://i.imgur.com/9EzecrP.png)  
 
 
Cr.Script : Kread-EX   
modify&present : Natsuki  
(ถึงจะบอกว่าโมแต่เพิ่มแค่2ตัวอักษรกับแก้ไขการเว้นวรรคผิดที่ทำให้errorเรียกว่าค้นพบดีกว่า) 
 
 
 
 
 
RE: แปลง animation ของ VX ACE มาใช้ใน XP - Shinryu -  09-17-2013
 
 
ลองแล้วใช้งานง่ายดี แต่มีข้อเสียตรง อนิเมชั่นที่2 XPมันไม่มี ทำให้บางอนิเมชั่นขาดความสมบูรณ์นิดหน่อย
 
 
 
RE: แปลง animation ของ VX ACE มาใช้ใน XP - LuZi -  04-01-2015
 
 
ขอขุดนิดหน่อย จากที่ลองทดสอบ 
ถ้าเทสอนิเมชั่นในฐานข้อมูลของ Editor จะไม่แสดงอนิเมชั่นที่2 แต่ถ้าเทสรันเกมจะแสดงอนิเมจากไฟล์ที่2 นะ  
 
 
 
RE: แปลง animation ของ VX ACE มาใช้ใน XP - ACSII -  04-01-2015
 
 
ถ้า RMXP มี animation ที่ 2 ได้นี่จะเป็นอะไรที่แหล่มมากๆเลยนะครับ 
ใครพอจะมีวิธีทำให้แสดงได้ 2 อันมั้งครัฟ  
 
 
 
RE: แปลง animation ของ VX ACE มาใช้ใน XP - Nazuth -  04-02-2015
 
 
ท่านลูก็บอกอยู่นี่ครับว่าตอนใช้จริงจะมีแต่แค่ไม่เห็นในฐานข้อมูล =w=
 
 
 
RE: แปลง animation ของ VX ACE มาใช้ใน XP - dokibaku -  04-02-2015
 
 
ทำใส่โปรเจคเปล่าแล้วก๊อปเฉพาะอันที่จะใช้มาลงนี่ทำได้ไหมครับ พอดีผมอยากใช้ของ VX ACE แค่บางอันอ่ะ ใช้หมดเดี๋ยวเกมใหญ่เว่อร์
 
 
 
RE: แปลง animation ของ VX ACE มาใช้ใน XP - LuZi -  04-02-2015
 
 
จากที่ลองแล้ว อนิเมชั่นที่Convert จากvxa แบบใช้สองไฟล์ 
ถ้าใช้วิธีคัดลอกไปแปะอีกฐานข้อมูลของโปรเจกต์อื่น มันจะไม่เห็นอนิเมชั่นภาพไฟล์ที่2  
จะเห็นเฉพาะจากตัวโปรเจกต์ที่ใช้ตัว Animation.rxdata ที่ Convertอย่างเดียว
 
 
 
RE: แปลง animation ของ VX ACE มาใช้ใน XP - Shinryu -  04-03-2015
 
 
 (04-02-2015, 11:17 PM)LuZi Wrote:  จากที่ลองแล้ว อนิเมชั่นที่Convert จากvxa แบบใช้สองไฟล์ 
ถ้าใช้วิธีคัดลอกไปแปะอีกฐานข้อมูลของโปรเจกต์อื่น มันจะไม่เห็นอนิเมชั่นภาพไฟล์ที่2  
จะเห็นเฉพาะจากตัวโปรเจกต์ที่ใช้ตัว Animation.rxdata ที่ Convertอย่างเดียว  
ให้ใช้วิธีก็อปเกมเราไปทับแทนสินะ
 
 
 
RE: แปลง animation ของ VX ACE มาใช้ใน XP - LuZi -  04-03-2015
 
 
@Shinryu  
ใช่แล้วครับ เอาของโปรเจกต์เราไปใส่ในดาต้าที่Convert แล้วค่อยเอามายัดใส่ในดาต้าโปรเจกต์หลักเรา 
แต่มันยุ่งยากหลายอย่าง เวลาถ้าเราจะทำอนิเมชั่นเพิ่มจากในVXA แล้วConvert ใหม่ มีมึนกันแน่ๆ
 
 
 
 |