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

Project1

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

[已经解决] 升级自由属性加点系统 不用菜单怎么打开

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2392
在线时间
912 小时
注册时间
2014-10-14
帖子
1331

开拓者

跳转到指定楼层
1
发表于 2017-6-21 00:58:52 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式

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

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

x


升级自由属性加点系统 不用菜单怎么打开

我因为脚本问题 菜单已经排满了 请问怎么使用外挂脚本打开 谢谢

RUBY 代码复制
  1. #encoding:utf-8
  2. #=============================================================================
  3. #-----------RMVA加点系统正常向-v1.01---By:救世小树--------转载请注明出处-------
  4. #=============================================================================
  5.  
  6. module Point_Tree
  7.  
  8.   POINT_VARIABLE = 33
  9.   POINT_KIND     = 6             #设定加点种类
  10.   #储存属性点的变量编号是33+角色id*(6+1),
  11.   #即40号变量为一号角色自由点;41号起6个变量为1号角色6个种类的已加点值
  12.  
  13.   LEVEL_UP_POINT = 3
  14.   #每升一级属性点增加数
  15.  
  16.   RESET_ITEM     = 20   #洗点水编号
  17.  
  18.   STR_POINT        = ["体力","精神","力量","魔力","韧性","灵活","???"]
  19.   #分别对应增加       [MHP,MMP,物攻,物防,魔攻,魔防,敏捷,幸运]
  20.   POINT_ADD_PARAM = [[12 ,  0,   0,  0,   0,   0,   0,   0],     #体力
  21.                      [0  , 12,   0,  0,   0,   0,   0,   0],     #精神
  22.                      [0  ,  0,   5,  0,   0,   0,   0,   0],     #力量
  23.                      [0  ,  0,   0,  0,   5,   0,   0,   0],     #魔力
  24.                      [0  ,  0,   0,  3,   0,   2,   0,   1],     #韧性
  25.                      [0  ,  0,   0,  0,   0,   0,   3,   0],     #灵活
  26.  
  27.                      [0,0,0,0,0,0,0,0]]
  28.                      #可以按上面的格式添加下去,不过要改POINT_KIND,STR_ALL,不然加了也白加
  29.  
  30.   #分别对应增加       [物理命中,物理闪避,必杀,必杀闪避,魔法闪避,魔法反射,物理反击,HP再生,Mp再生,Tp再生]
  31.   POINT_ADD_XPARAM = [[0 , 0, 0, 0, 0, 0, 0, 6, 0, 0],
  32.                       [0 , 0, 0, 0, 0, 0, 0, 0, 6, 0],
  33.                       [6 , 6, 0, 0, 0, 0, 0, 0, 0, 0],
  34.                       [0 , 0, 6, 0, 0, 0, 0, 0, 0, 0],
  35.                       [0 , 0, 0, 0, 0, 0, 0, 4, 4, 0],
  36.                       [0 , 6, 0, 6, 6, 0, 0, 0, 0, 0],
  37.  
  38.                       [0,0,0,0,0,0,0,0,0,0]]
  39.                      #这里的单位是万分之一数值也就是0.01%,我随便填了下【别嫌小,够大了,有心情你可以算算看平衡性】
  40.  
  41.   #各种名称
  42.   ADDPOINT       = "加点"   #菜单中选项
  43.  
  44.   POINT_NAME     = "属性点" #未分配点数
  45.  
  46.   XARAM_NAME     = ["物理命中","物理闪避","必杀","必杀闪避","魔法闪避","魔法反射","物理反击","HP再生","Mp再生","Tp再生"]
  47.   def reset(actor_id)
  48.     for i in 1..6
  49.       $game_variables[actor_id*(POINT_KIND+1) + POINT_VARIABLE]+=$game_variables[actor_id*(POINT_KIND+1) + POINT_VARIABLE+i]
  50.       $game_variables[actor_id*(POINT_KIND+1) + POINT_VARIABLE+i]=0
  51.     end
  52.   end
  53.  
  54.   def temp_all
  55.     r = 0
  56.     for i in 0 .. POINT_KIND-1
  57.       r+=$temp_point[i]
  58.     end
  59.     return r
  60.   end
  61.  
  62. end
  63. $temp_point = []
  64. for i in 0 .. Point_Tree::POINT_KIND-1
  65.   $temp_point.push(0)
  66. end
  67.  
  68. class Game_Actor < Game_Battler
  69.   include Point_Tree
  70.   alias level_up_tre level_up
  71.   def level_up
  72.     level_up_tre
  73.     @hp += mhp
  74.     @mp += mmp
  75.     $game_variables[self.id*(POINT_KIND+1) + POINT_VARIABLE] += LEVEL_UP_POINT
  76.   end
  77.   def point_plus(param_id)
  78.     r=0
  79.     for i in 0 .. POINT_KIND-1
  80.       r+=$game_variables[self.id*(POINT_KIND+1) + POINT_VARIABLE+i+1]*POINT_ADD_PARAM[i][param_id]
  81.     end
  82.     return r
  83.   end
  84.  
  85.   alias point_base_param param
  86.  
  87.   def param(param_id)
  88.     value = param_base(param_id) + param_plus(param_id) + point_plus(param_id)
  89.     value *= param_rate(param_id) * param_buff_rate(param_id)
  90.     [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
  91.   end
  92.   def xparam(xparam_id)
  93.     xp = super(xparam_id)
  94.     for i in 0 .. POINT_KIND-1
  95.       xp+=($game_variables[self.id*(POINT_KIND+1) + POINT_VARIABLE+i+1]*POINT_ADD_XPARAM[i][xparam_id]/10000.0)
  96.     end
  97.     return xp
  98.   end
  99.   def item_apply(user, item)
  100.     super(user, item)
  101.     if item.id == RESET_ITEM and item.is_a?(RPG::Item)
  102.       reset(@actor_id)
  103.       self.hp = [self.hp,self.mhp].min
  104.       self.mp = [self.mp,self.mmp].min
  105.     end
  106.   end
  107. end
  108.  
  109. class Window_Point_Command < Window_Command
  110.  
  111.   include Point_Tree
  112.   #--------------------------------------------------------------------------
  113.   # ● 初始化指令选择位置(类方法)
  114.   #--------------------------------------------------------------------------
  115.   def self.init_command_position
  116.     @@last_command_symbol = nil
  117.   end
  118.   #--------------------------------------------------------------------------
  119.   # ● 初始化对象
  120.   #--------------------------------------------------------------------------
  121.   def initialize(actor)
  122.     @status_window = nil
  123.     @actor = actor
  124.     super(0,0)
  125.     select_last
  126.   end
  127.   def actor=(actor)
  128.     return if @actor == actor
  129.     @actor = actor
  130.     refresh
  131.   end
  132.   def status_window=(status_window)
  133.     return if @status_window == status_window
  134.     @status_window = status_window
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● 获取窗口的宽度
  138.   #--------------------------------------------------------------------------
  139.   def window_width
  140.     return 160
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # ● 获取显示行数
  144.   #--------------------------------------------------------------------------
  145.   def visible_line_number
  146.     item_max
  147.   end
  148.   def get_actor_point(id)
  149.     s = $game_variables[@actor.id*(POINT_KIND+1)+POINT_VARIABLE+id+1].to_s
  150.     return "("+s+")+"+$temp_point[id].to_s
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ● 生成指令列表
  154.   #--------------------------------------------------------------------------
  155.   def make_command_list
  156.     for i in 0 .. POINT_KIND-1
  157.       add_command(STR_POINT[i]   + get_actor_point(i)  , :point_add  ,add_enabled)
  158.     end
  159.     add_command("确认",  :point_ok)
  160.     add_command("取消",  :point_cancle)
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # ● 按下确定键时的处理
  164.   #--------------------------------------------------------------------------
  165.   def process_ok
  166.     @@last_command_symbol = current_symbol
  167.     super
  168.   end
  169.   #--------------------------------------------------------------------------
  170.   # ● 返回最后一个选项的位置
  171.   #--------------------------------------------------------------------------
  172.   def select_last
  173.     select_symbol(@@last_command_symbol)
  174.   end
  175.  
  176.   def add_enabled
  177.     temp_all < $game_variables[@actor.id*(POINT_KIND+1) + POINT_VARIABLE]
  178.   end
  179.  
  180.   def update_help
  181.     @help_window.set_text(self.index+1) if @help_window
  182.     @status_window.index = self.index if @status_window
  183.   end
  184. end
  185.  
  186. #帮助窗口
  187. class Window_Point_Help < Window_Base
  188.   include Point_Tree
  189.   def initialize(x,y,w,h)
  190.     super(x, y, w, h)
  191.  
  192.  
  193.   end
  194.   def set_text(id)
  195.     contents.clear
  196.     if id <= POINT_KIND
  197.       text = "\\}提升一点该属性"
  198.     elsif id == POINT_KIND+1
  199.       text = "\\}确认此次加点分配"
  200.     elsif  id == POINT_KIND+2
  201.       text = "\\}取消此次加点分配"
  202.     end
  203.     draw_text_ex(8, 8, text)
  204.   end
  205. end
  206.  
  207.  
  208. #角色状态窗口
  209. class Window_Point_Actor < Window_Base
  210.   include Point_Tree
  211.  
  212.  
  213.   def initialize(actor)
  214.     super(160, 0, Graphics.width - 160, Graphics.height)
  215.     @actor = actor
  216.     @index = 0
  217.     refresh
  218.   end
  219.   def actor=(actor)
  220.     return if @actor == actor
  221.     @actor = actor
  222.     refresh
  223.   end
  224.   def index=(index)
  225.     return if @index == index
  226.     @index = index
  227.     refresh
  228.   end
  229.   def line_height
  230.     return 24
  231.   end
  232.   def refresh
  233.     contents.clear
  234.     contents.font.size = 24
  235.     draw_actor_name(@actor, 100, 0)
  236.     draw_actor_class(@actor, 240, 0)
  237.     draw_actor_face(@actor, 2, 0)
  238.     contents.font.size = 20
  239.     draw_actor_level(@actor, 102,  24)
  240.     draw_actor_point(100,48)
  241.     contents.font.size = 16
  242.     draw_actor_param_point(8,16 * 6)
  243.     draw_actor_xparam_point(8,16 * 14)
  244.   end
  245.   def draw_actor_point(x,y)
  246.     draw_text(x,y,200,line_height,"  未分配"+POINT_NAME + ":" + $game_variables[@actor.id*(POINT_KIND+1) + POINT_VARIABLE].to_s)
  247.     draw_text(x,y+line_height,200,line_height,"此次分配"+POINT_NAME + ":" + temp_all.to_s)
  248.   end
  249.   def draw_actor_param_point(x,y)
  250.     8.times {|i| draw_actor_param_to_s(x,y,i)}
  251.   end
  252.   def draw_actor_xparam_point(x,y)
  253.     10.times {|i| draw_actor_xparam_to_s(x,y,i)}
  254.   end
  255.  
  256.   def draw_actor_param_to_s(x,y,param_id)
  257.     a=0
  258.     for i in 0 .. POINT_KIND-1
  259.       a+=$temp_point[i]*POINT_ADD_PARAM[i][param_id]
  260.     end
  261.     s1 = Vocab::param(param_id)
  262.     s2 = @actor.param(param_id).to_s
  263.     s3 = (@actor.param(param_id) + a).to_s
  264.     if @index < POINT_KIND
  265.       if POINT_ADD_PARAM[@index][param_id]==0
  266.         s4 = ""
  267.       else
  268.         s4 = "+" + POINT_ADD_PARAM[@index][param_id].to_s
  269.       end
  270.     else
  271.       s4 = ""
  272.     end
  273.  
  274.     change_color(system_color)
  275.     draw_text(x,y+16*param_id,100,line_height,s1)
  276.     change_color(normal_color)
  277.     s2+= " →"
  278.     draw_text(x+82,y+16*param_id,120,line_height,s2,2)
  279.     change_color(system_color)
  280.     draw_text(x+150,y+16*param_id,100,line_height,s3,2)
  281.     change_color(normal_color)
  282.     contents.font.size = 14
  283.     draw_text(x+266,y+16*param_id,100,line_height,s4)
  284.     contents.font.size = 16
  285.   end
  286.   def draw_actor_xparam_to_s(x,y,xparam_id)
  287.     a=0.00
  288.     for i in 0 .. POINT_KIND-1
  289.       a+=($temp_point[i]*POINT_ADD_XPARAM[i][xparam_id]/10000.0)
  290.     end
  291.     s1 = XARAM_NAME[xparam_id]
  292.     s2 = sprintf("%02.2f%%",@actor.xparam(xparam_id)*100)
  293.     s3 = sprintf("%02.2f%%",(@actor.xparam(xparam_id) + a)*100)
  294.  
  295.     if @index < POINT_KIND
  296.       if POINT_ADD_XPARAM[@index][xparam_id]==0
  297.         s4=""
  298.       else
  299.         s4 = sprintf("+%02.2f%%",POINT_ADD_XPARAM[@index][xparam_id]/100.0)
  300.       end
  301.     else
  302.       s4 = ""
  303.     end
  304.  
  305.     change_color(system_color)
  306.     draw_text(x,y+16*xparam_id,100,line_height,s1)
  307.     change_color(normal_color)
  308.     s2+= " →"
  309.     draw_text(x+82,y+16*xparam_id,120,line_height,s2,2)
  310.     change_color(system_color)
  311.     draw_text(x+150,y+16*xparam_id,100,line_height,s3,2)
  312.     change_color(normal_color)
  313.     contents.font.size = 14
  314.     draw_text(x+266,y+16*xparam_id,100,line_height,s4)
  315.     contents.font.size = 16
  316.  
  317.  
  318.   end
  319. end
  320.  
  321. class Scene_Point < Scene_Base
  322.   include Point_Tree
  323.   def start
  324.     super
  325.     create_background
  326.     @actor = $game_party.menu_actor
  327.     create_command_window
  328.     create_status_window
  329.     create_help_window
  330.     @command_window.activate
  331.   end
  332.   def terminate
  333.     super
  334.     dispose_background
  335.   end
  336.   def create_background
  337.     @background_sprite = Sprite.new
  338.     @background_sprite.bitmap = SceneManager.background_bitmap
  339.     @background_sprite.color.set(16, 16, 16, 128)
  340.   end
  341.   def dispose_background
  342.     @background_sprite.dispose
  343.   end
  344.  
  345.   def create_command_window
  346.     @command_window = Window_Point_Command.new(@actor)
  347.     @command_window.set_handler(:cancel,      method(:return_scene))
  348.     @command_window.set_handler(:pagedown,    method(:next_actor))
  349.     @command_window.set_handler(:pageup,      method(:prev_actor))
  350.     @command_window.set_handler(:point_add,   method(:add_point))
  351.     @command_window.set_handler(:point_ok,    method(:add_ok))
  352.     @command_window.set_handler(:point_cancle,method(:add_cancle))
  353.  
  354.   end
  355.   def return_scene
  356.     add_cancle
  357.     SceneManager.return
  358.   end
  359.   def create_status_window
  360.     @status_window = Window_Point_Actor.new(@actor)
  361.     @command_window.status_window = @status_window
  362.   end
  363.   def create_help_window
  364.     @help_window = Window_Point_Help.new(0,@command_window.height,160,[email]Graphics.height-@command_window.height[/email])
  365.     #(0, 216, 160, 200)
  366.     @help_window.viewport = @viewport
  367.     @command_window.help_window = @help_window
  368.   end
  369.  
  370.   def add_point
  371.     if temp_all >= $game_variables[@actor.id*(POINT_KIND+1) + POINT_VARIABLE]
  372.       @command_window.activate
  373.       return
  374.     end
  375.     $temp_point[@command_window.index] += 1
  376.     @status_window.refresh
  377.     @command_window.refresh
  378.     @command_window.activate
  379.   end
  380.  
  381.  
  382.   def add_ok
  383.     for i in 0 .. POINT_KIND-1
  384.       $game_variables[@actor.id*(POINT_KIND+1) + POINT_VARIABLE+i+1] += $temp_point[i]
  385.     end
  386.     $game_variables[@actor.id*(POINT_KIND+1) + POINT_VARIABLE] -= temp_all
  387.     add_cancle
  388.   end
  389.  
  390.   def add_cancle
  391.     for i in 0 .. POINT_KIND-1
  392.       $temp_point[i]=0
  393.     end
  394.     @status_window.refresh
  395.     @command_window.refresh
  396.     @command_window.activate
  397.   end
  398.  
  399.  
  400.   def next_actor
  401.     @actor = $game_party.menu_actor_next
  402.     on_actor_change
  403.   end
  404.   #--------------------------------------------------------------------------
  405.   # ● 切换到上一个角色
  406.   #--------------------------------------------------------------------------
  407.   def prev_actor
  408.     @actor = $game_party.menu_actor_prev
  409.     on_actor_change
  410.   end
  411.   #--------------------------------------------------------------------------
  412.   # ● 切换角色
  413.   #--------------------------------------------------------------------------
  414.   def on_actor_change
  415.     add_cancle
  416.     @status_window.actor = @actor
  417.     @command_window.actor = @actor
  418.     @command_window.activate
  419.   end
  420.  
  421. end
  422.  
  423. class Window_MenuCommand < Window_Command
  424.   alias add_original_commands_old add_original_commands
  425.   def add_original_commands
  426.     add_original_commands_old
  427.     add_command(Point_Tree::ADDPOINT,    :addpoint)
  428.   end
  429. end
  430.  
  431. class Scene_Menu < Scene_MenuBase
  432.   alias create_command_window_old create_command_window
  433.   def create_command_window
  434.     create_command_window_old
  435.     @command_window.set_handler(:addpoint,method(:add_point))
  436.   end
  437.   def add_point
  438.     @status_window.select_last
  439.     @status_window.activate
  440.     @status_window.set_handler(:ok,     method(:on_ok))
  441.     @status_window.set_handler(:cancel, method(:on_personal_cancel))
  442.   end
  443.   def on_ok
  444.     SceneManager.call(Scene_Point)
  445.     Window_Point_Command::init_command_position
  446.   end
  447. end
  448.  
  449.  
  450.  
  451. class Scene_ItemBase < Scene_MenuBase
  452.   def item_usable?
  453.     if item.id == Point_Tree::RESET_ITEM
  454.       return true
  455.     end
  456.     user.usable?(item) && item_effects_valid?
  457.   end
  458. end
  459.  
  460.  
  461.  
  462.  
  463.  
  464. class Window_Status < Window_Selectable
  465.   include Point_Tree
  466.   alias draw_parameters_old draw_parameters
  467.   def draw_parameters(x, y)
  468.     draw_parameters_old(x,y)
  469.     draw_point(x,y)
  470.   end
  471.   def draw_point(x,y)
  472.     for i in 0..5
  473.       change_color(system_color)
  474.       draw_text(x+100, y+ line_height * i, 80, line_height, STR_POINT[i])
  475.       change_color(normal_color)
  476.       draw_text(x+180, y+ line_height * i, 36, line_height,@actor.point[i+1], 2)
  477.     end
  478.   end
  479.  
  480. end
  481.  
  482. class Window_Base < Window
  483.   def draw_actor_param(actor, x, y, param_id)
  484.     change_color(system_color)
  485.     draw_text(x-30, y, 80, line_height, Vocab::param(param_id))
  486.     change_color(normal_color)
  487.     draw_text(x+ 50, y, 36, line_height, actor.param(param_id), 2)
  488.   end
  489. end
------落尽红樱君不见,轻绘梨花泪沾衣。~~~

Lv3.寻梦者

梦石
0
星屑
2392
在线时间
912 小时
注册时间
2014-10-14
帖子
1331

开拓者

3
 楼主| 发表于 2017-6-21 14:05:26 | 只看该作者
百里_飞柳 发表于 2017-6-21 09:16
SceneManager.call(Scene_Point)
看下里面对menu类的改写就知道了

测试 根本无法使用{:2_271:}  能看看咋了吗。。。

360截图20170621140422047.jpg (21.08 KB, 下载次数: 17)

360截图20170621140422047.jpg

点评

谢谢 可以使用~\(≧▽≦)/~啦啦啦  发表于 2017-6-21 23:19
Window_Point_Command::init_command_position 还有这一句  发表于 2017-6-21 15:54
------落尽红樱君不见,轻绘梨花泪沾衣。~~~
回复 支持 反对

使用道具 举报

Lv6.析梦学徒

老鹰

梦石
40
星屑
35602
在线时间
6821 小时
注册时间
2012-5-26
帖子
3276

极短24评委极短23参与极短22参与极短21评委老司机慢点开短篇十吟唱者组别冠军开拓者剧作品鉴家

2
发表于 2017-6-21 09:16:45 | 只看该作者
SceneManager.call(Scene_Point)
看下里面对menu类的改写就知道了

点评

谢谢 下次一定仔细看  发表于 2017-6-21 13:45

评分

参与人数 1梦石 +1 收起 理由
VIPArcher + 1 清陈年老帖 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-22 05:51

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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