Project1

标题: 新·地图名显示+地图提示[高手请无视][更新2.0] [打印本页]

作者: 304475881    时间: 2008-2-22 01:52
标题: 新·地图名显示+地图提示[高手请无视][更新2.0]
如题教程如下[如果不想看教程的话就直接到最下面看完成了的脚本]:
首先打好框子:
  #-----------------------------------------------------------------------------
  # ● 关于地图名称
  #-----------------------------------------------------------------------------
  def dtmxs
  end
  #-----------------------------------------------------------------------------
  # ● 关于地图提示
  #-----------------------------------------------------------------------------
  def dtts
  end
然后定义函数:
  #-----------------------------------------------------------------------------
  # ● 关于地图名称
  #-----------------------------------------------------------------------------
  def dtmxs(pe)
  end
  #-----------------------------------------------------------------------------
  # ● 关于地图提示
  #-----------------------------------------------------------------------------
  def dtts(pe)
  end
再借用一下黑暗圣剑2里的成就脚本:
  #-----------------------------------------------------------------------------
  # ● 关于地图名称
  #-----------------------------------------------------------------------------
  def dtmxs(pe)
    return if @chengjiu_list.include?(id)
    @chengjiu += @cj_hash[id][0]
    @chengjiu_list.push(@cj_hash[id])
    sprite = Sprite_Base.new
    sprite.bitmap = Bitmap.new(Graphics.width, 32)
    sprite.bitmap.fill_rect(sprite.bitmap.rect,
    Color.new(0, 0, 0, 128))
    sprite.bitmap.draw_text(0, 0, Graphics.width , 32,
    "★ 解锁新的成就:#{@cj_hash[id][1]} ★", 1)
    Sound.play_chengjiu
    sprite.x = 0
    sprite.y = Graphics.height - 72
    $sprite_helper.push([sprite, 240, 4])
  end
  #-----------------------------------------------------------------------------
  # ● 关于地图提示
  #-----------------------------------------------------------------------------
  def dtts(pe)
    return if @chengjiu_list.include?(id)
    @chengjiu += @cj_hash[id][0]
    @chengjiu_list.push(@cj_hash[id])
    sprite = Sprite_Base.new
    sprite.bitmap = Bitmap.new(Graphics.width, 32)
    sprite.bitmap.fill_rect(sprite.bitmap.rect,
    Color.new(0, 0, 0, 128))
    sprite.bitmap.draw_text(0, 0, Graphics.width , 32,
    "★ 解锁新的成就:#{@cj_hash[id][1]} ★", 1)
    Sound.play_chengjiu
    sprite.x = 0
    sprite.y = Graphics.height - 72
    $sprite_helper.push([sprite, 240, 4])
  end
最后优化:
  #-----------------------------------------------------------------------------
  # ● 关于使用方法
  #-----------------------------------------------------------------------------
  #dtmxs("我是地图名")
  #dtts("我是地图提示")
  #-----------------------------------------------------------------------------
  # ● 关于地图名称
  #-----------------------------------------------------------------------------
  def dtmxs(pe)
    $mc = pe
    sprite = Sprite_Base.new
    sprite.bitmap = Bitmap.new(Graphics.width, 32)
    sprite.bitmap.fill_rect(sprite.bitmap.rect,
    Color.new(0, 0, 0, 128))
    sprite.bitmap.draw_text(0, 0, Graphics.width , 32,
    "★ 新地图的名称:#{$mc} ★", 1)
    Audio.se_play("Audio/SE/chime2" , 100, 100)
    sprite.x = 0
    sprite.y = 0
  end
  #-----------------------------------------------------------------------------
  # ● 关于地图提示
  #-----------------------------------------------------------------------------
  def dtts(pe)
    $ts = pe
    sprite = Sprite_Base.new
    sprite.bitmap = Bitmap.new(Graphics.width, 32)
    sprite.bitmap.fill_rect(sprite.bitmap.rect,
    Color.new(0, 0, 0, 128))
    sprite.bitmap.draw_text(0, 0, Graphics.width , 32,
    "★ 新地图的提示:#{$ts} ★", 1)
    Audio.se_play("Audio/SE/chime2" , 100, 100)
    sprite.x = 0
    sprite.y = 32
  end
再优化:
  #-----------------------------------------------------------------------------
  # ● 关于使用
  #-----------------------------------------------------------------------------
  #◆条件分歧:$mc == "显示"
  #  ◆中断事件处理
  #  ◆
  #  除此以外的情况
  #  ◆脚本:dtmxs("显示")
  #  :    :dtts("这里写提示")
  #  ◆等待:1帧
  #  分歧结束
  #◆
  #移动的时候在移动前要加一句脚本:$mc = "不显示"
  #-----------------------------------------------------------------------------
  # ● 关于地图名称
  #-----------------------------------------------------------------------------
  def dtmxs(pe)
    $mc = pe
    if $mc == "显示"
      sprite = Sprite_Base.new
      sprite.bitmap = Bitmap.new(Graphics.width, 32)
      sprite.bitmap.fill_rect(sprite.bitmap.rect,
      Color.new(0, 0, 0, 128))
      $maps = load_data("Data/MapInfos.rvdata")
      @map_id = $game_map.map_id
      $currentmap = $maps[@map_id].name
      sprite.bitmap.draw_text(0, 0, Graphics.width , 32,
      "★ 新地图的名称:#{$currentmap} ★", 1)
      Audio.se_play("Audio/SE/chime2" , 100, 100)
      sprite.x = 0
      sprite.y = 0
    end
  end
  #-----------------------------------------------------------------------------
  # ● 关于地图提示
  #-----------------------------------------------------------------------------
  def dtts(pe)
    $ts = pe
    sprite = Sprite_Base.new
    sprite.bitmap = Bitmap.new(Graphics.width, 32)
    sprite.bitmap.fill_rect(sprite.bitmap.rect,
    Color.new(0, 0, 0, 128))
    sprite.bitmap.draw_text(0, 0, Graphics.width , 32,
    "★ 新地图的提示:#{$ts} ★", 1)
    Audio.se_play("Audio/SE/chime2" , 100, 100)
    sprite.x = 0
    sprite.y = 32
  end
