查看: 4760|回复: 2

[已经解决] 有木有升级加点的脚本?不需要事件定义的……

[复制链接]
梦石
0
星屑
48
在线时间
331 小时
注册时间
2012-5-4
回帖
117
发表于 2013-1-21 23:53:03 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 wshzya 于 2013-3-17 12:53 编辑

RT,貌似可以在这里问吧…… 求好淫帮助~~~
梦石
0
星屑
50
在线时间
616 小时
注册时间
2010-10-29
回帖
411
发表于 2013-1-22 06:20:10 | 显示全部楼层
本帖最后由 896409879 于 2013-1-21 16:22 编辑

这个是自己之前的练手作品了。。。。现在可以优化脚本了,但是又不想优化了。。。。。

其实外站有好几个比我这个好的加点,但是嘛。。。。。。自己的广告~
Dekita的还有KGC的都不错的。。。。。Xail的看着很有爱~



<= 混蛋,你明明是想推荐自己的脚本吧!
  1. #==============================================================================
  2. # ■ VA脑残加点系统0.7版本 by LBQ
  3. #------------------------------------------------------------------------------
  4. #  这是一个简单的加点系统,里面界面比较粗糙,功能比较弱。
  5. #------------------------------------------------------------------------------
  6. #==============================================================================
  7. #                          ■ 新人练手,大神勿喷 ■
  8. #                         一切喷新人的习惯都是不好的
  9. #                              十分欢迎建议哦!
  10. #==============================================================================
  11. # 【功能】
  12. #  简单的加点
  13. #  手动分配点数
  14. #==============================================================================
  15. # 【有待追加】
  16. #  洗点
  17. #  队伍菜单内嵌
  18. #  选项消耗不同技能点(初始研发失败)
  19. #==============================================================================
  20. # 【使用说明】
  21. #  呼出加点界面:
  22. #  $id=n
  23. #  SceneManager.call(Scene_StatDist)
  24. #  其中n为人物数据库编号(这个脑残的方法我真的会改。。。)
  25. #
  26. #  手动分配点数(默认设置):
  27. #  所有点数储存在变量50号+人物数据库编号里面,也就是说,埃里克是数据库的一号,那么他
  28. #  的点数就储存在51号变量里面。通过变量操作(只支持进行加减法)即可。
  29. #==============================================================================
  30. #==============================================================================
  31. # 【注意】
  32. #  1:本脚本没有取消默认的升级能力提升,请自行设置
  33. #  2:本脚本对“降级”这个设定做的处理不好,降级之后恐怕可能出现负数技能点,我也想
  34. #     不出有什么更好的方法了。。。
  35. #  3:本脚本默认的加点加的属性不是特别平衡,请自己修改。
  36. #  4:本脚本的算法可能会导致在进入加点界面之前,点数都不会发生变化,请不要条件分歧
  37. #     点数变量。那个变量是用来手动分配点数的!
  38. #==============================================================================
  39. #==============================================================================
  40. # 【使用条例】
  41. #  你拿去干什么合法的都可以,但是不要剽窃我的脚本。也不要拿来当奖励啊什么的。
  42. #                  (↑ 别自恋了,谁会想要剽窃你的脚本!↑)
  43. #==============================================================================

  44. #==============================================================================
  45. #                            ※ 特别感谢:GubiD ※
  46. #==============================================================================

  47. #==============================================================================
  48. # ※ 设置模块
  49. #------------------------------------------------------------------------------
  50. module Lbq
  51.   #大家干嘛都用2个module,这样很烦啊,一个不就够了吗。。。
  52.   #但是,我还是尊重习惯
  53.   module Sta_dist
  54.     #点数用语↓
  55.     VOCAB_PTS="点数:"
  56.     #加点储存的基础数↓
  57.     VAR_ACT=50
  58.     #每升一级获得点数↓
  59.     GAIN=3
  60.     #行走图是否启动(因为功能不成熟)(貌似名字打错了。。。)↓
  61.     FACE_ENABLE=true
  62.     #每个选项之前的用语↓
  63.     PRE="增加"
  64.     #每个选项的用语↓
  65.     VOCAB=["力量","体制","魔力","灵巧","幸运"]
  66.     #每个选项效果:从左往右依次为:最大HP 最大MP 物攻 物防 魔攻 魔防 敏捷 幸运↓
  67.     STA_ADD=[
  68.     [1,0,2,0,0,0,0,0],
  69.     [5,1,0,1,0,0,0,0],
  70.     [0,3,0,0,1,1,0,0],
  71.     [0,0,0,0,0,0,1,1],
  72.     [0,1,0,0,0,0,0,2]
  73.     ]
  74.    
  75. #--------------------------------------------------------------------------
  76. # ● 注意
  77. #    修改以下内容可能导致 头晕眼花、白内障、地中海式贫血、链状红细胞等病症。
  78. #    严重时可导致 昏厥,休克,不孕不育等奇葩情况。
  79. #    请谨慎修改,若出现以上病症,本人恕不负责。
  80. #--------------------------------------------------------------------------
  81.    
  82.     #已经失败了的东西,不要修改!↓
  83.     STA_COST=[1,1,1,1,1]
  84.   end
  85. end

  86. class Game_Actor < Game_Battler
  87.   #--------------------------------------------------------------------------
  88.   # ● 定义实例变量
  89.   #--------------------------------------------------------------------------
  90.   attr_accessor :rec_lv                     # 算法用记录变量  
  91.   attr_accessor :rec_stapts                 # 洗点用变量(未完成)
  92.   
  93.   alias dist_set setup
  94.   def setup(actor_id)
  95.     #初始化角色记录登记
  96.     @rec_lv=1
  97.     dist_set(actor_id)
  98.   end
  99. end

  100. class Window_StatDist < Window_Command
  101.   def initialize(x, y)
  102.     #奇葩的写法,我知道错了。。。
  103.     @enable1=true
  104.     @enable2=true
  105.     @enable3=true
  106.     @enable4=true
  107.     @enable5=true
  108.     judge
  109.     super
  110.   end
  111.   def judge
  112.     i=0
  113.     while i<5
  114.     if $game_variables[Lbq::Sta_dist::VAR_ACT+$id] >= Lbq::Sta_dist::STA_COST[i]
  115.       set_enable(i+1,true)
  116.     else
  117.       set_enable(i+1,false)
  118.     end
  119.     i+=1
  120.     end
  121.   end
  122.   def set_enable(index,bl)
  123.     case index
  124.     #这个默认的when排列真是蛋疼。。。
  125.     when 1
  126.       @enable1=bl
  127.     when 2
  128.       @enable2=bl
  129.     when 3
  130.       @enable3=bl
  131.     when 4
  132.       @enable4=bl
  133.     when 5
  134.       @enable5=bl
  135.     end
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # ● 生成指令列表
  139.   #--------------------------------------------------------------------------
  140.   def make_command_list
  141.     add_command(Lbq::Sta_dist::PRE+Lbq::Sta_dist::VOCAB[0], :pow, @enable1)
  142.     add_command(Lbq::Sta_dist::PRE+Lbq::Sta_dist::VOCAB[1], :sta, @enable2)
  143.     add_command(Lbq::Sta_dist::PRE+Lbq::Sta_dist::VOCAB[2], :man, @enable3)
  144.     add_command(Lbq::Sta_dist::PRE+Lbq::Sta_dist::VOCAB[3], :tac, @enable4)
  145.     add_command(Lbq::Sta_dist::PRE+Lbq::Sta_dist::VOCAB[4], :luk, @enable5)
  146.   end
  147. end



  148. #==============================================================================
  149. # ■ Window_StatDisplay
  150. #------------------------------------------------------------------------------
  151. #  用于显示当前剩余点数的窗口
  152. #==============================================================================
  153. class Window_StatDisplay < Window_Base
  154.   #下面的初始化参数十分奇葩~下次改一改。。。虽然我真的觉得没什么。。。
  155.   def initialize(x=0, y=416-50, width=160, height=50)
  156.     super
  157.   end
  158.   def update
  159.     super
  160.     contents.clear
  161.     #偷懒,用这个方法
  162.     draw_text_ex(3, 0, Lbq::Sta_dist::VOCAB_PTS+" "+$game_variables[Lbq::Sta_dist::VAR_ACT+$id].to_s)
  163.   end
  164. end



  165. #==============================================================================
  166. # ■ Window_StatStatus
  167. #------------------------------------------------------------------------------
  168. #  用于显示当前角色属性的窗口
  169. #==============================================================================
  170. class Window_StatStatus < Window_Base
  171.   def initialize(x=160, y=0,width=Graphics.width-160,height=Graphics.height)
  172.     super
  173.   end
  174.   def update
  175.     super
  176.   end
  177.   def update_data
  178.     contents.clear
  179.     actor=$game_actors[$id]
  180.     draw_actor_face(actor, 3, 2)
  181.     if Lbq::Sta_dist::FACE_ENABLE
  182.     draw_character(actor.character_name, actor.character_index, 80, 96)
  183.     end
  184.     draw_actor_simple_status(actor, 100, 3)
  185.     draw_equipments(215, 120)
  186.     i=0
  187.    
  188.     #话说看着默认的循环看着好晕,还是while比较好理解。《=其实是你不会do循环吧~
  189.     #绘制角色能力值
  190.     while i < 8
  191.     draw_actor_param(actor, 3, 120+24*i, i)
  192.     i+=1
  193.   end
  194. end
  195.   #--------------------------------------------------------------------------
  196.   # ● 绘制装备(盗取自默认状态栏)
  197.   #--------------------------------------------------------------------------
  198.   def draw_equipments(x, y)
  199.     actor=$game_actors[$id]
  200.     actor.equips.each_with_index do |item, i|
  201.       draw_item_name(item, x, y + line_height * i)
  202.     end
  203.   end
  204. end




  205. #==============================================================================
  206. # ■ Scene_StatDist
  207. #------------------------------------------------------------------------------
  208. #  加点界面
  209. #==============================================================================
  210. # 下次我一定要用 include。。。 %>_<%
  211. class Scene_StatDist < Scene_Base
  212.   def start
  213.     super
  214.     @actor=$game_actors[$id]
  215.     gain=(@<a href="mailto:actor.level-@actor.rec_lv">actor.level-@actor.rec_lv</a>)*Lbq::Sta_dist::GAIN
  216.     #获得点数
  217.     $game_variables[Lbq::Sta_dist::VAR_ACT+$id]+= gain
  218.     @actor.rec_lv=@actor.level
  219.     create_background
  220.     create_window
  221.   end
  222.   #--------------------------------------------------------------------------
  223.   # ● 生成背景(直接盗窃默认菜单~)
  224.   #--------------------------------------------------------------------------
  225.   def create_background
  226.     @background_sprite = Sprite.new
  227.     @background_sprite.bitmap = SceneManager.background_bitmap
  228.     @background_sprite.color.set(16, 16, 16, 128)
  229.   end
  230.   
  231.   #生成窗口
  232.   def create_window
  233.     @stat_win=Window_StatDist.new(0,0)
  234.     handler_set
  235.     @display=Window_StatDisplay.new
  236.     @stat=Window_StatStatus.new
  237.     @stat.update_data
  238.   end
  239.   
  240.   #这个纯粹是出错之后偷懒的结果
  241.   def create_choices
  242.     @stat_win=Window_StatDist.new(0,0)
  243.   end
  244.   
  245.   #设置 handler=》方法
  246.   def handler_set
  247.     #设定各种选项结果
  248.     @stat_win.set_handler(:pow,      method(:command_pow))
  249.     @stat_win.set_handler(:sta,      method(:command_sta))
  250.     @stat_win.set_handler(:man,      method(:command_man))
  251.     @stat_win.set_handler(:tac,      method(:command_tac))
  252.     @stat_win.set_handler(:luk,      method(:command_luk))
  253.   end
  254.   #--------------------------------------------------------------------------
  255.   # ● 更新画面
  256.   #--------------------------------------------------------------------------
  257.   def update
  258.     super
  259.     #退出界面设定
  260.     if Input.trigger?(:B)
  261.       Sound.play_cancel
  262.       SceneManager.call(Scene_Map)
  263.     end
  264.   end
  265.   
  266.   def reset_win
  267.     @stat_win.dispose
  268.     create_choices
  269.   end
  270.   
  271.   #--------------------------------------------------------------------------
  272.   # ● 各个选项的设置(貌似下次应该改进一下选项处理)
  273.   #--------------------------------------------------------------------------
  274.   def command_pow
  275.       i = 0
  276.     while i<Lbq::Sta_dist::STA_ADD[0].length
  277.       @actor.add_param(i, Lbq::Sta_dist::STA_ADD[0][i])
  278.       i+=1
  279.     end
  280.     $game_variables[Lbq::Sta_dist::VAR_ACT+$id]-=Lbq::Sta_dist::STA_COST[0]
  281.     @cost=Lbq::Sta_dist::STA_COST[0]
  282.     re_active
  283.     return
  284.   end
  285.   
  286.   def command_sta
  287.     i = 0
  288.     while i<Lbq::Sta_dist::STA_ADD[1].length
  289.       @actor.add_param(i, Lbq::Sta_dist::STA_ADD[1][i])
  290.       i+=1
  291.     end
  292.     $game_variables[Lbq::Sta_dist::VAR_ACT+$id]-=Lbq::Sta_dist::STA_COST[1]
  293.     @cost=Lbq::Sta_dist::STA_COST[1]
  294.     re_active
  295.   end
  296.   
  297.   def command_man
  298.     i = 0
  299.     while i<Lbq::Sta_dist::STA_ADD[2].length
  300.       @actor.add_param(i, Lbq::Sta_dist::STA_ADD[2][i])
  301.       i+=1
  302.     end
  303.     $game_variables[Lbq::Sta_dist::VAR_ACT+$id]-=Lbq::Sta_dist::STA_COST[2]
  304.     @cost=Lbq::Sta_dist::STA_COST[2]
  305.     re_active
  306.   end
  307.   
  308.   def command_tac
  309.     i = 0
  310.     while i<Lbq::Sta_dist::STA_ADD[3].length
  311.       @actor.add_param(i, Lbq::Sta_dist::STA_ADD[3][i])
  312.       i+=1
  313.     end
  314.     $game_variables[Lbq::Sta_dist::VAR_ACT+$id]-=Lbq::Sta_dist::STA_COST[3]
  315.     @cost=Lbq::Sta_dist::STA_COST[3]
  316.     re_active
  317.   end
  318.   
  319.   def command_luk
  320.     i = 0
  321.     while i<Lbq::Sta_dist::STA_ADD[4].length
  322.       @actor.add_param(i, Lbq::Sta_dist::STA_ADD[4][i])
  323.       i+=1
  324.     end
  325.     $game_variables[Lbq::Sta_dist::VAR_ACT+$id]-=Lbq::Sta_dist::STA_COST[4]
  326.     @cost=Lbq::Sta_dist::STA_COST[4]
  327.     re_active
  328.   end
  329.   
  330.   
  331.   #--------------------------------------------------------------------------
  332.   # ● 重新让窗口处于动态状态 (active),同时兼任一些很重要的工作
  333.   #--------------------------------------------------------------------------
  334.   def re_active
  335.     if $game_variables[Lbq::Sta_dist::VAR_ACT+$id] >= Lbq::Sta_dist::STA_COST[@cost]
  336.       @stat_win.set_enable(1,true)
  337.     else
  338.       #这个地方求大神给建议,方法超级奇葩。。。
  339.       reset_win
  340.     end
  341.     @stat.update_data
  342.     #重新active一下
  343.     @stat_win.active = true
  344.   end
  345. end
  346. #==============================================================================
  347. #                                  ■ 最后 ■
  348. #------------------------------------------------------------------------------
  349. #                                感谢您的使用!
  350. #==============================================================================
复制代码



我命令你给我点下面的东西!

LBQ Works
回复

使用道具 举报

梦石
0
星屑
48
在线时间
331 小时
注册时间
2012-5-4
回帖
117
 楼主| 发表于 2013-1-22 14:25:47 | 显示全部楼层
本帖最后由 wshzya 于 2013-1-22 14:28 编辑

感谢鸟~~~好像有点……我自己试试…………
就是那个“求大神给建议”的地方出现错误了撒……

点评

我先Debug一下。。。  发表于 2013-1-23 08:26
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部