查看: 3009|回复: 1

[原创发布] 传授特技系统(我也来取个响亮的名字)

[复制链接]
梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

发表于 2016-3-16 00:04:02 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 yang1zhi 于 2016-3-18 23:27 编辑

在事件脚本里输入:$scene = Scene_jiaojineng_xuanren.new
我就是个新手,写的不好别介意。
从默认脚本复制修改而来。
1.png 2.png 3.png 4.png 5.png 6.png 7.png 8.png 9.png


脚本[pre lang="ruby"]################################################################################
#by 杨志
#########################################################################
#选人物
###########################################################################
class Scene_jiaojineng_xuanren
    def main
    #生成选择窗口
     @xuanzerw_window = Window_xuanren_jn.new
     @xuanzerw_window.index = 0
    # 执行过度
    Graphics.transition
    # 主循环
    loop do
      # 刷新游戏画面
      Graphics.update
      # 刷新输入信息
      Input.update
      # 刷新画面
      update
      # 如果画面切换就中断循环
      if $scene != self
        break
      end
    end
    # 装备过渡
    Graphics.freeze
    # 释放窗口
#    @screen.dispose
    @xuanzerw_window.dispose
  end
    #--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update
        guangbiao_shuaxin
    # 更新判断
      update_xuanzerw
   end
def update_xuanzerw
   if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 切换的地图画面
      $scene = Scene_Map.new
      return
    end

if Input.trigger?(Input::C)
   #传授技能的人带入变量
     $chuanjizhe = $game_party.actors[@xuanzerw_window.index].id
   $chuanjizhejnlb = $game_party.actors[@xuanzerw_window.index]

   $scene =  Scene_jiaojineng_xuanjineng.new
end
end
  def guangbiao_shuaxin
      # 光标右 (+1)
      if Input.trigger?(Input::UP)
        #播放SE
        $game_system.se_play($data_system.cursor_se)
        @xuanzerw_window.index -= 1
          @xuanzerw_window.index = $game_party.actors.size-1 if @xuanzerw_window.index < 0
       end
      # 光标左 (-1)
      if Input.trigger?(Input::DOWN)
        $game_system.se_play($data_system.cursor_se)
        @xuanzerw_window.index += 1
      @xuanzerw_window.index = 0 if @xuanzerw_window.index > $game_party.actors.size-1
     end
   end
end
##########################################################################
#选技能
#############################################################################
class Scene_jiaojineng_xuanjineng
      def main
    #生成选择窗口
     @chuanshouzhe_window = Window_jiaoshou_Skill.new(0, 0, 640, 480, $chuanjizhe)
     @chuanshouzhe_window.index = 0
    # 执行过度
    Graphics.transition
    # 主循环
    loop do
      # 刷新游戏画面
      Graphics.update
      # 刷新输入信息
      Input.update
      # 刷新画面
      update
      # 如果画面切换就中断循环
      if $scene != self
        break
      end
    end
    # 装备过渡
    Graphics.freeze
    # 释放窗口
#    @screen.dispose
    @chuanshouzhe_window.dispose
  end
  #########
  #刷新
  ############
def   update
  guangbiao_shuaxin
      # 更新判断
      update_xuanjineng
  
    end
    #选中技能判断
  def  update_xuanjineng
       if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 切换的选人画面
      $scene = Scene_jiaojineng_xuanren.new
      return
    end
if Input.trigger?(Input::C)
unless $jinengdata == []
   #选中的技能带入变量
   $beixuanjineng =  $jinengdata[@chuanshouzhe_window.index].id
   $scene = Scene_jiaojineng_erhaoxuanren.new
end
end
end

##########
#光标
#############
    def guangbiao_shuaxin
      # 光标右 (+1)
      if Input.trigger?(Input::UP)
        #播放SE
        $game_system.se_play($data_system.cursor_se)
        @chuanshouzhe_window.index -= 1
          @chuanshouzhe_window.index = $jinengdata.size-1 if @chuanshouzhe_window.index < 0
       end
      # 光标左 (-1)
      if Input.trigger?(Input::DOWN)
        $game_system.se_play($data_system.cursor_se)
        @chuanshouzhe_window.index += 1
      @chuanshouzhe_window.index = 0 if @chuanshouzhe_window.index > $jinengdata.size-1
     end
