查看: 10700|回复: 26

[原创发布] 全新傻瓜式任务系统

[复制链接]

薄凉看客

梦石
0
星屑
50
在线时间
1269 小时
注册时间
2010-6-20
回帖
1223
发表于 2013-8-7 10:56:38 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 恋′挂机 于 2013-8-15 16:45 编辑

升级版
先看截图


4.jpg
5.jpg
6.jpg
1.jpg
2.jpg
3.jpg


代码


[pre lang="ruby" line="1"]#==============================================================================
# ■ Window_Command    显示任务帮助窗口的类。
#------------------------------------------------------------------------------
#   脚本作者:薄凉看客,转载或使用请保留此信息。
#==============================================================================
class Window_Command
  def update_help
    case self.index
    when 0
      help = ""
    when 1
      help = ""
    when 2
      help = ""
    end
    @help_window.set_text(help)
  end
end  [/pre]
[pre lang="ruby" line="1"]#==============================================================================
# ■ Window_Helprw    显示任务帮助窗口的类。
#------------------------------------------------------------------------------
#   脚本作者:薄凉看客,转载或使用请保留此信息。
#==============================================================================
class Window_Helprw < Window_Base
  def initialize
    super(320, 50, 300, 380)
    self.opacity = 0
    self.contents = Bitmap.new(width - 32, height - 32)
  end
  def set_text(text, item = "", align = 0)
    if text != @text or align != @align or item != @item
      self.contents.clear
      self.contents.font.color = system_color
      self.contents.font.size = 13
      self.contents.draw_text(68, -2, self.width - 40, 32, "任务描述")
      self.contents.draw_text(68, -2 + 113, self.width - 40, 32, "任务目标")
      self.contents.draw_text(68, -2 + 226, self.width - 40, 32, "任务奖励")
      if item == "" and text == ""
      self.contents.font.color = Color.new(255, 120, 120, 255)
      xx = "未选中任务,或没有领取任"
      self.contents.draw_text(15, 20, self.width - 40, 32, xx, align)
      xx = "务没有相关描绘。"
      self.contents.draw_text(15, 40, self.width - 40, 32, xx, align)
      xx = "未选中任务,或没有领取任"      
      self.contents.draw_text(15, 111 + 22, self.width - 40, 32, xx, align)
      xx = "务没有相关描绘。"
      self.contents.draw_text(15, 111 + 42, self.width - 40, 32, xx, align)
      xx = "未选中任务,或没有领取任"
      self.contents.draw_text(15, 224 + 20, self.width - 40, 32, xx, align)
      xx = "务没有相关描绘。"
      self.contents.draw_text(15, 224 + 40, self.width - 40, 32, xx, align)
      end
      self.contents.font.color = normal_color
      self.contents.font.size = 15
      if item != ""
      case item.name
      when "一夫当关"
      xx = "乱童山麓一行与树精"
      self.contents.draw_text(27, 20, self.width - 40, 32, xx, align)
      xx = "一战险些丢了命!虽"
      self.contents.draw_text(27, 40, self.width - 40, 32, xx, align)
      xx = "胜却也是惨胜,努力"
      self.contents.draw_text(27, 60, self.width - 40, 32, xx, align)
      xx = "修炼,方能未雨绸缪。"
      self.contents.draw_text(27, 80, self.width - 40, 32, xx, align)
      xx = "帕吉尔等级达到30级"
      self.contents.draw_text(27, 111 + 22, self.width - 40, 32, xx, align)
      self.contents.font.color = Color.new(120, 255, 120, 255)
      xx = "完成情况:"
      self.contents.draw_text(27, 111 + 42, self.width - 40, 32, xx, align)
      if $game_party.actors[1].level < 30
      self.contents.font.color = Color.new(255, 120, 120, 255)
      xx = "(未达成)"
      else
      self.contents.font.color = Color.new(120, 255, 120, 255)
      xx = "(已达成)"
      end
      self.contents.draw_text(100, 111 + 42, self.width - 40, 32, xx, align)      
      self.contents.font.color = normal_color
      xx = "当前等级:"
      self.contents.draw_text(27, 111 + 62, self.width - 40, 32, xx, align)
      self.contents.font.color = Color.new(120, 255, 120, 255)
      actor = $game_party.actors[1]
      xx = actor.level.to_s
      self.contents.draw_text(100, 111 + 62, self.width - 40, 32, xx, align)
      self.contents.font.color = normal_color
      xx = "目标等级:"
      self.contents.draw_text(27, 111 + 82, self.width - 40, 32, xx, align)  
      self.contents.font.color = Color.new(255, 120, 120, 255)
      xx = "30"
      self.contents.draw_text(100, 111 + 82, self.width - 40, 32, xx, align)
      self.contents.font.color = Color.new(120, 255, 120, 255)
      bitmap = RPG::Cache.icon("刀.png")
      self.contents.blt(15, 224 + 25, bitmap, Rect.new(0, 0, 24, 24))      
      xx = "云霄·寒光刀 × 1"
      self.contents.draw_text(45, 224 + 20, self.width - 40, 32, xx, align)
      bitmap = RPG::Cache.icon("剑.png")
      self.contents.blt(15, 224 + 45, bitmap, Rect.new(0, 0, 24, 24))
      self.contents.font.color = Color.new(255, 120, 120, 255)
      xx = "云霄·饮血剑 × 1"
      self.contents.draw_text(45, 224 + 40, self.width - 40, 32, xx, align)
      self.contents.font.color = Color.new(120, 120, 255, 255)
      bitmap = RPG::Cache.icon("棍.png")
      self.contents.blt(15, 224 + 65, bitmap, Rect.new(0, 0, 24, 24))      
      xx = "云霄·月魔棍 × 1"
      self.contents.draw_text(45, 224 + 60, self.width - 40, 32, xx, align)  
      self.contents.font.color = Color.new(255, 255, 64, 255)
      bitmap = RPG::Cache.icon("枪.png")
      self.contents.blt(15, 224 + 85, bitmap, Rect.new(0, 0, 24, 24))      
      xx = "云霄·青鳞枪 × 1"
      self.contents.draw_text(45, 224 + 80, self.width - 40, 32, xx, align)
      self.contents.font.color = Color.new(255, 120, 120, 255)
      self.contents.font.size = 10
      xx = "以上4种装备任选其一(要什么?要我?)"
      self.contents.draw_text(10, 224 + 95, self.width - 40, 32, xx, align)
      when "将魂"
      xx = "将军战死沙场,他的传"
      self.contents.draw_text(22, 20, self.width - 40, 32, xx, align)
      xx = "说被埋葬,沉睡了千年"
      self.contents.draw_text(22, 40, self.width - 40, 32, xx, align)      
      xx = "的将军魂被魔军唤醒。"
      self.contents.draw_text(22, 60, self.width - 40, 32, xx, align)
      xx = "勇士,快去阻止他吧!"
      self.contents.draw_text(22, 80, self.width - 40, 32, xx, align)   
      xx = "进入将军墓中,阻止魔"
      self.contents.draw_text(22, 111 + 22, self.width - 40, 32, xx, align)
      xx = "军的邪恶计划!"
      self.contents.draw_text(22, 111 + 42, self.width - 40, 32, xx, align)  
      self.contents.font.color = Color.new(120, 255, 120, 255)
      xx = "完成情况:"
      self.contents.draw_text(22, 111 + 62, self.width - 40, 32, xx, align)  
      self.contents.font.color = Color.new(255, 120, 120, 255)
      #这里直接是未完成,其实写的时候,可以分歧一个开关
      xx = "(未完成)"
      self.contents.draw_text(100, 111 + 62, self.width - 40, 32, xx, align)
      self.contents.font.color = Color.new(255, 255, 64, 255)
      #这里直接是未完成,其实写的时候,可以分歧一个开关
      xx = "未打败,魔·将魂"
      self.contents.draw_text(22, 111 + 82, self.width - 40, 32, xx, align)
      bitmap = RPG::Cache.icon("书·桔色皮.png")
      self.contents.blt(10, 224 + 25, bitmap, Rect.new(0, 0, 24, 24))      
      xx = "战法·围魏救赵 × 1"
      self.contents.font.color = Color.new(255, 255, 64, 255)
      self.contents.draw_text(35, 224 + 20, self.width - 40, 32, xx, align)  
      bitmap = RPG::Cache.icon("书·蓝皮.png")
      self.contents.blt(10, 224 + 45, bitmap, Rect.new(0, 0, 24, 24))      
      xx = "战法·火烧乌巢 × 1"
      self.contents.font.color = Color.new(120, 120, 255, 255)
      self.contents.draw_text(35, 224 + 40, self.width - 40, 32, xx, align)
      bitmap = RPG::Cache.icon("书·绿皮.png")
      self.contents.blt(10, 224 + 65, bitmap, Rect.new(0, 0, 24, 24))      
      xx = "战法·窃符救赵 × 1"
      self.contents.font.color = Color.new(120, 255, 120, 255)
      self.contents.draw_text(35, 224 + 60, self.width - 40, 32, xx, align)  
      bitmap = RPG::Cache.icon("书·紫皮.png")
      self.contents.blt(10, 224 + 85, bitmap, Rect.new(0, 0, 24, 24))      
      xx = "战法·草船借箭 × 1"
      self.contents.font.color = Color.new(255, 120, 120, 255)
      self.contents.draw_text(35, 224 + 80, self.width - 40, 32, xx, align)
      self.contents.font.size = 10
      xx = "以上4种战法任选其一(要什么?要我?)"
      self.contents.draw_text(10, 224 + 95, self.width - 40, 32, xx, align)   
      when "探索神秘之塔"
      xx = "小镇后山有一神秘塔。"
      self.contents.draw_text(22, 20, self.width - 40, 32, xx, align)
      xx = "就连当地人也从未进去"
      self.contents.draw_text(22, 40, self.width - 40, 32, xx, align)      
      xx = "过,最近在塔顶出现了"
      self.contents.draw_text(22, 60, self.width - 40, 32, xx, align)
      xx = "奇异的色彩,去看看吧!"
      self.contents.draw_text(22, 80, self.width - 40, 32, xx, align)   
      xx = "登上神秘塔塔顶,打败"
      self.contents.draw_text(22, 111 + 22, self.width - 40, 32, xx, align)
      xx = "精灵,拿到月华天石。"
      self.contents.draw_text(22, 111 + 42, self.width - 40, 32, xx, align)  
      self.contents.font.color = Color.new(120, 255, 120, 255)
      xx = "完成情况:"
      self.contents.draw_text(22, 111 + 62, self.width - 40, 32, xx, align)  
      self.contents.font.color = Color.new(255, 120, 120, 255)
      #这里直接是未完成,其实写的时候,可以分歧一个开关
      xx = "(未完成)"
      self.contents.draw_text(100, 111 + 62, self.width - 40, 32, xx, align)
      self.contents.font.color = Color.new(255, 255, 64, 255)
      #这里直接是未完成,其实写的时候,可以分歧一个开关
      xx = "未拿到月华天石"
      self.contents.draw_text(22, 111 + 82, self.width - 40, 32, xx, align)
      bitmap = RPG::Cache.icon("特殊魔石.png")
      self.contents.blt(10, 224 + 25, bitmap, Rect.new(0, 0, 24, 24))      
      xx = "魔石·莱西斯特 × 1"
      self.contents.font.color = Color.new(255, 255, 64, 255)
      self.contents.draw_text(35, 224 + 20, self.width - 40, 32, xx, align)  
      bitmap = RPG::Cache.icon("自动魔石.png")
      self.contents.blt(10, 224 + 45, bitmap, Rect.new(0, 0, 24, 24))      
      xx = "魔石·拉捷特斯 × 1"
      self.contents.font.color = Color.new(120, 120, 255, 255)
      self.contents.draw_text(35, 224 + 40, self.width - 40, 32, xx, align)
      bitmap = RPG::Cache.icon("技能魔石.png")
      self.contents.blt(10, 224 + 65, bitmap, Rect.new(0, 0, 24, 24))      
      xx = "魔石·新月之力 × 1"
      self.contents.font.color = Color.new(120, 255, 120, 255)
      self.contents.draw_text(35, 224 + 60, self.width - 40, 32, xx, align)  
      bitmap = RPG::Cache.icon("魔法魔石.png")
      self.contents.blt(10, 224 + 85, bitmap, Rect.new(0, 0, 24, 24))      
      xx = "魔石·菲布尔利 × 1"
      self.contents.font.color = Color.new(255, 120, 120, 255)
      self.contents.draw_text(35, 224 + 80, self.width - 40, 32, xx, align)
      self.contents.font.size = 10
      xx = "随机以上4种魔石,看你有没有RP拿了!"
      self.contents.draw_text(10, 224 + 95, self.width - 40, 32, xx, align)   
      when "索尔的委托"
      xx = "乱童山麓,索尔的妹妹"
      self.contents.draw_text(22, 20, self.width - 40, 32, xx, align)
      xx = "被魔蝎攻击,身中剧毒"
      self.contents.draw_text(22, 40, self.width - 40, 32, xx, align)      
      xx = "索尔自己要照看妹妹,"
      self.contents.draw_text(22, 60, self.width - 40, 32, xx, align)
      xx = "只好拜托你找解药了。"
      self.contents.draw_text(22, 80, self.width - 40, 32, xx, align)   
      xx = "找到解药:"
      self.contents.draw_text(22, 111 + 22, self.width - 40, 32, xx, align)
      xx = "九花玉露"
      self.contents.draw_text(22, 111 + 42, self.width - 40, 32, xx, align)  
      self.contents.font.color = Color.new(120, 255, 120, 255)
      xx = "完成情况:"
      self.contents.draw_text(22, 111 + 62, self.width - 40, 32, xx, align)  
      self.contents.font.color = Color.new(255, 120, 120, 255)
      #这里直接是未完成,其实写的时候,可以分歧一个开关
      xx = "(未完成)"
      self.contents.draw_text(100, 111 + 62, self.width - 40, 32, xx, align)
      self.contents.font.color = Color.new(255, 255, 64, 255)
      #这里直接是未完成,其实写的时候,可以分歧一个开关
      xx = "未拿到九花玉露"
      self.contents.draw_text(22, 111 + 82, self.width - 40, 32, xx, align)
      bitmap = RPG::Cache.icon("048-Skill05.png")
      self.contents.blt(10, 224 + 25, bitmap, Rect.new(0, 0, 24, 24))      
      xx = "EXP 上升 10000 点"
      self.contents.font.color = Color.new(255, 255, 64, 255)
      self.contents.draw_text(35, 224 + 20, self.width - 40, 32, xx, align)  
      bitmap = RPG::Cache.icon("048-Skill05.png")
      self.contents.blt(10, 224 + 45, bitmap, Rect.new(0, 0, 24, 24))      
      xx = "金钱 增加 10000"
      self.contents.font.color = Color.new(120, 120, 255, 255)
      self.contents.draw_text(35, 224 + 40, self.width - 40, 32, xx, align)
      when "习乐"
      xx = "音乐是最美妙的艺术!"
      self.contents.draw_text(22, 20, self.width - 40, 32, xx, align)
      xx = "人们在它的世界里陶醉!"
      self.contents.draw_text(22, 40, self.width - 40, 32, xx, align)      
      xx = "你与乐神仅一步之遥!"
      self.contents.draw_text(22, 60, self.width - 40, 32, xx, align)
      xx = "去追寻那天籁之音吧!"
      self.contents.draw_text(22, 80, self.width - 40, 32, xx, align)   
      xx = "向修道院中乐神习乐,"
      self.contents.draw_text(22, 111 + 22, self.width - 40, 32, xx, align)
      xx = "或者在菜单中学习乐。"
      self.contents.draw_text(22, 111 + 42, self.width - 40, 32, xx, align)  
      self.contents.font.color = Color.new(120, 255, 120, 255)
      xx = "完成情况:"
      self.contents.draw_text(22, 111 + 62, self.width - 40, 32, xx, align)  
      self.contents.font.color = Color.new(255, 120, 120, 255)
      #这里直接是未完成,其实写的时候,可以分歧一个开关
      xx = "(未完成)"
      self.contents.draw_text(100, 111 + 62, self.width - 40, 32, xx, align)
      self.contents.font.color = Color.new(255, 255, 64, 255)
      #这里直接是未完成,其实写的时候,可以分歧一个开关
      xx = "未学习乐"
      self.contents.draw_text(22, 111 + 82, self.width - 40, 32, xx, align)
      bitmap = RPG::Cache.icon("乐魂·Easy.png")
      self.contents.blt(10, 224 + 25, bitmap, Rect.new(0, 0, 24, 24))      
      xx = "乐魂·海之风暴 × 1"
      self.contents.font.color = Color.new(255, 255, 64, 255)
      self.contents.draw_text(35, 224 + 20, self.width - 40, 32, xx, align)  
      bitmap = RPG::Cache.icon("乐魂·Fever.png")
      self.contents.blt(10, 224 + 45, bitmap, Rect.new(0, 0, 24, 24))      
      xx = "乐魂·高斯模糊 × 1"
      self.contents.font.color = Color.new(120, 120, 255, 255)
      self.contents.draw_text(35, 224 + 40, self.width - 40, 32, xx, align)
      bitmap = RPG::Cache.icon("乐魂·Hard.png")
      self.contents.blt(10, 224 + 65, bitmap, Rect.new(0, 0, 24, 24))      
      xx = "乐魂·梦的预见 × 1"
      self.contents.font.color = Color.new(120, 255, 120, 255)
      self.contents.draw_text(35, 224 + 60, self.width - 40, 32, xx, align)  
      bitmap = RPG::Cache.icon("乐魂·Normal.png")
      self.contents.blt(10, 224 + 85, bitmap, Rect.new(0, 0, 24, 24))      
      xx = "乐魂·天空之城 × 1"
      self.contents.font.color = Color.new(255, 120, 120, 255)
      self.contents.draw_text(35, 224 + 80, self.width - 40, 32, xx, align)
      self.contents.font.size = 10
      xx = "乐等级达到5,即可得以上4种乐魂之一。"
      self.contents.draw_text(10, 224 + 95, self.width - 40, 32, xx, align)      
      end  
      end
      @text = text
      @item = item
      @align = align
      @actor = nil
    end
    self.visible = true
  end
