66rpg吧 关注:5,756贴子:32,010
  • 2回复贴,共1

【66RPG旧内容】【制作教程】【在游戏中更改地图图块】

只看楼主收藏回复

在游戏中更改地图图块

原文:

This script restores yet another missing feature in RPG Maker XP relative to RPG Maker 2000 and 2003. This script allows you to change the tileset used by the current map. This is especially useful on maps that use multiple elevations, since you can change the tileset priorities as the player changes elevation. To use this script, add the variable declaration to Game_Map, as shown. Then, add the new method replace_tileset to Game_Map. Next, add the red text at the very beginning of the update method in Spriteset_Map. To change the tileset, use the "Script" command to call $game_map.replace_tileset(x), where x is the ID number of the new tileset, as shown in the database. See the image for an example. (他们是写在发布脚本的地方的,别晕- -)

简要翻译说明:

以下的脚本修改可以使你使用在RMXP中被去掉的一项RM2003的功能:更改地图图块。这个功能特别适用于RMXP自带素材中的 四大属性山洞(图块编号43-46),因为他们的规格、排列顺序完全相同,绘画好的地图可以仅仅更改一个图块而完全通用。

此外,还有一些适用场合,比如当上了飞空艇或者船之后,整个地图的通行设置会改变,也可以用这个制作。

内容:

打开脚本编辑器,找到Game_Map,红字部分是添加的

class Game_Map
  #——添加变量
  attr_accessor :new_tileset
  #——在setup里面添加一行内容
  def setup(map_id)
    @new_tileset = false
     [...(其他内容不用管他)]
  end
  #——添加下面的内容函数
  def replace_tileset(new_tiles)
    tileset = $data_tilesets[new_tiles]
    @tileset_name = tileset.tileset_name
    @autotile_names = tileset.autotile_names
    @panorama_name = tileset.panorama_name
    @panorama_hue = tileset.panorama_hue
    @fog_name = tileset.fog_name
    @fog_hue = tileset.fog_hue
    @fog_opacity = tileset.fog_opacity
    @fog_blend_type = tileset.fog_blend_type
    @fog_zoom = tileset.fog_zoom
    @fog_sx = tileset.fog_sx
    @fog_sy = tileset.fog_sy
    @battleback_name = tileset.battleback_name
    @passages = tileset.passages
    @priorities = tileset.priorities
    @terrain_tags = tileset.terrain_tags
    $game_map.new_tileset = true
  end
end
#——下面找到Spriteset_Map类,增加一些功能
class Spriteset_Map
  def update
  ##################################################################
  #——这一部分是添加的内容
  if $game_map.new_tileset == true
    @tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
    @tilemap.priorities = $game_map.priorities
    for i in 0..6
      autotile_name = $game_map.autotile_names[i]
      @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
    end
    $game_map.new_tileset = false
  end
  ##################################################################
  if @panorama_name != $game_map.panorama_name or
     @panorama_hue != $game_map.panorama_hue
    @panorama_name = $game_map.panorama_name
    @panorama_hue = $game_map.panorama_hue
  [...(后面不用改了)]

OK,这样,以后使用的时候,只要输入$game_map.replace_tileset(1)即可更改图块为1号。




1楼2005-10-03 01:44回复
    反捣乱…


    3楼2007-05-16 21:25
    回复
      上升~


      4楼2007-05-16 22:02
      回复