end
end
############################################################################
#人物列表窗
#############################################################################
class Window_xuanren_jn < Window_Selectable
  def initialize
    super(0, 0, 200, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    @xuanren_jns = []
    self.index = 0
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
        for i in 0..$game_party.actors.size-1
    @xuanren_jns =  $game_party.actors.name
     draw_xjn(i, normal_color)
   end
   end
      def draw_xjn(index, color)
    self.contents.font.color = color
    rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @xuanren_jns[index])
  end
end
############################################################################
#技能列表窗
#############################################################################
class Window_jiaoshou_Skill < Window_Selectable
    #--------------------------------------------------------------------------
  # ● 初始化对像
  #     x      : 窗口 X 座标
  #     y      : 窗口 Y 座标
  #     width  : 窗口宽度
  #     height : 窗口高度
  #     actor  : 角色
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height, actor)
    super(x, y, width, height)
    @actor = $game_party.actors[$chuanjizhe]
    @column_max = 1
    self.index = 0
    refresh
  end
  def skill
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    $jinengdata = []
       for id in $chuanjizhejnlb.skills

      $jinengdata.push($data_skills[id])
    end
    @jineng_max = $jinengdata.size
    if @jineng_max > 0
      self.contents = Bitmap.new(width - 32, @jineng_max * 32)
      for i in 0...@jineng_max
        draw_jineng(i)
      end
    end
  end
     def   draw_jineng(index)
#    self.contents.font.color = color
    rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, $jinengdata[index].name)
  end
end
#########################################################################
#选二号人物
###########################################################################
class Scene_jiaojineng_erhaoxuanren
      def main
    #生成选择窗口
     @xuanren_2hao_window = Window_xuanren_2hao.new
     @xuanren_2hao_window.index = 0
    # 执行过度
    Graphics.transition
    # 主循环
    loop do
      # 刷新游戏画面
      Graphics.update
      # 刷新输入信息
      Input.update
      # 刷新画面
      update
      # 如果画面切换就中断循环
      if $scene != self
        break
      end
    end
    # 装备过渡
    Graphics.freeze
    # 释放窗口
    @xuanren_2hao_window.dispose
  end
    def update
        guangbiao_shuaxin
    # 更新判断
      update_xuanzerw2hao
   end
def update_xuanzerw2hao
   if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 切换的选技能画面
      $scene = Scene_jiaojineng_xuanjineng.new
      return
    end
if Input.trigger?(Input::C)
   
   #传授技能的人带入变量
      $erhaochuanjizhe = $game_party.actors[@xuanren_2hao_window.index].id

   if $erhaochuanjizhe == $chuanjizhe
   else
     id = $game_party.actors[$erhaochuanjizhe].id
     $game_actors[id].learn_skill($beixuanjineng)
           # 切换的地图画面
      $scene = Scene_Map.new
      return
     end
end
end
  def guangbiao_shuaxin
      # 光标右 (+1)
      if Input.trigger?(Input::UP)
        #播放SE
        $game_system.se_play($data_system.cursor_se)
        @xuanren_2hao_window.index -= 1
          @xuanren_2hao_window.index = $game_party.actors.size-1 if @xuanren_2hao_window.index < 0
       end
      # 光标左 (-1)
      if Input.trigger?(Input::DOWN)
        $game_system.se_play($data_system.cursor_se)
        @xuanren_2hao_window.index += 1
      @xuanren_2hao_window.index = 0 if @xuanren_2hao_window.index > $game_party.actors.size-1
     end
   end
end
############################################################################
#二号人物窗
############################################################################
class Window_xuanren_2hao < Window_Selectable
    def initialize
    super(0, 0, 200, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    @xuanren_2jns = []
    self.index = 0
    refresh
  end
  #刷新
  def refresh
    self.contents.clear
        for i in 0..$game_party.actors.size-1
    @xuanren_2jns =  $game_party.actors.name
     draw_xjn(i, normal_color)
   end
   end
      def draw_xjn(index, color)
    self.contents.font.color = color
    rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @xuanren_2jns[index])
  end
end
[/pre]
梦石
0
星屑
9292
在线时间
2504 小时
注册时间
2011-5-20
回帖
14521

开拓者

发表于 2016-3-19 17:13:23 | 显示全部楼层
传授的技能可以用出来吗。。。我记得数据库里要钩上才能用

点评

得出传授的是几号技能,然后2号人物再增加那个特技  发表于 2016-3-19 20:25
就是和事件里面的增减特技一个道理  发表于 2016-3-19 20:24
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部