end
[/pre]
[pre lang="ruby" line="1"]#==============================================================================
# ■ Window_Itemrw    显示任务列表窗口的类。
#------------------------------------------------------------------------------
#   脚本作者:薄凉看客,转载或使用请保留此信息。
#==============================================================================
class Window_Item < Window_Selectable
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        if $data_items.description != "主线任务" and
          $data_items.description != "支线任务" and
          $data_items.description != "日常任务"
        @data.push($data_items)
        end
      end
    end
    unless $game_temp.in_battle
      for i in 1...$data_weapons.size
        if $game_party.weapon_number(i) > 0
          @data.push($data_weapons)
        end
      end
      for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0
          @data.push($data_armors)
        end
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
end  
class Window_Itemrw < Window_Selectable
  def initialize
    super(107, 91, 210, 500)
    @column_max = 1
    refresh
    self.index = -1
  end
  def item
    return @data[self.index]
  end
  def refresh(kind = 0)
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    if kind == 0
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        if $data_items.description == "主线任务"
        @data.push($data_items)
        end
      end
    end
    elsif kind == 1
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        if $data_items.description == "支线任务"
        @data.push($data_items)
        end
      end
    end
    elsif kind == 2
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        if $data_items.description == "日常任务"
        @data.push($data_items)
        end
      end
    end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 38)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    end
    x = index % 1 * (150 + 32) + 10
    y = index / 1 * 38
    self.contents.font.size = 15
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  end
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description,
    self.item == nil ? "" : @data[index])
  end
  def update_cursor_rect
  self.cursor_rect.empty
  end  
