设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索

柳大的xp转va的脚本遇到bug

查看数: 2528 | 评论数: 6 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2018-8-4 04:43

正文摘要:

本帖最后由 18120714158 于 2018-8-4 04:59 编辑 如题 ,我复制了转好的图,放进va的游戏里 两个脚本也复制了 遇到如图bug,求大佬帮助。

回复

18120714158 发表于 2018-8-4 05:10:46
本帖最后由 18120714158 于 2018-8-4 05:15 编辑

问题脚本在这,第56行
RUBY 代码复制
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ Spriteset_Map
  4. #------------------------------------------------------------------------------
  5. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。
  6. #==============================================================================
  7.  
  8. class Spriteset_Map
  9.   #--------------------------------------------------------------------------
  10.   # ● 初始化对象
  11.   #--------------------------------------------------------------------------
  12.   def initialize
  13.     create_viewports
  14.     create_tilemap
  15.     create_parallax
  16.     create_characters
  17.     create_shadow
  18.     create_weather
  19.     create_pictures
  20.     create_timer
  21.     update
  22.   end
  23.   #--------------------------------------------------------------------------
  24.   # ● 生成显示端口
  25.   #--------------------------------------------------------------------------
  26.   def create_viewports
  27.     @viewport1 = Viewport.new
  28.     @viewport2 = Viewport.new
  29.     @viewport3 = Viewport.new
  30.     @viewport2.z = 50
  31.     @viewport3.z = 100
  32.   end
  33.   #--------------------------------------------------------------------------
  34.   # ● 读取图块地图
  35.   #--------------------------------------------------------------------------
  36.   def create_tilemap
  37.     @tilemap_all = []
  38.     @char_tileset = {}
  39.     tilemap = Tilemap.new(@viewport1)
  40.     tilemap.map_data = xpdata_convert($game_map.data, 1)
  41.     @tilemap_all.push(tilemap)
  42.     tilemap = Tilemap.new(@viewport1)
  43.     tilemap.map_data = xpdata_convert($game_map.data, 2)
  44.     @tilemap_all.push(tilemap)
  45.     tilemap = Tilemap.new(@viewport1)
  46.     tilemap.map_data = xpdata_convert($game_map.data, 3)
  47.     @tilemap_all.push(tilemap)
  48.     load_tileset
  49.   end
  50.  
  51.   def xpdata_convert(orial_data, id)
  52.     get_data = orial_data.clone
  53.     for x in 0...get_data.xsize
  54.       for y in 0...get_data.ysize
  55.         for i in 0..2
  56.           if $game_map.tileset.priorities[get_data[x, y, i]] > 0 and get_data[x, y, i] != 0
  57.             if !@char_tileset.keys.include?(x.to_s + "_" + y.to_s + "_" + i.to_s)
  58.               char = Game_MapTile.new
  59.               char.set_static_tile( get_data[x, y, i] , $game_map.tileset.priorities[get_data[x, y, i]] )
  60.               char.moveto(x, y)
  61.               @char_tileset[x.to_s + "_" + y.to_s + "_" + i.to_s] = char
  62.             end
  63.             get_data[x, y, i] = 0
  64.           end
  65.         end
  66.         case id
  67.         when 1
  68.           get_data[x, y, 2] = get_data[x, y, 0]
  69.           get_data[x, y, 0] = 0
  70.           get_data[x, y, 1] = 0
  71.         when 2
  72.           get_data[x, y, 2] = get_data[x, y, 1]
  73.           get_data[x, y, 0] = 0
  74.           get_data[x, y, 1] = 0
  75.         when 3
  76.           get_data[x, y, 0] = 0
  77.           get_data[x, y, 1] = 0
  78.         end
  79.       end
  80.     end
  81.     return get_data
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● 读取图块组
  85.   #--------------------------------------------------------------------------
  86.   def load_tileset
  87.     @tileset = $game_map.tileset
  88.     @tileset.tileset_names.each_with_index do |name, i|
  89.       for tilemap in @tilemap_all
  90.         tilemap.bitmaps[i] = Cache.tileset(name)
  91.       end
  92.     end
  93.     for tilemap in @tilemap_all
  94.       tilemap.flags = @tileset.flags
  95.     end
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● 生成远景图
  99.   #--------------------------------------------------------------------------
  100.   def create_parallax
  101.     @parallax = Plane.new(@viewport1)
  102.     @parallax.z = -100
  103.   end
  104.   #--------------------------------------------------------------------------
  105.   # ● 生成人物精灵
  106.   #--------------------------------------------------------------------------
  107.   def create_characters
  108.     @character_sprites = []
  109.     $game_map.events.values.each do |event|
  110.       @character_sprites.push(Sprite_Character.new(@viewport1, event))
  111.     end
  112.     @char_tileset.values.each do |char|
  113.       @character_sprites.push(Sprite_Character.new(@viewport1, char))
  114.     end
  115.     $game_map.vehicles.each do |vehicle|
  116.       @character_sprites.push(Sprite_Character.new(@viewport1, vehicle))
  117.     end
  118.     $game_player.followers.reverse_each do |follower|
  119.       @character_sprites.push(Sprite_Character.new(@viewport1, follower))
  120.     end
  121.     @character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
  122.     @map_id = $game_map.map_id
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # ● 生成飞艇影子
  126.   #--------------------------------------------------------------------------
  127.   def create_shadow
  128.     @shadow_sprite = Sprite.new(@viewport1)
  129.     @shadow_sprite.bitmap = Cache.system("Shadow")
  130.     @shadow_sprite.ox = @shadow_sprite.bitmap.width / 2
  131.     @shadow_sprite.oy = @shadow_sprite.bitmap.height
  132.     @shadow_sprite.z = 180
  133.   end
  134.   #--------------------------------------------------------------------------
  135.   # ● 生成天气
  136.   #--------------------------------------------------------------------------
  137.   def create_weather
  138.     @weather = Spriteset_Weather.new(@viewport2)
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ● 生成图片精灵
  142.   #--------------------------------------------------------------------------
  143.   def create_pictures
  144.     @picture_sprites = []
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # ● 生成计时器精灵
  148.   #--------------------------------------------------------------------------
  149.   def create_timer
  150.     @timer_sprite = Sprite_Timer.new(@viewport2)
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ● 释放
  154.   #--------------------------------------------------------------------------
  155.   def dispose
  156.     dispose_tilemap
  157.     dispose_parallax
  158.     dispose_characters
  159.     dispose_shadow
  160.     dispose_weather
  161.     dispose_pictures
  162.     dispose_timer
  163.     dispose_viewports
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● 释放地图图块
  167.   #--------------------------------------------------------------------------
  168.   def dispose_tilemap
  169.     for tilemap in @tilemap_all do tilemap.dispose end
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● 释放远景图
  173.   #--------------------------------------------------------------------------
  174.   def dispose_parallax
  175.     @parallax.bitmap.dispose if @parallax.bitmap
  176.     @parallax.dispose
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ● 释放人物精灵
  180.   #--------------------------------------------------------------------------
  181.   def dispose_characters
  182.     @character_sprites.each {|sprite| sprite.dispose }
  183.   end
  184.   #--------------------------------------------------------------------------
  185.   # ● 释放飞艇影子
  186.   #--------------------------------------------------------------------------
  187.   def dispose_shadow
  188.     @shadow_sprite.dispose
  189.   end
  190.   #--------------------------------------------------------------------------
  191.   # ● 释放天气
  192.   #--------------------------------------------------------------------------
  193.   def dispose_weather
  194.     @weather.dispose
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # ● 释放图片精灵
  198.   #--------------------------------------------------------------------------
  199.   def dispose_pictures
  200.     @picture_sprites.compact.each {|sprite| sprite.dispose }
  201.   end
  202.   #--------------------------------------------------------------------------
  203.   # ● 释放计时器精灵
  204.   #--------------------------------------------------------------------------
  205.   def dispose_timer
  206.     @timer_sprite.dispose
  207.   end
  208.   #--------------------------------------------------------------------------
  209.   # ● 释放显示端口
  210.   #--------------------------------------------------------------------------
  211.   def dispose_viewports
  212.     @viewport1.dispose
  213.     @viewport2.dispose
  214.     @viewport3.dispose
  215.   end
  216.   #--------------------------------------------------------------------------
  217.   # ● 更新人物
  218.   #--------------------------------------------------------------------------
  219.   def refresh_characters
  220.     dispose_characters
  221.     create_characters
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # ● 更新画面
  225.   #--------------------------------------------------------------------------
  226.   def update
  227.     update_tileset
  228.     update_tilemap
  229.     update_parallax
  230.     update_characters
  231.     update_shadow
  232.     update_weather
  233.     update_pictures
  234.     update_timer
  235.     update_viewports
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # ● 监察图块组是否需要被切换
  239.   #--------------------------------------------------------------------------
  240.   def update_tileset
  241.     if @tileset != $game_map.tileset
  242.       load_tileset
  243.       refresh_characters
  244.     end
  245.   end
  246.   #--------------------------------------------------------------------------
  247.   # ● 更新地图图块
  248.   #--------------------------------------------------------------------------
  249.   def update_tilemap
  250.     for tilemap in @tilemap_all
  251.       tilemap.ox = $game_map.display_x * 32
  252.       tilemap.oy = $game_map.display_y * 32
  253.       tilemap.update
  254.     end
  255.   end
  256.   #--------------------------------------------------------------------------
  257.   # ● 更新远景图
  258.   #--------------------------------------------------------------------------
  259.   def update_parallax
  260.     if @parallax_name != $game_map.parallax_name
  261.       @parallax_name = $game_map.parallax_name
  262.       @parallax.bitmap.dispose if @parallax.bitmap
  263.       @parallax.bitmap = Cache.parallax(@parallax_name)
  264.       Graphics.frame_reset
  265.     end
  266.     @parallax.ox = $game_map.parallax_ox(@parallax.bitmap)
  267.     @parallax.oy = $game_map.parallax_oy(@parallax.bitmap)
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ● 更新人物精灵
  271.   #--------------------------------------------------------------------------
  272.   def update_characters
  273.     refresh_characters if @map_id != $game_map.map_id
  274.     @character_sprites.each {|sprite| sprite.update }
  275.   end
  276.   #--------------------------------------------------------------------------
  277.   # ● 更新飞艇影子
  278.   #--------------------------------------------------------------------------
  279.   def update_shadow
  280.     airship = $game_map.airship
  281.     @shadow_sprite.x = airship.screen_x
  282.     @shadow_sprite.y = airship.screen_y + airship.altitude
  283.     @shadow_sprite.opacity = airship.altitude * 8
  284.     @shadow_sprite.update
  285.   end
  286.   #--------------------------------------------------------------------------
  287.   # ● 更新天气
  288.   #--------------------------------------------------------------------------
  289.   def update_weather
  290.     @weather.type = $game_map.screen.weather_type
  291.     @weather.power = $game_map.screen.weather_power
  292.     @weather.ox = $game_map.display_x * 32
  293.     @weather.oy = $game_map.display_y * 32
  294.     @weather.update
  295.   end
  296.   #--------------------------------------------------------------------------
  297.   # ● 更新图片精灵
  298.   #--------------------------------------------------------------------------
  299.   def update_pictures
  300.     $game_map.screen.pictures.each do |pic|
  301.       @picture_sprites[pic.number] ||= Sprite_Picture.new(@viewport2, pic)
  302.       @picture_sprites[pic.number].update
  303.     end
  304.   end
  305.   #--------------------------------------------------------------------------
  306.   # ● 更新计时器精灵
  307.   #--------------------------------------------------------------------------
  308.   def update_timer
  309.     @timer_sprite.update
  310.   end
  311.   #--------------------------------------------------------------------------
  312.   # ● 更新显示端口
  313.   #--------------------------------------------------------------------------
  314.   def update_viewports
  315.     @viewport1.tone.set($game_map.screen.tone)
  316.     @viewport1.ox = $game_map.screen.shake
  317.     @viewport2.color.set($game_map.screen.flash_color)
  318.     @viewport3.color.set(0, 0, 0, 255 - $game_map.screen.brightness)
  319.     @viewport1.update
  320.     @viewport2.update
  321.     @viewport3.update
  322.   end
  323. end
zx2692124289 发表于 2018-8-12 17:23:46
好吧好吧,没能帮到您真是抱歉~
18120714158 发表于 2018-8-11 03:39:44
zx2692124289 发表于 2018-8-9 19:36
试试吧,不一定能行

还是不行,不过已经没有关系了
谢谢
18120714158 发表于 2018-8-11 03:29:40
zx2692124289 发表于 2018-8-9 19:36
试试吧,不一定能行

谢谢
我去试一试,希望成功
zx2692124289 发表于 2018-8-9 19:36:15
if $game_map.tileset.priorities[get_data[x, y, i]] > 0 and [get_data[x, y, i]] != 0
zx2692124289 发表于 2018-8-4 04:43:15
zx2692124289 发表于 2018-8-9 19:36
if $game_map.tileset.priorities[get_data[x, y, i]] > 0 and [get_data[x, y, i]] != 0

试试吧,不一定能行
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-17 04:32

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表