设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 4342|回复: 2
打印 上一主题 下一主题

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
48
在线时间
331 小时
注册时间
2012-5-4
帖子
158
跳转到指定楼层
1
 楼主| 发表于 2013-1-21 23:53:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

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

RT,貌似可以在这里问吧…… 求好淫帮助~~~

Lv1.梦旅人

梦石
0
星屑
50
在线时间
616 小时
注册时间
2010-10-29
帖子
463
2
发表于 2013-1-22 06:20:10 | 只看该作者
本帖最后由 896409879 于 2013-1-21 16:22 编辑

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

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



<= 混蛋,你明明是想推荐自己的脚本吧!
RUBY 代码复制
  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. #==============================================================================
  46. #                            ※ 特别感谢:GubiD ※
  47. #==============================================================================
  48.  
  49. #==============================================================================
  50. # ※ 设置模块
  51. #------------------------------------------------------------------------------
  52. module Lbq
  53.   #大家干嘛都用2个module,这样很烦啊,一个不就够了吗。。。
  54.   #但是,我还是尊重习惯
  55.   module Sta_dist
  56.     #点数用语↓
  57.     VOCAB_PTS="点数:"
  58.     #加点储存的基础数↓
  59.     VAR_ACT=50
  60.     #每升一级获得点数↓
  61.     GAIN=3
  62.     #行走图是否启动(因为功能不成熟)(貌似名字打错了。。。)↓
  63.     FACE_ENABLE=true
  64.     #每个选项之前的用语↓
  65.     PRE="增加"
  66.     #每个选项的用语↓
  67.     VOCAB=["力量","体制","魔力","灵巧","幸运"]
  68.     #每个选项效果:从左往右依次为:最大HP 最大MP 物攻 物防 魔攻 魔防 敏捷 幸运↓
  69.     STA_ADD=[
  70.     [1,0,2,0,0,0,0,0],
  71.     [5,1,0,1,0,0,0,0],
  72.     [0,3,0,0,1,1,0,0],
  73.     [0,0,0,0,0,0,1,1],
  74.     [0,1,0,0,0,0,0,2]
  75.     ]
  76.  
  77. #--------------------------------------------------------------------------
  78. # ● 注意
  79. #    修改以下内容可能导致 头晕眼花、白内障、地中海式贫血、链状红细胞等病症。
  80. #    严重时可导致 昏厥,休克,不孕不育等奇葩情况。
  81. #    请谨慎修改,若出现以上病症,本人恕不负责。
  82. #--------------------------------------------------------------------------
  83.  
  84.     #已经失败了的东西,不要修改!↓
  85.     STA_COST=[1,1,1,1,1]
  86.   end
  87. end
  88.  
  89. class Game_Actor < Game_Battler
  90.   #--------------------------------------------------------------------------
  91.   # ● 定义实例变量
  92.   #--------------------------------------------------------------------------
  93.   attr_accessor :rec_lv                     # 算法用记录变量  
  94.   attr_accessor :rec_stapts                 # 洗点用变量(未完成)
  95.  
  96.   alias dist_set setup
  97.   def setup(actor_id)
  98.     #初始化角色记录登记
  99.     @rec_lv=1
  100.     dist_set(actor_id)
  101.   end
  102. end
  103.  
  104. class Window_StatDist < Window_Command
  105.   def initialize(x, y)
  106.     #奇葩的写法,我知道错了。。。
  107.     @enable1=true
  108.     @enable2=true
  109.     @enable3=true
  110.     @enable4=true
  111.     @enable5=true
  112.     judge
  113.     super
  114.   end
  115.   def judge
  116.     i=0
  117.     while i<5
  118.     if $game_variables[Lbq::Sta_dist::VAR_ACT+$id] >= Lbq::Sta_dist::STA_COST[i]
  119.       set_enable(i+1,true)
  120.     else
  121.       set_enable(i+1,false)
  122.     end
  123.     i+=1
  124.     end
  125.   end
  126.   def set_enable(index,bl)
  127.     case index
  128.     #这个默认的when排列真是蛋疼。。。
  129.     when 1
  130.       @enable1=bl
  131.     when 2
  132.       @enable2=bl
  133.     when 3
  134.       @enable3=bl
  135.     when 4
  136.       @enable4=bl
  137.     when 5
  138.       @enable5=bl
  139.     end
  140.   end
  141.   #--------------------------------------------------------------------------
  142.   # ● 生成指令列表
  143.   #--------------------------------------------------------------------------
  144.   def make_command_list
  145.     add_command(Lbq::Sta_dist::PRE+Lbq::Sta_dist::VOCAB[0], :pow, @enable1)
  146.     add_command(Lbq::Sta_dist::PRE+Lbq::Sta_dist::VOCAB[1], :sta, @enable2)
  147.     add_command(Lbq::Sta_dist::PRE+Lbq::Sta_dist::VOCAB[2], :man, @enable3)
  148.     add_command(Lbq::Sta_dist::PRE+Lbq::Sta_dist::VOCAB[3], :tac, @enable4)
  149.     add_command(Lbq::Sta_dist::PRE+Lbq::Sta_dist::VOCAB[4], :luk, @enable5)
  150.   end
  151. end
  152.  
  153.  
  154.  
  155. #==============================================================================
  156. # ■ Window_StatDisplay
  157. #------------------------------------------------------------------------------
  158. #  用于显示当前剩余点数的窗口
  159. #==============================================================================
  160. class Window_StatDisplay < Window_Base
  161.   #下面的初始化参数十分奇葩~下次改一改。。。虽然我真的觉得没什么。。。
  162.   def initialize(x=0, y=416-50, width=160, height=50)
  163.     super
  164.   end
  165.   def update
  166.     super
  167.     contents.clear
  168.     #偷懒,用这个方法
  169.     draw_text_ex(3, 0, Lbq::Sta_dist::VOCAB_PTS+" "+$game_variables[Lbq::Sta_dist::VAR_ACT+$id].to_s)
  170.   end
  171. end
  172.  
  173.  
  174.  
  175. #==============================================================================
  176. # ■ Window_StatStatus
  177. #------------------------------------------------------------------------------
  178. #  用于显示当前角色属性的窗口
  179. #==============================================================================
  180. class Window_StatStatus < Window_Base
  181.   def initialize(x=160, y=0,width=Graphics.width-160,height=Graphics.height)
  182.     super
  183.   end
  184.   def update
  185.     super
  186.   end
  187.   def update_data
  188.     contents.clear
  189.     actor=$game_actors[$id]
  190.     draw_actor_face(actor, 3, 2)
  191.     if Lbq::Sta_dist::FACE_ENABLE
  192.     draw_character(actor.character_name, actor.character_index, 80, 96)
  193.     end
  194.     draw_actor_simple_status(actor, 100, 3)
  195.     draw_equipments(215, 120)
  196.     i=0
  197.  
  198.     #话说看着默认的循环看着好晕,还是while比较好理解。《=其实是你不会do循环吧~
  199.     #绘制角色能力值
  200.     while i < 8
  201.     draw_actor_param(actor, 3, 120+24*i, i)
  202.     i+=1
  203.   end
  204. end
  205.   #--------------------------------------------------------------------------
  206.   # ● 绘制装备(盗取自默认状态栏)
  207.   #--------------------------------------------------------------------------
  208.   def draw_equipments(x, y)
  209.     actor=$game_actors[$id]
  210.     actor.equips.each_with_index do |item, i|
  211.       draw_item_name(item, x, y + line_height * i)
  212.     end
  213.   end
  214. end
  215.  
  216.  
  217.  
  218.  
  219. #==============================================================================
  220. # ■ Scene_StatDist
  221. #------------------------------------------------------------------------------
  222. #  加点界面
  223. #==============================================================================
  224. # 下次我一定要用 include。。。 %>_<%
  225. class Scene_StatDist < Scene_Base
  226.   def start
  227.     super
  228.     @actor=$game_actors[$id]
  229.     gain=(@<a href="mailto:[email protected]_lv">actor.level-@actor.rec_lv</a>)*Lbq::Sta_dist::GAIN
  230.     #获得点数
  231.     $game_variables[Lbq::Sta_dist::VAR_ACT+$id]+= gain
  232.     @actor.rec_lv=@actor.level
  233.     create_background
  234.     create_window
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # ● 生成背景(直接盗窃默认菜单~)
  238.   #--------------------------------------------------------------------------
  239.   def create_background
  240.     @background_sprite = Sprite.new
  241.     @background_sprite.bitmap = SceneManager.background_bitmap
  242.     @background_sprite.color.set(16, 16, 16, 128)
  243.   end
  244.  
  245.   #生成窗口
  246.   def create_window
  247.     @stat_win=Window_StatDist.new(0,0)
  248.     handler_set
  249.     @display=Window_StatDisplay.new
  250.     @stat=Window_StatStatus.new
  251.     @stat.update_data
  252.   end
  253.  
  254.   #这个纯粹是出错之后偷懒的结果
  255.   def create_choices
  256.     @stat_win=Window_StatDist.new(0,0)
  257.   end
  258.  
  259.   #设置 handler=》方法
  260.   def handler_set
  261.     #设定各种选项结果
  262.     @stat_win.set_handler(:pow,      method(:command_pow))
  263.     @stat_win.set_handler(:sta,      method(:command_sta))
  264.     @stat_win.set_handler(:man,      method(:command_man))
  265.     @stat_win.set_handler(:tac,      method(:command_tac))
  266.     @stat_win.set_handler(:luk,      method(:command_luk))
  267.   end
  268.   #--------------------------------------------------------------------------
  269.   # ● 更新画面
  270.   #--------------------------------------------------------------------------
  271.   def update
  272.     super
  273.     #退出界面设定
  274.     if Input.trigger?(:B)
  275.       Sound.play_cancel
  276.       SceneManager.call(Scene_Map)
  277.     end
  278.   end
  279.  
  280.   def reset_win
  281.     @stat_win.dispose
  282.     create_choices
  283.   end
  284.  
  285.   #--------------------------------------------------------------------------
  286.   # ● 各个选项的设置(貌似下次应该改进一下选项处理)
  287.   #--------------------------------------------------------------------------
  288.   def command_pow
  289.       i = 0
  290.     while i<Lbq::Sta_dist::STA_ADD[0].length
  291.       @actor.add_param(i, Lbq::Sta_dist::STA_ADD[0][i])
  292.       i+=1
  293.     end
  294.     $game_variables[Lbq::Sta_dist::VAR_ACT+$id]-=Lbq::Sta_dist::STA_COST[0]
  295.     @cost=Lbq::Sta_dist::STA_COST[0]
  296.     re_active
  297.     return
  298.   end
  299.  
  300.   def command_sta
  301.     i = 0
  302.     while i<Lbq::Sta_dist::STA_ADD[1].length
  303.       @actor.add_param(i, Lbq::Sta_dist::STA_ADD[1][i])
  304.       i+=1
  305.     end
  306.     $game_variables[Lbq::Sta_dist::VAR_ACT+$id]-=Lbq::Sta_dist::STA_COST[1]
  307.     @cost=Lbq::Sta_dist::STA_COST[1]
  308.     re_active
  309.   end
  310.  
  311.   def command_man
  312.     i = 0
  313.     while i<Lbq::Sta_dist::STA_ADD[2].length
  314.       @actor.add_param(i, Lbq::Sta_dist::STA_ADD[2][i])
  315.       i+=1
  316.     end
  317.     $game_variables[Lbq::Sta_dist::VAR_ACT+$id]-=Lbq::Sta_dist::STA_COST[2]
  318.     @cost=Lbq::Sta_dist::STA_COST[2]
  319.     re_active
  320.   end
  321.  
  322.   def command_tac
  323.     i = 0
  324.     while i<Lbq::Sta_dist::STA_ADD[3].length
  325.       @actor.add_param(i, Lbq::Sta_dist::STA_ADD[3][i])
  326.       i+=1
  327.     end
  328.     $game_variables[Lbq::Sta_dist::VAR_ACT+$id]-=Lbq::Sta_dist::STA_COST[3]
  329.     @cost=Lbq::Sta_dist::STA_COST[3]
  330.     re_active
  331.   end
  332.  
  333.   def command_luk
  334.     i = 0
  335.     while i<Lbq::Sta_dist::STA_ADD[4].length
  336.       @actor.add_param(i, Lbq::Sta_dist::STA_ADD[4][i])
  337.       i+=1
  338.     end
  339.     $game_variables[Lbq::Sta_dist::VAR_ACT+$id]-=Lbq::Sta_dist::STA_COST[4]
  340.     @cost=Lbq::Sta_dist::STA_COST[4]
  341.     re_active
  342.   end
  343.  
  344.  
  345.   #--------------------------------------------------------------------------
  346.   # ● 重新让窗口处于动态状态 (active),同时兼任一些很重要的工作
  347.   #--------------------------------------------------------------------------
  348.   def re_active
  349.     if $game_variables[Lbq::Sta_dist::VAR_ACT+$id] >= Lbq::Sta_dist::STA_COST[@cost]
  350.       @stat_win.set_enable(1,true)
  351.     else
  352.       #这个地方求大神给建议,方法超级奇葩。。。
  353.       reset_win
  354.     end
  355.     @stat.update_data
  356.     #重新active一下
  357.     @stat_win.active = true
  358.   end
  359. end
  360. #==============================================================================
  361. #                                  ■ 最后 ■
  362. #------------------------------------------------------------------------------
  363. #                                感谢您的使用!
  364. #==============================================================================



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

LBQ Works
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
48
在线时间
331 小时
注册时间
2012-5-4
帖子
158
3
 楼主| 发表于 2013-1-22 14:25:47 | 只看该作者
本帖最后由 wshzya 于 2013-1-22 14:28 编辑

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

点评

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

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-21 07:42

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表