| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2013-3-11 |
| 在线时间 | 616 小时 |
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 616 小时
- 注册时间
- 2010-10-29
- 回帖
- 411
|
发表于 2013-1-22 06:20:10
|
显示全部楼层
本帖最后由 896409879 于 2013-1-21 16:22 编辑
这个是自己之前的练手作品了。。。。现在可以优化脚本了,但是又不想优化了。。。。。
其实外站有好几个比我这个好的加点,但是嘛。。。。。。自己的广告~
Dekita的还有KGC的都不错的。。。。。Xail的看着很有爱~
<= 混蛋,你明明是想推荐自己的脚本吧!
- #==============================================================================
- # ■ VA脑残加点系统0.7版本 by LBQ
- #------------------------------------------------------------------------------
- # 这是一个简单的加点系统,里面界面比较粗糙,功能比较弱。
- #------------------------------------------------------------------------------
- #==============================================================================
- # ■ 新人练手,大神勿喷 ■
- # 一切喷新人的习惯都是不好的
- # 十分欢迎建议哦!
- #==============================================================================
- # 【功能】
- # 简单的加点
- # 手动分配点数
- #==============================================================================
- # 【有待追加】
- # 洗点
- # 队伍菜单内嵌
- # 选项消耗不同技能点(初始研发失败)
- #==============================================================================
- # 【使用说明】
- # 呼出加点界面:
- # $id=n
- # SceneManager.call(Scene_StatDist)
- # 其中n为人物数据库编号(这个脑残的方法我真的会改。。。)
- #
- # 手动分配点数(默认设置):
- # 所有点数储存在变量50号+人物数据库编号里面,也就是说,埃里克是数据库的一号,那么他
- # 的点数就储存在51号变量里面。通过变量操作(只支持进行加减法)即可。
- #==============================================================================
- #==============================================================================
- # 【注意】
- # 1:本脚本没有取消默认的升级能力提升,请自行设置
- # 2:本脚本对“降级”这个设定做的处理不好,降级之后恐怕可能出现负数技能点,我也想
- # 不出有什么更好的方法了。。。
- # 3:本脚本默认的加点加的属性不是特别平衡,请自己修改。
- # 4:本脚本的算法可能会导致在进入加点界面之前,点数都不会发生变化,请不要条件分歧
- # 点数变量。那个变量是用来手动分配点数的!
- #==============================================================================
- #==============================================================================
- # 【使用条例】
- # 你拿去干什么合法的都可以,但是不要剽窃我的脚本。也不要拿来当奖励啊什么的。
- # (↑ 别自恋了,谁会想要剽窃你的脚本!↑)
- #==============================================================================
- #==============================================================================
- # ※ 特别感谢:GubiD ※
- #==============================================================================
- #==============================================================================
- # ※ 设置模块
- #------------------------------------------------------------------------------
- module Lbq
- #大家干嘛都用2个module,这样很烦啊,一个不就够了吗。。。
- #但是,我还是尊重习惯
- module Sta_dist
- #点数用语↓
- VOCAB_PTS="点数:"
- #加点储存的基础数↓
- VAR_ACT=50
- #每升一级获得点数↓
- GAIN=3
- #行走图是否启动(因为功能不成熟)(貌似名字打错了。。。)↓
- FACE_ENABLE=true
- #每个选项之前的用语↓
- PRE="增加"
- #每个选项的用语↓
- VOCAB=["力量","体制","魔力","灵巧","幸运"]
- #每个选项效果:从左往右依次为:最大HP 最大MP 物攻 物防 魔攻 魔防 敏捷 幸运↓
- STA_ADD=[
- [1,0,2,0,0,0,0,0],
- [5,1,0,1,0,0,0,0],
- [0,3,0,0,1,1,0,0],
- [0,0,0,0,0,0,1,1],
- [0,1,0,0,0,0,0,2]
- ]
-
- #--------------------------------------------------------------------------
- # ● 注意
- # 修改以下内容可能导致 头晕眼花、白内障、地中海式贫血、链状红细胞等病症。
- # 严重时可导致 昏厥,休克,不孕不育等奇葩情况。
- # 请谨慎修改,若出现以上病症,本人恕不负责。
- #--------------------------------------------------------------------------
-
- #已经失败了的东西,不要修改!↓
- STA_COST=[1,1,1,1,1]
- end
- end
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :rec_lv # 算法用记录变量
- attr_accessor :rec_stapts # 洗点用变量(未完成)
-
- alias dist_set setup
- def setup(actor_id)
- #初始化角色记录登记
- @rec_lv=1
- dist_set(actor_id)
- end
- end
- class Window_StatDist < Window_Command
- def initialize(x, y)
- #奇葩的写法,我知道错了。。。
- @enable1=true
- @enable2=true
- @enable3=true
- @enable4=true
- @enable5=true
- judge
- super
- end
- def judge
- i=0
- while i<5
- if $game_variables[Lbq::Sta_dist::VAR_ACT+$id] >= Lbq::Sta_dist::STA_COST[i]
- set_enable(i+1,true)
- else
- set_enable(i+1,false)
- end
- i+=1
- end
- end
- def set_enable(index,bl)
- case index
- #这个默认的when排列真是蛋疼。。。
- when 1
- @enable1=bl
- when 2
- @enable2=bl
- when 3
- @enable3=bl
- when 4
- @enable4=bl
- when 5
- @enable5=bl
- end
- end
- #--------------------------------------------------------------------------
- # ● 生成指令列表
- #--------------------------------------------------------------------------
- def make_command_list
- add_command(Lbq::Sta_dist::PRE+Lbq::Sta_dist::VOCAB[0], :pow, @enable1)
- add_command(Lbq::Sta_dist::PRE+Lbq::Sta_dist::VOCAB[1], :sta, @enable2)
- add_command(Lbq::Sta_dist::PRE+Lbq::Sta_dist::VOCAB[2], :man, @enable3)
- add_command(Lbq::Sta_dist::PRE+Lbq::Sta_dist::VOCAB[3], :tac, @enable4)
- add_command(Lbq::Sta_dist::PRE+Lbq::Sta_dist::VOCAB[4], :luk, @enable5)
- end
- end
- #==============================================================================
- # ■ Window_StatDisplay
- #------------------------------------------------------------------------------
- # 用于显示当前剩余点数的窗口
- #==============================================================================
- class Window_StatDisplay < Window_Base
- #下面的初始化参数十分奇葩~下次改一改。。。虽然我真的觉得没什么。。。
- def initialize(x=0, y=416-50, width=160, height=50)
- super
- end
- def update
- super
- contents.clear
- #偷懒,用这个方法
- draw_text_ex(3, 0, Lbq::Sta_dist::VOCAB_PTS+" "+$game_variables[Lbq::Sta_dist::VAR_ACT+$id].to_s)
- end
- end
- #==============================================================================
- # ■ Window_StatStatus
- #------------------------------------------------------------------------------
- # 用于显示当前角色属性的窗口
- #==============================================================================
- class Window_StatStatus < Window_Base
- def initialize(x=160, y=0,width=Graphics.width-160,height=Graphics.height)
- super
- end
- def update
- super
- end
- def update_data
- contents.clear
- actor=$game_actors[$id]
- draw_actor_face(actor, 3, 2)
- if Lbq::Sta_dist::FACE_ENABLE
- draw_character(actor.character_name, actor.character_index, 80, 96)
- end
- draw_actor_simple_status(actor, 100, 3)
- draw_equipments(215, 120)
- i=0
-
- #话说看着默认的循环看着好晕,还是while比较好理解。《=其实是你不会do循环吧~
- #绘制角色能力值
- while i < 8
- draw_actor_param(actor, 3, 120+24*i, i)
- i+=1
- end
- end
- #--------------------------------------------------------------------------
- # ● 绘制装备(盗取自默认状态栏)
- #--------------------------------------------------------------------------
- def draw_equipments(x, y)
- actor=$game_actors[$id]
- actor.equips.each_with_index do |item, i|
- draw_item_name(item, x, y + line_height * i)
- end
- end
- end
- #==============================================================================
- # ■ Scene_StatDist
- #------------------------------------------------------------------------------
- # 加点界面
- #==============================================================================
- # 下次我一定要用 include。。。 %>_<%
- class Scene_StatDist < Scene_Base
- def start
- super
- @actor=$game_actors[$id]
- gain=(@<a href="mailto:actor.level-@actor.rec_lv">actor.level-@actor.rec_lv</a>)*Lbq::Sta_dist::GAIN
- #获得点数
- $game_variables[Lbq::Sta_dist::VAR_ACT+$id]+= gain
- @actor.rec_lv=@actor.level
- create_background
- create_window
- end
- #--------------------------------------------------------------------------
- # ● 生成背景(直接盗窃默认菜单~)
- #--------------------------------------------------------------------------
- def create_background
- @background_sprite = Sprite.new
- @background_sprite.bitmap = SceneManager.background_bitmap
- @background_sprite.color.set(16, 16, 16, 128)
- end
-
- #生成窗口
- def create_window
- @stat_win=Window_StatDist.new(0,0)
- handler_set
- @display=Window_StatDisplay.new
- @stat=Window_StatStatus.new
- @stat.update_data
- end
-
- #这个纯粹是出错之后偷懒的结果
- def create_choices
- @stat_win=Window_StatDist.new(0,0)
- end
-
- #设置 handler=》方法
- def handler_set
- #设定各种选项结果
- @stat_win.set_handler(:pow, method(:command_pow))
- @stat_win.set_handler(:sta, method(:command_sta))
- @stat_win.set_handler(:man, method(:command_man))
- @stat_win.set_handler(:tac, method(:command_tac))
- @stat_win.set_handler(:luk, method(:command_luk))
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- #退出界面设定
- if Input.trigger?(:B)
- Sound.play_cancel
- SceneManager.call(Scene_Map)
- end
- end
-
- def reset_win
- @stat_win.dispose
- create_choices
- end
-
- #--------------------------------------------------------------------------
- # ● 各个选项的设置(貌似下次应该改进一下选项处理)
- #--------------------------------------------------------------------------
- def command_pow
- i = 0
- while i<Lbq::Sta_dist::STA_ADD[0].length
- @actor.add_param(i, Lbq::Sta_dist::STA_ADD[0][i])
- i+=1
- end
- $game_variables[Lbq::Sta_dist::VAR_ACT+$id]-=Lbq::Sta_dist::STA_COST[0]
- @cost=Lbq::Sta_dist::STA_COST[0]
- re_active
- return
- end
-
- def command_sta
- i = 0
- while i<Lbq::Sta_dist::STA_ADD[1].length
- @actor.add_param(i, Lbq::Sta_dist::STA_ADD[1][i])
- i+=1
- end
- $game_variables[Lbq::Sta_dist::VAR_ACT+$id]-=Lbq::Sta_dist::STA_COST[1]
- @cost=Lbq::Sta_dist::STA_COST[1]
- re_active
- end
-
- def command_man
- i = 0
- while i<Lbq::Sta_dist::STA_ADD[2].length
- @actor.add_param(i, Lbq::Sta_dist::STA_ADD[2][i])
- i+=1
- end
- $game_variables[Lbq::Sta_dist::VAR_ACT+$id]-=Lbq::Sta_dist::STA_COST[2]
- @cost=Lbq::Sta_dist::STA_COST[2]
- re_active
- end
-
- def command_tac
- i = 0
- while i<Lbq::Sta_dist::STA_ADD[3].length
- @actor.add_param(i, Lbq::Sta_dist::STA_ADD[3][i])
- i+=1
- end
- $game_variables[Lbq::Sta_dist::VAR_ACT+$id]-=Lbq::Sta_dist::STA_COST[3]
- @cost=Lbq::Sta_dist::STA_COST[3]
- re_active
- end
-
- def command_luk
- i = 0
- while i<Lbq::Sta_dist::STA_ADD[4].length
- @actor.add_param(i, Lbq::Sta_dist::STA_ADD[4][i])
- i+=1
- end
- $game_variables[Lbq::Sta_dist::VAR_ACT+$id]-=Lbq::Sta_dist::STA_COST[4]
- @cost=Lbq::Sta_dist::STA_COST[4]
- re_active
- end
-
-
- #--------------------------------------------------------------------------
- # ● 重新让窗口处于动态状态 (active),同时兼任一些很重要的工作
- #--------------------------------------------------------------------------
- def re_active
- if $game_variables[Lbq::Sta_dist::VAR_ACT+$id] >= Lbq::Sta_dist::STA_COST[@cost]
- @stat_win.set_enable(1,true)
- else
- #这个地方求大神给建议,方法超级奇葩。。。
- reset_win
- end
- @stat.update_data
- #重新active一下
- @stat_win.active = true
- end
- end
- #==============================================================================
- # ■ 最后 ■
- #------------------------------------------------------------------------------
- # 感谢您的使用!
- #==============================================================================
复制代码
|
|