查看: 3071|回复: 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


脚本
  1. ################################################################################
  2. #by 杨志
  3. #########################################################################
  4. #选人物
  5. ###########################################################################
  6. class Scene_jiaojineng_xuanren
  7.     def main
  8.     #生成选择窗口
  9.      @xuanzerw_window = Window_xuanren_jn.new
  10.      @xuanzerw_window.index = 0
  11.     # 执行过度
  12.     Graphics.transition
  13.     # 主循环
  14.     loop do
  15.       # 刷新游戏画面
  16.       Graphics.update
  17.       # 刷新输入信息
  18.       Input.update
  19.       # 刷新画面
  20.       update
  21.       # 如果画面切换就中断循环
  22.       if $scene != self
  23.         break
  24.       end
  25.     end
  26.     # 装备过渡
  27.     Graphics.freeze
  28.     # 释放窗口
  29. #    @screen.dispose
  30.     @xuanzerw_window.dispose
  31.   end
  32.     #--------------------------------------------------------------------------
  33.   # ● 刷新画面
  34.   #--------------------------------------------------------------------------
  35.   def update
  36.         guangbiao_shuaxin
  37.     # 更新判断
  38.       update_xuanzerw
  39.    end
  40. def update_xuanzerw
  41.    if Input.trigger?(Input::B)
  42.       # 演奏取消 SE
  43.       $game_system.se_play($data_system.cancel_se)
  44.       # 切换的地图画面
  45.       $scene = Scene_Map.new
  46.       return
  47.     end

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

  52.    $scene =  Scene_jiaojineng_xuanjineng.new
  53. end
  54. end
  55.   def guangbiao_shuaxin
  56.       # 光标右 (+1)
  57.       if Input.trigger?(Input::UP)
  58.         #播放SE
  59.         $game_system.se_play($data_system.cursor_se)
  60.         @xuanzerw_window.index -= 1
  61.           @xuanzerw_window.index = $game_party.actors.size-1 if @xuanzerw_window.index < 0
  62.        end
  63.       # 光标左 (-1)
  64.       if Input.trigger?(Input::DOWN)
  65.         $game_system.se_play($data_system.cursor_se)
  66.         @xuanzerw_window.index += 1
  67.       @xuanzerw_window.index = 0 if @xuanzerw_window.index > $game_party.actors.size-1
  68.      end
  69.    end
  70. end
  71. ##########################################################################
  72. #选技能
  73. #############################################################################
  74. class Scene_jiaojineng_xuanjineng
  75.       def main
  76.     #生成选择窗口
  77.      @chuanshouzhe_window = Window_jiaoshou_Skill.new(0, 0, 640, 480, $chuanjizhe)
  78.      @chuanshouzhe_window.index = 0
  79.     # 执行过度
  80.     Graphics.transition
  81.     # 主循环
  82.     loop do
  83.       # 刷新游戏画面
  84.       Graphics.update
  85.       # 刷新输入信息
  86.       Input.update
  87.       # 刷新画面
  88.       update
  89.       # 如果画面切换就中断循环
  90.       if $scene != self
  91.         break
  92.       end
  93.     end
  94.     # 装备过渡
  95.     Graphics.freeze
  96.     # 释放窗口
  97. #    @screen.dispose
  98.     @chuanshouzhe_window.dispose
  99.   end
  100.   #########
  101.   #刷新
  102.   ############
  103. def   update
  104.   guangbiao_shuaxin
  105.       # 更新判断
  106.       update_xuanjineng
  107.   
  108.     end
  109.     #选中技能判断
  110.   def  update_xuanjineng
  111.        if Input.trigger?(Input::B)
  112.       # 演奏取消 SE
  113.       $game_system.se_play($data_system.cancel_se)
  114.       # 切换的选人画面
  115.       $scene = Scene_jiaojineng_xuanren.new
  116.       return
  117.     end
  118. if Input.trigger?(Input::C)
  119. unless $jinengdata == []
  120.    #选中的技能带入变量
  121.    $beixuanjineng =  $jinengdata[@chuanshouzhe_window.index].id
  122.    $scene = Scene_jiaojineng_erhaoxuanren.new
  123. end
  124. end
  125. end

  126. ##########
  127. #光标
  128. #############
  129.     def guangbiao_shuaxin
  130.       # 光标右 (+1)
  131.       if Input.trigger?(Input::UP)
  132.         #播放SE
  133.         $game_system.se_play($data_system.cursor_se)
  134.         @chuanshouzhe_window.index -= 1
  135.           @chuanshouzhe_window.index = $jinengdata.size-1 if @chuanshouzhe_window.index < 0
  136.        end
  137.       # 光标左 (-1)
  138.       if Input.trigger?(Input::DOWN)
  139.         $game_system.se_play($data_system.cursor_se)
  140.         @chuanshouzhe_window.index += 1
  141.       @chuanshouzhe_window.index = 0 if @chuanshouzhe_window.index > $jinengdata.size-1
  142.      end
  143. end
  144. end
  145. ############################################################################
  146. #人物列表窗
  147. #############################################################################
  148. class Window_xuanren_jn < Window_Selectable
  149.   def initialize
  150.     super(0, 0, 200, 480)
  151.     self.contents = Bitmap.new(width - 32, height - 32)
  152.     @xuanren_jns = []
  153.     self.index = 0
  154.     refresh
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   # ● 刷新
  158.   #--------------------------------------------------------------------------
  159.   def refresh
  160.     self.contents.clear
  161.         for i in 0..$game_party.actors.size-1
  162.     @xuanren_jns[i] =  $game_party.actors[i].name
  163.      draw_xjn(i, normal_color)
  164.    end
  165.    end
  166.       def draw_xjn(index, color)
  167.     self.contents.font.color = color
  168.     rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
  169.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  170.     self.contents.draw_text(rect, @xuanren_jns[index])
  171.   end
  172. end
  173. ############################################################################
  174. #技能列表窗
  175. #############################################################################
  176. class Window_jiaoshou_Skill < Window_Selectable
  177.     #--------------------------------------------------------------------------
  178.   # ● 初始化对像
  179.   #     x      : 窗口 X 座标
  180.   #     y      : 窗口 Y 座标
  181.   #     width  : 窗口宽度
  182.   #     height : 窗口高度
  183.   #     actor  : 角色
  184.   #--------------------------------------------------------------------------
  185.   def initialize(x, y, width, height, actor)
  186.     super(x, y, width, height)
  187.     @actor = $game_party.actors[$chuanjizhe]
  188.     @column_max = 1
  189.     self.index = 0
  190.     refresh
  191.   end
  192.   def skill
  193.     return @data[self.index]
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # ● 刷新
  197.   #--------------------------------------------------------------------------
  198.   def refresh
  199.     if self.contents != nil
  200.       self.contents.dispose
  201.       self.contents = nil
  202.     end
  203.     $jinengdata = []
  204.        for id in $chuanjizhejnlb.skills

  205.       $jinengdata.push($data_skills[id])
  206.     end
  207.     @jineng_max = $jinengdata.size
  208.     if @jineng_max > 0
  209.       self.contents = Bitmap.new(width - 32, @jineng_max * 32)
  210.       for i in 0...@jineng_max
  211.         draw_jineng(i)
  212.       end
  213.     end
  214.   end
  215.      def   draw_jineng(index)
  216. #    self.contents.font.color = color
  217.     rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
  218.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  219.     self.contents.draw_text(rect, $jinengdata[index].name)
  220.   end
  221. end
  222. #########################################################################
  223. #选二号人物
  224. ###########################################################################
  225. class Scene_jiaojineng_erhaoxuanren
  226.       def main
  227.     #生成选择窗口
  228.      @xuanren_2hao_window = Window_xuanren_2hao.new
  229.      @xuanren_2hao_window.index = 0
  230.     # 执行过度
  231.     Graphics.transition
  232.     # 主循环
  233.     loop do
  234.       # 刷新游戏画面
  235.       Graphics.update
  236.       # 刷新输入信息
  237.       Input.update
  238.       # 刷新画面
  239.       update
  240.       # 如果画面切换就中断循环
  241.       if $scene != self
  242.         break
  243.       end
  244.     end
  245.     # 装备过渡
  246.     Graphics.freeze
  247.     # 释放窗口
  248.     @xuanren_2hao_window.dispose
  249.   end
  250.     def update
  251.         guangbiao_shuaxin
  252.     # 更新判断
  253.       update_xuanzerw2hao
  254.    end
  255. def update_xuanzerw2hao
  256.    if Input.trigger?(Input::B)
  257.       # 演奏取消 SE
  258.       $game_system.se_play($data_system.cancel_se)
  259.       # 切换的选技能画面
  260.       $scene = Scene_jiaojineng_xuanjineng.new
  261.       return
  262.     end
  263. if Input.trigger?(Input::C)
  264.    
  265.    #传授技能的人带入变量
  266.       $erhaochuanjizhe = $game_party.actors[@xuanren_2hao_window.index].id

  267.    if $erhaochuanjizhe == $chuanjizhe
  268.    else
  269.      id = $game_party.actors[$erhaochuanjizhe].id
  270.      $game_actors[id].learn_skill($beixuanjineng)
  271.            # 切换的地图画面
  272.       $scene = Scene_Map.new
  273.       return
  274.      end
  275. end
  276. end
  277.   def guangbiao_shuaxin
  278.       # 光标右 (+1)
  279.       if Input.trigger?(Input::UP)
  280.         #播放SE
  281.         $game_system.se_play($data_system.cursor_se)
  282.         @xuanren_2hao_window.index -= 1
  283.           @xuanren_2hao_window.index = $game_party.actors.size-1 if @xuanren_2hao_window.index < 0
  284.        end
  285.       # 光标左 (-1)
  286.       if Input.trigger?(Input::DOWN)
  287.         $game_system.se_play($data_system.cursor_se)
  288.         @xuanren_2hao_window.index += 1
  289.       @xuanren_2hao_window.index = 0 if @xuanren_2hao_window.index > $game_party.actors.size-1
  290.      end
  291.    end
  292. end
  293. ############################################################################
  294. #二号人物窗
  295. ############################################################################
  296. class Window_xuanren_2hao < Window_Selectable
  297.     def initialize
  298.     super(0, 0, 200, 480)
  299.     self.contents = Bitmap.new(width - 32, height - 32)
  300.     @xuanren_2jns = []
  301.     self.index = 0
  302.     refresh
  303.   end
  304.   #刷新
  305.   def refresh
  306.     self.contents.clear
  307.         for i in 0..$game_party.actors.size-1
  308.     @xuanren_2jns[i] =  $game_party.actors[i].name
  309.      draw_xjn(i, normal_color)
  310.    end
  311.    end
  312.       def draw_xjn(index, color)
  313.     self.contents.font.color = color
  314.     rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
  315.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  316.     self.contents.draw_text(rect, @xuanren_2jns[index])
  317.   end
  318. end
复制代码
梦石
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.

在本版发帖返回顶部