end
[/pre]
[pre lang="ruby" line="1"]#==============================================================================
# ■ Blkk_rw    显示任务场景的类。
#------------------------------------------------------------------------------
#   脚本作者:薄凉看客,转载或使用请保留此信息。
#==============================================================================
class Blkk_rw
  def initialize(index = 0)
    @index = index
  end
  def main
    xx = Spriteset_Map.new
    blkk = []
    blkk[15] = 0
    @command_window = Window_Command.new(210, [
    "", "", ""], blkk)
    @command_window.index = @index
    @command_window.visible = false
    @help_window = Window_Helprw.new
    @item_window = Window_Itemrw.new
    @item_window.active = false
    @item_window.opacity = 0
    @command_window.help_window = @help_window
    @item_window.help_window = @help_window
    picture = Sprite.new
    picture.bitmap = Bitmap.new("Graphics/Pictures/任务背景图.png")
    picture.x -= 18
    @picture2 = Sprite.new
    @picture2.bitmap = Bitmap.new("Graphics/Pictures/主线任务.png")
    @picture2.x -= 18
    @picture3 = Sprite.new
    @picture3.bitmap = Bitmap.new("Graphics/Pictures/支线任务.png")
    @picture3.x -= 18
    @picture3.opacity = 0
    @picture4 = Sprite.new
    @picture4.bitmap = Bitmap.new("Graphics/Pictures/日常任务.png")
    @picture4.x -= 18
    @picture4.opacity = 0
    @arrow = Sprite.new
    @arrow.bitmap = Bitmap.new("Graphics/Pictures/arrow4.png")
    @arrow.x = 100
    @arrow.y = 106
    @arrow.opacity = 0
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    xx.dispose
    picture.dispose
    @picture2.dispose
    @picture3.dispose
    @picture4.dispose
    @arrow.dispose
    @help_window.dispose
    @item_window.dispose
  end
  def update
    @command_window.update
    @help_window.update
    @item_window.update
    @item_window.refresh(@command_window.index)
    case @command_window.index
    when 0
      @picture2.opacity = 255
      @picture3.opacity = 0
      @picture4.opacity = 0
    when 1
      @picture2.opacity = 0
      @picture3.opacity = 255
      @picture4.opacity = 0
    when 2
      @picture2.opacity = 0
      @picture3.opacity = 0
      @picture4.opacity = 255
    end
    case @item_window.index
    when -1
      @arrow.opacity = 0
    when 0
      @arrow.y = 106
      @arrow.opacity = 255
    when 1
      @arrow.y = 106 + 38
      @arrow.opacity = 255
    when 2
      @arrow.y = 106 + 38 * 2
      @arrow.opacity = 255
    when 3
      @arrow.y = 106 + 38 * 3
      @arrow.opacity = 255
    when 4
      @arrow.y = 106 + 38 * 4
      @arrow.opacity = 255
    when 5
      @arrow.y = 106 + 38 * 5
      @arrow.opacity = 255
    when 6
      @arrow.y = 106 + 38 * 6
      @arrow.opacity = 255      
    end  
    if @command_window.active
      update_command
      return
    end
    if @item_window.active
      update_item
      return
    end   
  end
  def update_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      case @command_window.index
      when 0
        @command_window.active = false
        @item_window.active = true
        @item_window.index = 0
     when 1
        @command_window.active = false
        @item_window.active = true
        @item_window.index = 0
      when 2
        @command_window.active = false
        @item_window.active = true
        @item_window.index = 0
      end
      return
    end  
  end
  def update_item
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @item_window.active = false
      @command_window.active = true
      @item_window.index = -1
      return
    end
  end
