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

Project1

 找回密码
 注册会员
搜索
查看: 2337|回复: 5
打印 上一主题 下一主题

[已经解决] 话说这个ace脚本有没有类似的mv插件?

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1001
在线时间
212 小时
注册时间
2011-11-23
帖子
109
跳转到指定楼层
1
发表于 2016-7-28 09:33:26 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
RUBY 代码复制
  1. #==============================================================================
  2. # ■ 隐藏房间黑块
  3. #  by:VIPArcher [email: [email][email protected][/email]]
  4. #  -- 本脚本来自 [url]https://rpg.blue[/url] 使用或转载请保留以上信息。
  5. #==============================================================================
  6. # 使用说明:
  7. #  · 在需要用黑块遮罩的地图上建一个事件,事件名为 "Black_Room"并且在该事件里注释上
  8. #  需要遮罩的范围矩形,例如 <6,4,10,17> 就为从地图坐标(6,4)开始到坐标(10,17)的矩形
  9. #  区域填充上黑色块遮罩掉,当玩家踏入这个矩形时遮罩块消失。查看坐标可以看地图编辑器
  10. #  右下角,把要遮罩的区域的左上角的坐标和右下角的坐标带入即可。
  11. #  · 指定遮罩块颜色可在设置的第一行注释上<color=Color.new(R,G,B)>
  12. #  · 每个遮罩可以指定角色踏入的矩形,规则同上,注释方法为在对应的矩形后面同一行注释
  13. #  例如<6,4,10,17>,[6,4,10,18],未指定踏入区域时默认原矩形为踏入区域
  14. #  · 如需注释多个黑块房间请注意换行。
  15. #  · 需要用图片做为遮罩块,就像这样备注 <name=文件名 x:5 y:5>,[5,5,10,10]
  16. #   使用图片做为遮罩块必须设置踏入的矩形。文件放在"\Graphics\Parallaxes"文件夹下
  17. #==============================================================================
  18. $VIPArcherScript ||= {};$VIPArcherScript[:black_room] = 20150211
  19. #-------------------------------------------------------------------------------
  20. module VIPArcher end
  21. #==============================================================================
  22. # ★ 设定部分 ★
  23. #==============================================================================
  24. module VIPArcher::BlackRoom
  25.   Z = 999                        # 遮罩块的Z值
  26.   SW = 0                         # 该开关开启时遮罩块不可见
  27.   Edge = -5                      # 遮罩块边距留空的距离
  28.   Room_Color = Color.new(0,0,0)  # 默认遮罩块填充的颜色
  29.   Event_Name = 'Black_Room'      # 设置遮罩块的事件名
  30.   Opacity_Speed = 17             # 透明度变化的速度
  31. end
  32. #==============================================================================
  33. # ☆ 设定结束 ☆
  34. #==============================================================================
  35. class Sprite_BlackRoom < Sprite
  36.   include VIPArcher::BlackRoom
  37.   #--------------------------------------------------------------------------
  38.   # ● 初始化对象
  39.   #--------------------------------------------------------------------------
  40.   def initialize(rect,check_rect,color,viewport)
  41.     super(viewport)
  42.     @check_rect, [url=home.php?mod=space&uid=10453]@color[/url] = check_rect,color
  43.     if rect.is_a?(Rect)
  44.       self.x, self.y, self.z = rect.x * 32, rect.y * 32, Z
  45.       width, height = rect.width - rect.x + 1,rect.height - rect.y + 1
  46.       set_bitmap(width * 32,height * 32)
  47.     elsif rect.is_a?(Array)
  48.       self.x, self.y, self.z = rect[1] * 32, rect[2] * 32, Z
  49.       set_bitmap(rect[0])
  50.     end
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # ● 设置Bitmap
  54.   #--------------------------------------------------------------------------
  55.   def set_bitmap(*args)
  56.     case args.size
  57.     when 1
  58.       self.bitmap = Cache.parallax(args[0])
  59.     when 2
  60.       self.bitmap = Bitmap.new(args[0], args[1])
  61.       rect = Rect.new(Edge, Edge, args[0] - Edge * 2, args[1] - Edge * 2)
  62.       self.bitmap.fill_rect(rect, @color)
  63.     end
  64.   end
  65.   #--------------------------------------------------------------------------
  66.   # ● 释放
  67.   #--------------------------------------------------------------------------
  68.   def dispose
  69.     super
  70.     self.bitmap.dispose
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ● 位置判定
  74.   #--------------------------------------------------------------------------
  75.   def character_pos?
  76.     $game_player.x > @check_rect.width  || $game_player.x <  @check_rect.x ||
  77.     $game_player.y > @check_rect.height || $game_player.y <  @check_rect.y
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # ● 更新透明度
  81.   #--------------------------------------------------------------------------
  82.   def update_opacity
  83.     self.opacity += character_pos? ? Opacity_Speed : - Opacity_Speed
  84.     self.opacity = 0 if $game_switches[SW]
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   # ● 更新位置
  88.   #--------------------------------------------------------------------------
  89.   def update_position
  90.     self.ox = $game_map.display_x * 32
  91.     self.oy = $game_map.display_y * 32
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● 更新画面
  95.   #--------------------------------------------------------------------------
  96.   def update
  97.     super
  98.     update_opacity
  99.     update_position
  100.   end
  101. end
  102. #-------------------------------------------------------------------------------
  103. class Spriteset_Map
  104.   include VIPArcher::BlackRoom
  105.   #--------------------------------------------------------------------------
  106.   # ● 生成黑色遮罩块
  107.   #--------------------------------------------------------------------------
  108.   alias black_room_create_characters create_characters
  109.   def create_characters
  110.     black_room_create_characters
  111.     room_sprite_dispose if @black_room_sprites
  112.     @black_room_sprites = []
  113.     $game_map.events.values.each do |event|
  114.       if event.instance_variable_get(:@event).name =~ /#{Event_Name}/i
  115.         return if event.list.nil?
  116.         event.list.each { |command| get_setup(command) }
  117.       end
  118.     end
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ● 获取遮罩块设置
  122.   #--------------------------------------------------------------------------
  123.   def get_setup(command)
  124.     return unless command.code == 108 or 408
  125.     command.parameters.each {|line|get_rect_setup(line);get_bitmap_setup(line)}
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● 备注文件名的设置
  129.   #--------------------------------------------------------------------------
  130.   def get_bitmap_setup(line)
  131.     if line =~ /<name\s*=\s*(\S+?)\s*x:\s*(\d+?)\s*y:\s*(\d+)>/i
  132.       rect = [$1,$2.to_i,$3.to_i]
  133.       if line =~ /\[(\d+.*?)\]/; x = $1.split(',')
  134.         check_rect = Rect.new(x[0].to_i,x[1].to_i,x[2].to_i,x[3].to_i)
  135.       end
  136.       sprite = Sprite_BlackRoom.new(rect,check_rect,@color,@viewport1)
  137.       sprite.opacity = 0 unless sprite.character_pos?
  138.       @black_room_sprites.push(sprite)
  139.     end
  140.   end
  141.   #--------------------------------------------------------------------------
  142.   # ● 备注矩形的设置
  143.   #--------------------------------------------------------------------------
  144.   def get_rect_setup(line)
  145.     @color = eval($1) if line =~ /<color\s*=\s*(.*?)\s*>/i
  146.     @color ||= Room_Color
  147.     if line =~ /<(\d+.*?)>/; x = $1.split(',')
  148.       check_rect = rect = Rect.new(x[0].to_i,x[1].to_i,x[2].to_i,x[3].to_i)
  149.       if line =~ /\[(\d+.*?)\]/; x = $1.split(',')
  150.         check_rect = Rect.new(x[0].to_i,x[1].to_i,x[2].to_i,x[3].to_i)
  151.       end
  152.       sprite = Sprite_BlackRoom.new(rect,check_rect,@color,@viewport1)
  153.       sprite.opacity = 0 unless sprite.character_pos?
  154.       @black_room_sprites.push(sprite)
  155.     end
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ● 释放
  159.   #--------------------------------------------------------------------------
  160.   alias black_room_dispose dispose
  161.   def dispose
  162.     black_room_dispose
  163.     room_sprite_dispose
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● 释放遮罩块
  167.   #--------------------------------------------------------------------------
  168.   def room_sprite_dispose
  169.     @black_room_sprites.each {|sprite| sprite.dispose }
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● 更新画面
  173.   #--------------------------------------------------------------------------
  174.   alias black_room_update update
  175.   def update
  176.     black_room_update
  177.     @black_room_sprites.each {|sprite| sprite.update }
  178.   end
  179. end