好此教学到此未知,初次写这个还不太熟练,请大家多多体谅………………
以下1.5脚本:
  1.   #-----------------------------------------------------------------------------
  2.   # ● 关于使用方法
  3.   #-----------------------------------------------------------------------------
  4.   #dtmxs("我是地图名")
  5.   #dtts("我是地图提示")
  6.   #-----------------------------------------------------------------------------
  7.   # ● 关于地图名称
  8.   #-----------------------------------------------------------------------------
  9.   def dtmxs(pe)
  10.     $mc = pe
  11.     sprite = Sprite_Base.new
  12.     sprite.bitmap = Bitmap.new(Graphics.width, 32)
  13.     sprite.bitmap.fill_rect(sprite.bitmap.rect,
  14.     Color.new(0, 0, 0, 128))
  15.     sprite.bitmap.draw_text(0, 0, Graphics.width , 32,
  16.     "★ 新地图的名称:#{$mc} ★", 1)
  17.     Audio.se_play("Audio/SE/chime2" , 100, 100)
  18.     sprite.x = 0
  19.     sprite.y = 0
  20.   end
  21.   #-----------------------------------------------------------------------------
  22.   # ● 关于地图提示
  23.   #-----------------------------------------------------------------------------
  24.   def dtts(pe)
  25.     $ts = pe
  26.     sprite = Sprite_Base.new
  27.     sprite.bitmap = Bitmap.new(Graphics.width, 32)
  28.     sprite.bitmap.fill_rect(sprite.bitmap.rect,
  29.     Color.new(0, 0, 0, 128))
  30.     sprite.bitmap.draw_text(0, 0, Graphics.width , 32,
  31.     "★ 新地图的提示:#{$ts} ★", 1)
  32.     Audio.se_play("Audio/SE/chime2" , 100, 100)
  33.     sprite.x = 0
  34.     sprite.y = 32
  35.   end
复制代码

以下2.0脚本:
  1.   #-----------------------------------------------------------------------------
  2.   # ● 关于使用
  3.   #-----------------------------------------------------------------------------
  4.   #◆条件分歧:$mc == "显示"
  5.   #  ◆中断事件处理
  6.   #  ◆
  7.   #  除此以外的情况
  8.   #  ◆脚本:dtmxs("显示")
  9.   #  :    :dtts("这里写提示")
  10.   #  ◆等待:1帧
  11.   #  分歧结束
  12.   #◆
  13.   #移动的时候在移动前要加一句脚本:$mc = "不显示"
  14.   #-----------------------------------------------------------------------------
  15.   # ● 关于地图名称
  16.   #-----------------------------------------------------------------------------
  17.   def dtmxs(pe)
  18.     $mc = pe
  19.     if $mc == "显示"
  20.       sprite = Sprite_Base.new
  21.       sprite.bitmap = Bitmap.new(Graphics.width, 32)
  22.       sprite.bitmap.fill_rect(sprite.bitmap.rect,
  23.       Color.new(0, 0, 0, 128))
  24.       $maps = load_data("Data/MapInfos.rvdata")
  25.       @map_id = $game_map.map_id
  26.       $currentmap = $maps[@map_id].name
  27.       sprite.bitmap.draw_text(0, 0, Graphics.width , 32,
  28.       "★ 新地图的名称:#{$currentmap} ★", 1)
  29.       Audio.se_play("Audio/SE/chime2" , 100, 100)
  30.       sprite.x = 0
  31.       sprite.y = 0
  32.     end
  33.   end
  34.   #-----------------------------------------------------------------------------
  35.   # ● 关于地图提示
  36.   #-----------------------------------------------------------------------------
  37.   def dtts(pe)
  38.     $ts = pe
  39.     sprite = Sprite_Base.new
  40.     sprite.bitmap = Bitmap.new(Graphics.width, 32)
  41.     sprite.bitmap.fill_rect(sprite.bitmap.rect,
  42.     Color.new(0, 0, 0, 128))
  43.     sprite.bitmap.draw_text(0, 0, Graphics.width , 32,
  44.     "★ 新地图的提示:#{$ts} ★", 1)
  45.     Audio.se_play("Audio/SE/chime2" , 100, 100)
  46.     sprite.x = 0
  47.     sprite.y = 32
  48.   end
复制代码

作者: 雪流星    时间: 2008-2-22 09:09
话说……

这根本算不上教学{/gg}

根本就只是「借用」别人的脚本而已






欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1