end[/pre]


赠送:超级命令窗体脚本


[pre lang="ruby" line="1"]#==============================================================================
# ■ Window_Command    超级命令窗体的类。
#------------------------------------------------------------------------------
#   脚本作者:薄凉看客,转载或使用请保留此信息。
#==============================================================================
=begin

在生成Command.new时后边可以有第三个参数——一个数组(另附加一个图标文件名数组)

数组详细说明(数组参数是非必须的,可有可无):
[0:列数, 1:X坐标, 2:Y坐标, 3:Z坐标, 4:未选中字体大小, 5:选中字体大小,
6:未选中字体时的颜色, 7:选中字体时的颜色, 8:未选中时的字体名, 9:选中时的字体名,
10:项目无效化时的字体名, 11:项目无效化1, 12:项目无效化2, 13:项目无效化3,
14:项目无效化4, 15:窗口的不透明度, 16:背景的不透明度, 17:内容的不透明度,
18:是否显示图标]
注:如果需要显示图标,需要再加一个数组参数(非必须)来指定图标文件名(
当然也可以使用默认图标,数组内指定的图标会按012345的顺序依次显示,而
且不管你有几个选项,你都必须指定6个图标名,否则按默认处理)。

举个例子:

#---------把Scene_Menu的26行脚本替换为以下内容,就能看到效果---------