挺有趣的脚本,就是不知道有没有和它类似的mv插件,如果没有,不知道哪个老师能写一份造福一下mv的使用者们{:2_260:}

Lv3.寻梦者

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
帖子
1516
2
发表于 2016-7-28 15:04:56 | 只看该作者
所以这是什么效果?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
112
在线时间
376 小时
注册时间
2015-1-26
帖子
203
3
发表于 2016-7-28 19:01:36 | 只看该作者
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1001
在线时间
212 小时
注册时间
2011-11-23
帖子
109
4
 楼主| 发表于 2016-8-3 09:43:11 | 只看该作者
raketenfaust02 发表于 2016-7-28 19:01
https://rpgmakermv.co/resources/dark-room-covers.623/

我想你要的应该是这个

话说能否帮忙下载下来,我这边网速简直没法用{:2_264:}好像还要注册
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
112
在线时间
376 小时
注册时间
2015-1-26
帖子
203
5
发表于 2016-8-3 11:44:39 | 只看该作者
rkjspb 发表于 2016-8-3 09:43
话说能否帮忙下载下来,我这边网速简直没法用好像还要注册
  1. //=============================================================================
  2. // MrTS_DarkRoomCovers.js
  3. //=============================================================================

  4. /*:
  5. * @plugindesc Hides or reveals regions.
  6. * @author Mr. Trivel
  7. *
  8. * @param Tile Size
  9. * @desc How big are map tiles? X Y
  10. * Default: 48 48
  11. * @default 48 48
  12. *
  13. * @help
  14. * --------------------------------------------------------------------------------
  15. * Terms of Use
  16. * --------------------------------------------------------------------------------
  17. * Don't remove the header or claim that you wrote this plugin.
  18. * Credit Mr. Trivel if using this plugin in your project.
  19. * Free for non-commercial projects.
  20. * For commercial use contact Mr. Trivel.
  21. * --------------------------------------------------------------------------------
  22. * Version 1.1
  23. * --------------------------------------------------------------------------------
  24. *
  25. * --------------------------------------------------------------------------------
  26. * Map Property Tags
  27. * --------------------------------------------------------------------------------
  28. *
  29. * --------------------------------------------------------------------------------
  30. *
  31. * --------------------------------------------------------------------------------
  32. * Plugin Commands
  33. * --------------------------------------------------------------------------------
  34. * RegionReveal [ID] - Reveals tiles of specific region
  35. * RegionHide [ID] - Hides tiles of specific region
  36. * RegionReset - Resets all open regions
  37. * --------------------------------------------------------------------------------
  38. *
  39. * --------------------------------------------------------------------------------
  40. * Version History
  41. * --------------------------------------------------------------------------------
  42. * 1.1 - Performance issues fixed, code cleanup
  43. * 1.0 - Release
  44. */

  45. (function() {
  46.         var parameters = PluginManager.parameters('MrTS_DarkRoomCovers');
  47.         var paramTileSize = String(parameters['Tile Size'] || "48 48").split(' ');
  48.         var tileSizeX = Number(paramTileSize[0]);
  49.         var tileSizeY = Number(paramTileSize[1]);

  50.         //--------------------------------------------------------------------------
  51.         // Game_Interpreter
  52.         //
  53.        
  54.         var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  55.         Game_Interpreter.prototype.pluginCommand = function(command, args) {
  56.                 _Game_Interpreter_pluginCommand.call(this, command, args);
  57.                 if (command.toLowerCase() === "regionreveal") {
  58.                         $gameMap.addToCurrentlyOpenRegions(Number(args[0]));
  59.                 } else if (command.toLowerCase() === "regionhide") {
  60.                         $gameMap.removeFromCurrentlyOpenRegions(Number(args[0]));
  61.                 } else if (command.toLowerCase() === "regionreset") {
  62.                         $gameMap.resetCurrentlyOpenRegions();
  63.                 }
  64.         };

  65.         //----------------------------------------------------------------------------
  66.         // Game_Map
  67.         //
  68.        
  69.         // currentlyOpenRegions
  70.         Game_Map.prototype.currentlyOpenRegions = function() {
  71.                 if (!this._openRegionIds) this._openRegionIds = [0];
  72.                 return this._openRegionIds;
  73.         };

  74.         Game_Map.prototype.addToCurrentlyOpenRegions = function(id) {
  75.                 if (!this._openRegionIds) this._openRegionIds = [0];
  76.                 if (!this._openRegionIds.contains(id)) this._openRegionIds.push(id);
  77.         };

  78.         Game_Map.prototype.removeFromCurrentlyOpenRegions = function(id) {
  79.                 if (!this._openRegionIds) return;
  80.                 this._openRegionIds.splice(this._openRegionIds.indexOf(id), 1);
  81.         };

  82.         Game_Map.prototype.resetCurrentlyOpenRegions = function() {
  83.                 this._openRegionIds = [0];
  84.         };

  85.         //----------------------------------------------------------------------------
  86.         // Scene_Map
  87.         //

  88.         var _SceneMap_createDisplayObjects = Scene_Map.prototype.createDisplayObjects;
  89.         Scene_Map.prototype.createDisplayObjects = function() {
  90.                 _SceneMap_createDisplayObjects.call(this);
  91.                 this.createDarkCover();
  92.         };

  93.         Scene_Map.prototype.createDarkCover = function() {
  94.                 this._darkCover = new Spriteset_DarkCover();
  95.                 this._spriteset.addChild(this._darkCover);
  96.         };

  97.         //--------------------------------------------------------------------------
  98.         // Spriteset_DarkCover
  99.         //
  100.         // Covers regions with dark dark darkness.
  101.        
  102.         function Spriteset_DarkCover() {
  103.                 this.initialize.apply(this, arguments);       
  104.         };
  105.        
  106.         Spriteset_DarkCover.prototype = Object.create(Sprite.prototype);
  107.         Spriteset_DarkCover.prototype.constructor = Spriteset_DarkCover;
  108.        
  109.         Spriteset_DarkCover.prototype.initialize = function() {
  110.                 Sprite.prototype.initialize.call(this);
  111.                 this.setFrame(0, 0, Graphics.width, Graphics.height);
  112.                 this._tone = [0, 0, 0, 0];
  113.                 this.opaque = true;
  114.                 this._darkCovers = [];
  115.                 this._displayX = 0;
  116.                 this._displayY = 0;
  117.                 this._regions = $gameMap.currentlyOpenRegions().clone();
  118.                 this.createDarkCovers();
  119.                 this.update();
  120.         };

  121.         Spriteset_DarkCover.prototype.createDarkCovers = function() {
  122.                 var bitmap = new Bitmap(tileSizeX, tileSizeY);
  123.                 bitmap.fillAll('#000000');
  124.                 for (var j = -1; j < Math.ceil(Graphics.boxHeight/tileSizeY)+2; j++) {
  125.                         this._darkCovers.push([]);
  126.                         for (var i = -1; i < Math.ceil(Graphics.boxWidth/tileSizeX)+2; i++) {
  127.                                 var cover = new Sprite(bitmap);
  128.                                 cover.x = i * tileSizeX;
  129.                                 cover.y = j * tileSizeY;
  130.                                 var regionId = $gameMap.regionId(i+this._displayX, j+this._displayY);
  131.                                 cover.visible = !(this._regions.contains(regionId));
  132.                                 this._darkCovers[j+1].push(cover);
  133.                                 this.addChild(cover);
  134.                         }
  135.                 }
  136.         };

  137.         Spriteset_DarkCover.prototype.update = function() {
  138.                 Sprite.prototype.update.call(this);
  139.                 this.x = (-$gameMap.displayX() + Math.floor($gameMap.displayX())) * tileSizeX;
  140.                 this.y = (-$gameMap.displayY() + Math.floor($gameMap.displayY())) * tileSizeY;
  141.                 if (Math.floor($gameMap.displayX()) !== this._displayX ||
  142.                         Math.floor($gameMap.displayY()) !== this._displayY ||
  143.                         !$gameMap.currentlyOpenRegions().equals(this._regions))
  144.                 {
  145.                         this._displayX = Math.floor($gameMap.displayX());
  146.                         this._displayY = Math.floor($gameMap.displayY());
  147.                         this._regions = $gameMap.currentlyOpenRegions().clone();
  148.                         for (var j = -1; j < Math.ceil(Graphics.boxHeight/tileSizeY)+2; j++) {
  149.                                 for (var i = -1; i < Math.ceil(Graphics.boxWidth/tileSizeX)+2; i++) {
  150.                                         var regionId = $gameMap.regionId(i+this._displayX, j+this._displayY);
  151.                                         this._darkCovers[j+1][i+1].visible = !(this._regions.contains(regionId));
  152.                                 }
  153.                         }
  154.                 }
  155.         };
  156. })();
复制代码
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-4-28 15:13

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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