array_menu = []
array_menu[0] = 6#让选择项横着选
array_menu[1] = 0#修改命令窗体的X坐标
array_menu[2] = 100#修改命令窗体的Y坐标为100
array_menu[4] = 15#修改命令窗体未选中时的字体大小为15
array_menu[5] = 22#修改命令窗体选中时的字体大小为22
array_menu[3] = 500#修改Z坐标,保证命令窗体显示在最上方
array_menu[11] = 5#让5号选择项(即结束)无效化
array_menu[15] = 150#修改窗体的不透明度
array_menu[16] = 150#修改背景的不透明度
array_menu[17] = 150#修改内容的不透明度
array_menu[18] = true#给命令窗体显示上图标
icon_commands = ["041-Item10.png", "050-Skill07.png",
"019-Accessory04.png", "045-Skill02.png", "036-Item05.png",
"046-Skill03.png"]#这是指定图标文件名
mmand_window = Window_Command.new(640, [s1, s2, s3, s4, s5, s6],
array_menu, icon_commands)

#---------把Scene_Menu的26行脚本替换为以上内容,就能看到效果---------

=end
class Window_Command < Window_Selectable
  def initialize(width, command, commands = [], icon_commands = 0)
    if icon_commands = 0 or icon_commands.class != Array
      icon_commands = ["041-Item10.png", "050-Skill07.png",
      "019-Accessory04.png", "045-Skill02.png", "036-Item05.png",
      "046-Skill03.png"]
    elsif icon_commands.class == Array and (icon_commands[0] == nil or
      icon_commands[1] == nil or icon_commands[2] == nil or
      icon_commands[3] == nil or icon_commands[4] == nil or
      icon_commands[5] == nil)
      icon_commands = ["041-Item10.png", "050-Skill07.png",
      "019-Accessory04.png", "045-Skill02.png", "036-Item05.png",
      "046-Skill03.png"]
    end  
    if commands.class != Array
      commands = []
    end  
    if commands[0] == 1 or commands[0] == nil
      if commands[1] == nil and commands[2] != nil
      super(0, commands[2], width, command.size * 32 + 32)
      elsif commands[1] != nil and commands[2] == nil
      super(commands[1], 0, width, command.size * 32 + 32)
      elsif commands[1] == nil and commands[2] == nil
      super(0, 0, width, command.size * 32 + 32)
      elsif commands[1] != nil and commands[2] != nil
      super(commands[1], commands[2], width, command.size * 32 + 32)      
      end
    else
      if commands[1] == nil and commands[2] != nil
      super(0, commands[2], width, 64)
      elsif commands[1] != nil and commands[2] == nil
      super(commands[1], 0, width, 64)
      elsif commands[1] == nil and commands[2] == nil
      super(0, 0, width, 64)
      elsif commands[1] != nil and commands[2] != nil
      super(commands[1], commands[2], width, 64)
      end
    end
    if commands[3] != nil
    self.z = commands[3]
    else
    self.z = 100
    end
    @command = command
    @item_max = @command.size
    if commands[0] != nil
    @column_max = commands[0]
    else
    @column_max = 1
    end
    if commands[4] != nil
    @size1 = commands[4]
    else
    @size1 = 22
    end
    if commands[5] != nil
    @size2 = commands[5]
    else
    @size2 = 22
    end
    if commands[6] != nil
    @color1 = commands[6]
    else
    @color1 = normal_color
    end
    if commands[7] != nil
    @color2 = commands[7]
    else
    @color2 = normal_color
    end
    if commands[8] != nil
    @name1 = commands[8]
    else
    @name1 = "黑体"
    end
    if commands[9] != nil
    @name2 = commands[9]
    else
    @name2 = "黑体"
    end
    if commands[10] != nil
    @name3 = commands[10]
    else
    @name3 = "黑体"
    end
    if commands[11] != nil
    @disable_item1 = commands[11]
    else
    @disable_item1 = -1
    end
    if commands[12] != nil
    @disable_item2 = commands[12]
    else
    @disable_item2 = -1
    end
    if commands[13] != nil
    @disable_item3 = commands[13]
    else
    @disable_item3 = -1
    end
    if commands[14] != nil
    @disable_item4 = commands[14]
    else
    @disable_item4 = -1
    end
    self.contents = Bitmap.new(width - 32, @item_max * 32)
    if commands[15] != nil and commands[15] >= 0 and commands[15] <= 255
      self.opacity = commands[15]
    else
      self.opacity = 255
    end  
    if commands[16] != nil and commands[16] >= 0 and commands[16] <= 255
      self.back_opacity = commands[16]
    else
      self.back_opacity = 255
    end
    if commands[17] != nil and commands[17] >= 0 and commands[17] <= 255
      self.contents_opacity = commands[17]
    else
      self.contents_opacity = 255
    end
    @icon_commands = icon_commands
    @commands = commands
    if @column_max != 1 and @commands[18] == true
    @x1 = 0 % @column_max * ((width - 32) / @column_max)
    @x2 = 1 % @column_max * ((width - 32) / @column_max + 5)
    @x3 = 2 % @column_max * ((width - 32) / @column_max + 5)
    @x4 = 3 % @column_max * ((width - 32) / @column_max + 5)
    @x5 = 4 % @column_max * ((width - 32) / @column_max + 5)
    @x6 = 5 % @column_max * ((width - 32) / @column_max + 5)
    end
    refresh
    self.index = 0
  end
  def refresh
    self.contents.clear
    if @column_max != 1 and @commands[18] == true
      case @item_max
      when 1
      bitmap = RPG::Cache.icon(@icon_commands[0])
      self.contents.blt(@x1, 4, bitmap, Rect.new(0, 0, 24, 24))
      when 2
      bitmap = RPG::Cache.icon(@icon_commands[0])
      self.contents.blt(@x1, 4, bitmap, Rect.new(0, 0, 24, 24))
      bitmap = RPG::Cache.icon(@icon_commands[1])
      self.contents.blt(@x2, 4, bitmap, Rect.new(0, 0, 24, 24))
      when 3
      bitmap = RPG::Cache.icon(@icon_commands[0])
      self.contents.blt(@x1, 4, bitmap, Rect.new(0, 0, 24, 24))
      bitmap = RPG::Cache.icon(@icon_commands[1])
      self.contents.blt(@x2, 4, bitmap, Rect.new(0, 0, 24, 24))
      bitmap = RPG::Cache.icon(@icon_commands[2])
      self.contents.blt(@x3, 4, bitmap, Rect.new(0, 0, 24, 24))
      when 4
      bitmap = RPG::Cache.icon(@icon_commands[0])
      self.contents.blt(@x1, 4, bitmap, Rect.new(0, 0, 24, 24))
      bitmap = RPG::Cache.icon(@icon_commands[1])
      self.contents.blt(@x2, 4, bitmap, Rect.new(0, 0, 24, 24))
      bitmap = RPG::Cache.icon(@icon_commands[2])
      self.contents.blt(@x3, 4, bitmap, Rect.new(0, 0, 24, 24))
      bitmap = RPG::Cache.icon(@icon_commands[3])
      self.contents.blt(@x4, 4, bitmap, Rect.new(0, 0, 24, 24))
      when 5
      bitmap = RPG::Cache.icon(@icon_commands[0])
      self.contents.blt(@x1, 4, bitmap, Rect.new(0, 0, 24, 24))
      bitmap = RPG::Cache.icon(@icon_commands[1])
      self.contents.blt(@x2, 4, bitmap, Rect.new(0, 0, 24, 24))
      bitmap = RPG::Cache.icon(@icon_commands[2])
      self.contents.blt(@x3, 4, bitmap, Rect.new(0, 0, 24, 24))
      bitmap = RPG::Cache.icon(@icon_commands[3])
      self.contents.blt(@x4, 4, bitmap, Rect.new(0, 0, 24, 24))
      bitmap = RPG::Cache.icon(@icon_commands[4])
      self.contents.blt(@x5, 4, bitmap, Rect.new(0, 0, 24, 24))
      when 6
      bitmap = RPG::Cache.icon(@icon_commands[0])
      self.contents.blt(@x1, 4, bitmap, Rect.new(0, 0, 24, 24))
      bitmap = RPG::Cache.icon(@icon_commands[1])
      self.contents.blt(@x2, 4, bitmap, Rect.new(0, 0, 24, 24))
      bitmap = RPG::Cache.icon(@icon_commands[2])
      self.contents.blt(@x3, 4, bitmap, Rect.new(0, 0, 24, 24))
      bitmap = RPG::Cache.icon(@icon_commands[3])
      self.contents.blt(@x4, 4, bitmap, Rect.new(0, 0, 24, 24))
      bitmap = RPG::Cache.icon(@icon_commands[4])
      self.contents.blt(@x5, 4, bitmap, Rect.new(0, 0, 24, 24))   
      bitmap = RPG::Cache.icon(@icon_commands[5])
      self.contents.blt(@x6, 4, bitmap, Rect.new(0, 0, 24, 24))
      end
    elsif @column_max == 1 and @commands[18] == true
      case @item_max
      when 1
      bitmap = RPG::Cache.icon(@icon_commands[0])
      self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24))
      when 2
      bitmap = RPG::Cache.icon(@icon_commands[0])
      self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24))      
      bitmap = RPG::Cache.icon(@icon_commands[1])
      self.contents.blt(0, 32 + 4, bitmap, Rect.new(0, 0, 24, 24))
      when 3
      bitmap = RPG::Cache.icon(@icon_commands[0])
      self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24))      
      bitmap = RPG::Cache.icon(@icon_commands[1])
      self.contents.blt(0, 32 + 4, bitmap, Rect.new(0, 0, 24, 24))
      bitmap = RPG::Cache.icon(@icon_commands[2])
      self.contents.blt(0, 64 + 4, bitmap, Rect.new(0, 0, 24, 24))
      when 4
      bitmap = RPG::Cache.icon(@icon_commands[0])
      self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24))      
      bitmap = RPG::Cache.icon(@icon_commands[1])
      self.contents.blt(0, 32 + 4, bitmap, Rect.new(0, 0, 24, 24))
      bitmap = RPG::Cache.icon(@icon_commands[2])
      self.contents.blt(0, 64 + 4, bitmap, Rect.new(0, 0, 24, 24))      
      bitmap = RPG::Cache.icon(@icon_commands[3])
      self.contents.blt(0, 64 + 32 + 4, bitmap, Rect.new(0, 0, 24, 24))
      when 5
      bitmap = RPG::Cache.icon(@icon_commands[0])
      self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24))      
      bitmap = RPG::Cache.icon(@icon_commands[1])
      self.contents.blt(0, 32 + 4, bitmap, Rect.new(0, 0, 24, 24))
      bitmap = RPG::Cache.icon(@icon_commands[2])
      self.contents.blt(0, 64 + 4, bitmap, Rect.new(0, 0, 24, 24))      
      bitmap = RPG::Cache.icon(@icon_commands[3])
      self.contents.blt(0, 64 + 32 + 4, bitmap, Rect.new(0, 0, 24, 24))      
      bitmap = RPG::Cache.icon(@icon_commands[4])
      self.contents.blt(0, 64 + 32 * 2 + 4, bitmap, Rect.new(0, 0, 24, 24))
      when 6
      bitmap = RPG::Cache.icon(@icon_commands[0])
      self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24))      
      bitmap = RPG::Cache.icon(@icon_commands[1])
      self.contents.blt(0, 32 + 4, bitmap, Rect.new(0, 0, 24, 24))
      bitmap = RPG::Cache.icon(@icon_commands[2])
      self.contents.blt(0, 64 + 4, bitmap, Rect.new(0, 0, 24, 24))      
      bitmap = RPG::Cache.icon(@icon_commands[3])
      self.contents.blt(0, 64 + 32 + 4, bitmap, Rect.new(0, 0, 24, 24))      
      bitmap = RPG::Cache.icon(@icon_commands[4])
      self.contents.blt(0, 64 + 32 * 2 + 4, bitmap, Rect.new(0, 0, 24, 24))      
      bitmap = RPG::Cache.icon(@icon_commands[5])
      self.contents.blt(0, 64 + 32 * 3 + 4, bitmap, Rect.new(0, 0, 24, 24))
      end
    end
    for i in 0...@item_max
      if i == self.index
        self.contents.font.name = @name2
        self.contents.font.color = @color2
        self.contents.font.size = @size2
        color = @color2
        name = @name2
      else
        self.contents.font.size = @size1
        self.contents.font.name = @name1
        self.contents.font.color = @color1
        color = @color1
        name = @name1
      end
      if i == @disable_item1 or i == @disable_item2 or i == @disable_item3 or
        i == @disable_item4
        color = disabled_color
        name = @name3
      end
      draw_item(i, color, name)
    end
  end
  def draw_item(index, color, name)
    self.contents.font.color = color
    self.contents.font.name = name
    if @commands[18] != true
     if @column_max == 1
     rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)  
     else  
     rect = Rect.new(index * width / @column_max + 12,
     0, self.contents.width - 8, 32)
     end
     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
     self.contents.draw_text(rect, @command[index])
     else
     if @column_max == 1
     self.contents.draw_text(4 + 20, 32 * index,
     self.contents.width - 8, 32, @command[index])
     else
     self.contents.draw_text(index * width / @column_max + 12 + 10, 0,
     self.contents.width - 8, 32, @command[index])
     end
    end
  end
  def disable_item(index)
  end
  def update_cursor_rect
    refresh
    super
  end
end[/pre]





范例中有非共享素材所以就没有范例了 - -!

点评

直接使用的话脚本会出错,因为论坛原因。出错解决办法在21楼。  发表于 2013-8-31 18:07

评分

参与人数 2星屑 +110 收起 理由
tjjlb + 100 精品文章
英顺的马甲 + 10 美工不错

查看全部评分

薄凉看客

梦石
0
星屑
50
在线时间
1269 小时
注册时间
2010-6-20
回帖
1223
 楼主| 发表于 2013-8-15 16:47:11 | 显示全部楼层
本帖最后由 恋′挂机 于 2013-8-15 16:58 编辑

更新自顶,来人啊,难道我做了个没人要的破玩意?

说明:
任务要在数据库和脚本中同时定义。
比如:
数据库中有这么一个物品:
物品名:某某任务
说明:主线任务
这样就可以了

在帮助脚本中,分歧了物品的名称
复制范例脚本(就是when "一夫当关"那段脚本)
改为 when "某某任务"
根据范例,修改自己的任务描述

还有这不仅仅只是任务系统,这种思路,还可以用来制作人物图鉴、怪物图鉴、装备合成、宝物合成等等。
看你是不是识马的伯乐了!
回复

使用道具 举报

梦石
0
星屑
65
在线时间
391 小时
注册时间
2012-5-5
回帖
185
发表于 2013-8-15 17:09:38 | 显示全部楼层
本帖最后由 my.0lantulantu0 于 2013-8-15 17:12 编辑

思路值得学习,但是代码好可怕啊……Ctrl_C+Ctrl_V来一行一行编辑self.contents真心的伤不起啊……{:2_264:}(话说Ruby主张简练啊……

点评

不知道为什么"\n"没效果...  发表于 2013-8-15 17:12
回复

使用道具 举报

梦石
0
星屑
803
在线时间
2068 小时
注册时间
2011-10-3
回帖
1620
发表于 2013-8-15 17:15:35 | 显示全部楼层
界面好赞!
回复

使用道具 举报

梦石
0
星屑
50
在线时间
24 小时
注册时间
2012-8-10
回帖
5
发表于 2013-8-17 12:14:06 | 显示全部楼层
可以不要脸的请求一个范例下载吗【住手
回复

使用道具 举报

路人党员

梦石
0
星屑
52
在线时间
2276 小时
注册时间
2010-12-30
回帖
3011
发表于 2013-8-20 21:05:00 | 显示全部楼层
楼主该考虑去学习一下字符串的处理了,
这种设置方法设置个十几个任务就已经累死了==
不过这美工真的很不错,先赞一个再说
本人擅长XP,如果有脚本或者Ruby方面的问题欢迎发电邮到engshun@1ppl.me咨询,本人很少检查电邮所以不一定会及时回复,本人不会直接出手解决问题只会提供一个方向,所以谢绝伸手党
回复

使用道具 举报

梦石
0
星屑
92
在线时间
468 小时
注册时间
2011-9-1
回帖
364
发表于 2013-8-21 15:58:21 | 显示全部楼层
求LZ发范列,发附件,我的脚本出错,而且不知道怎么用。=-=
男人不懂永远月经的痛,就像女人永远不懂蛋疼的痛
回复

使用道具 举报

梦石
0
星屑
9292
在线时间
2504 小时
注册时间
2011-5-20
回帖
14521

开拓者

发表于 2013-8-24 10:58:01 | 显示全部楼层
的确是傻瓜式···不过物品多的游戏不适合用这个= =会卡爆的
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复

使用道具 举报

梦石
0
星屑
138
在线时间
140 小时
注册时间
2012-7-25
回帖
328
发表于 2013-8-26 20:02:17 | 显示全部楼层
这个太高级了,咱用不上……
回复

使用道具 举报

梦石
0
星屑
1350
在线时间
275 小时
注册时间
2011-3-18
回帖
36
发表于 2013-8-26 20:47:17 | 显示全部楼层
界面漂亮……
但是手动换行 T T 不太给力啊
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部