查看: 3023|回复: 5

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

[复制链接]
梦石
0
星屑
2457
在线时间
912 小时
注册时间
2014-10-14
回帖
1155

开拓者

发表于 2017-6-21 00:58:52 | 显示全部楼层 |阅读模式

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

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

×


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

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

  1. #encoding:utf-8
  2. #=============================================================================
  3. #-----------RMVA加点系统正常向-v1.01---By:救世小树--------转载请注明出处-------
  4. #=============================================================================

  5. module Point_Tree
  6.   
  7.   POINT_VARIABLE = 33
  8.   POINT_KIND     = 6             #设定加点种类
  9.   #储存属性点的变量编号是33+角色id*(6+1),
  10.   #即40号变量为一号角色自由点;41号起6个变量为1号角色6个种类的已加点值
  11.   
  12.   LEVEL_UP_POINT = 3
  13.   #每升一级属性点增加数
  14.   
  15.   RESET_ITEM     = 20   #洗点水编号
  16.   
  17.   STR_POINT        = ["体力","精神","力量","魔力","韧性","灵活","???"]
  18.   #分别对应增加       [MHP,MMP,物攻,物防,魔攻,魔防,敏捷,幸运]
  19.   POINT_ADD_PARAM = [[12 ,  0,   0,  0,   0,   0,   0,   0],     #体力
  20.                      [0  , 12,   0,  0,   0,   0,   0,   0],     #精神
  21.                      [0  ,  0,   5,  0,   0,   0,   0,   0],     #力量
  22.                      [0  ,  0,   0,  0,   5,   0,   0,   0],     #魔力
  23.                      [0  ,  0,   0,  3,   0,   2,   0,   1],     #韧性
  24.                      [0  ,  0,   0,  0,   0,   0,   3,   0],     #灵活
  25.                      
  26.                      [0,0,0,0,0,0,0,0]]
  27.                      #可以按上面的格式添加下去,不过要改POINT_KIND,STR_ALL,不然加了也白加
  28.   
  29.   #分别对应增加       [物理命中,物理闪避,必杀,必杀闪避,魔法闪避,魔法反射,物理反击,HP再生,Mp再生,Tp再生]
  30.   POINT_ADD_XPARAM = [[0 , 0, 0, 0, 0, 0, 0, 6, 0, 0],
  31.                       [0 , 0, 0, 0, 0, 0, 0, 0, 6, 0],
  32.                       [6 , 6, 0, 0, 0, 0, 0, 0, 0, 0],
  33.                       [0 , 0, 6, 0, 0, 0, 0, 0, 0, 0],
  34.                       [0 , 0, 0, 0, 0, 0, 0, 4, 4, 0],
  35.                       [0 , 6, 0, 6, 6, 0, 0, 0, 0, 0],
  36.                      
  37.                       [0,0,0,0,0,0,0,0,0,0]]
  38.                      #这里的单位是万分之一数值也就是0.01%,我随便填了下【别嫌小,够大了,有心情你可以算算看平衡性】
  39.   
  40.   #各种名称
  41.   ADDPOINT       = "加点"   #菜单中选项
  42.   
  43.   POINT_NAME     = "属性点" #未分配点数
  44.   
  45.   XARAM_NAME     = ["物理命中","物理闪避","必杀","必杀闪避","魔法闪避","魔法反射","物理反击","HP再生","Mp再生","Tp再生"]
  46.   def reset(actor_id)
  47.     for i in 1..6
  48.       $game_variables[actor_id*(POINT_KIND+1) + POINT_VARIABLE]+=$game_variables[actor_id*(POINT_KIND+1) + POINT_VARIABLE+i]
  49.       $game_variables[actor_id*(POINT_KIND+1) + POINT_VARIABLE+i]=0
  50.     end
  51.   end
  52.   
  53.   def temp_all
  54.     r = 0
  55.     for i in 0 .. POINT_KIND-1
  56.       r+=$temp_point[i]
  57.     end
  58.     return r
  59.   end
  60.   
  61. end
  62. $temp_point = []
  63. for i in 0 .. Point_Tree::POINT_KIND-1
  64.   $temp_point.push(0)
  65. end

  66. class Game_Actor < Game_Battler
  67.   include Point_Tree
  68.   alias level_up_tre level_up
  69.   def level_up
  70.     level_up_tre
  71.     @hp += mhp
  72.     @mp += mmp
  73.     $game_variables[self.id*(POINT_KIND+1) + POINT_VARIABLE] += LEVEL_UP_POINT
  74.   end
  75.   def point_plus(param_id)
  76.     r=0
  77.     for i in 0 .. POINT_KIND-1
  78.       r+=$game_variables[self.id*(POINT_KIND+1) + POINT_VARIABLE+i+1]*POINT_ADD_PARAM[i][param_id]
  79.     end
  80.     return r
  81.   end

  82.   alias point_base_param param
  83.   
  84.   def param(param_id)
  85.     value = param_base(param_id) + param_plus(param_id) + point_plus(param_id)
  86.     value *= param_rate(param_id) * param_buff_rate(param_id)
  87.     [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
  88.   end
  89.   def xparam(xparam_id)
  90.     xp = super(xparam_id)
  91.     for i in 0 .. POINT_KIND-1
  92.       xp+=($game_variables[self.id*(POINT_KIND+1) + POINT_VARIABLE+i+1]*POINT_ADD_XPARAM[i][xparam_id]/10000.0)
  93.     end
  94.     return xp
  95.   end
  96.   def item_apply(user, item)
  97.     super(user, item)
  98.     if item.id == RESET_ITEM and item.is_a?(RPG::Item)
  99.       reset(@actor_id)
  100.       self.hp = [self.hp,self.mhp].min
  101.       self.mp = [self.mp,self.mmp].min
  102.     end
  103.   end
  104. end

  105. class Window_Point_Command < Window_Command
  106.   
  107.   include Point_Tree
  108.   #--------------------------------------------------------------------------
  109.   # ● 初始化指令选择位置(类方法)
  110.   #--------------------------------------------------------------------------
  111.   def self.init_command_position
  112.     @@last_command_symbol = nil
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● 初始化对象
  116.   #--------------------------------------------------------------------------
  117.   def initialize(actor)
  118.     @status_window = nil
  119.     @actor = actor
  120.     super(0,0)
  121.     select_last
  122.   end
  123.   def actor=(actor)
  124.     return if @actor == actor
  125.     @actor = actor
  126.     refresh
  127.   end
  128.   def status_window=(status_window)
  129.     return if @status_window == status_window
  130.     @status_window = status_window
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   # ● 获取窗口的宽度
  134.   #--------------------------------------------------------------------------
  135.   def window_width
  136.     return 160
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● 获取显示行数
  140.   #--------------------------------------------------------------------------
  141.   def visible_line_number
  142.     item_max
  143.   end
  144.   def get_actor_point(id)
  145.     s = $game_variables[@actor.id*(POINT_KIND+1)+POINT_VARIABLE+id+1].to_s
  146.     return "("+s+")+"+$temp_point[id].to_s
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # ● 生成指令列表
  150.   #--------------------------------------------------------------------------
  151.   def make_command_list
  152.     for i in 0 .. POINT_KIND-1
  153.       add_command(STR_POINT[i]   + get_actor_point(i)  , :point_add  ,add_enabled)
  154.     end
  155.     add_command("确认",  :point_ok)
  156.     add_command("取消",  :point_cancle)
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # ● 按下确定键时的处理
  160.   #--------------------------------------------------------------------------
  161.   def process_ok
  162.     @@last_command_symbol = current_symbol
  163.     super
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● 返回最后一个选项的位置
  167.   #--------------------------------------------------------------------------
  168.   def select_last
  169.     select_symbol(@@last_command_symbol)
  170.   end
  171.   
  172.   def add_enabled
  173.     temp_all < $game_variables[@actor.id*(POINT_KIND+1) + POINT_VARIABLE]
  174.   end

  175.   def update_help
  176.     @help_window.set_text(self.index+1) if @help_window
  177.     @status_window.index = self.index if @status_window
  178.   end
  179. end

  180. #帮助窗口
  181. class Window_Point_Help < Window_Base
  182.   include Point_Tree
  183.   def initialize(x,y,w,h)
  184.     super(x, y, w, h)
  185.    
  186.    
  187.   end
  188.   def set_text(id)
  189.     contents.clear
  190.     if id <= POINT_KIND
  191.       text = "\\}提升一点该属性"
  192.     elsif id == POINT_KIND+1
  193.       text = "\\}确认此次加点分配"
  194.     elsif  id == POINT_KIND+2
  195.       text = "\\}取消此次加点分配"
  196.     end
  197.     draw_text_ex(8, 8, text)
  198.   end
  199. end


  200. #角色状态窗口
  201. class Window_Point_Actor < Window_Base
  202.   include Point_Tree
  203.   
  204.   
  205.   def initialize(actor)
  206.     super(160, 0, Graphics.width - 160, Graphics.height)
  207.     @actor = actor
  208.     @index = 0
  209.     refresh
  210.   end
  211.   def actor=(actor)
  212.     return if @actor == actor
  213.     @actor = actor
  214.     refresh
  215.   end
  216.   def index=(index)
  217.     return if @index == index
  218.     @index = index
  219.     refresh
  220.   end
  221.   def line_height
  222.     return 24
  223.   end
  224.   def refresh
  225.     contents.clear
  226.     contents.font.size = 24
  227.     draw_actor_name(@actor, 100, 0)
  228.     draw_actor_class(@actor, 240, 0)
  229.     draw_actor_face(@actor, 2, 0)
  230.     contents.font.size = 20
  231.     draw_actor_level(@actor, 102,  24)
  232.     draw_actor_point(100,48)
  233.     contents.font.size = 16
  234.     draw_actor_param_point(8,16 * 6)
  235.     draw_actor_xparam_point(8,16 * 14)
  236.   end
  237.   def draw_actor_point(x,y)
  238.     draw_text(x,y,200,line_height,"  未分配"+POINT_NAME + ":" + $game_variables[@actor.id*(POINT_KIND+1) + POINT_VARIABLE].to_s)
  239.     draw_text(x,y+line_height,200,line_height,"此次分配"+POINT_NAME + ":" + temp_all.to_s)
  240.   end
  241.   def draw_actor_param_point(x,y)
  242.     8.times {|i| draw_actor_param_to_s(x,y,i)}
  243.   end
  244.   def draw_actor_xparam_point(x,y)
  245.     10.times {|i| draw_actor_xparam_to_s(x,y,i)}
  246.   end
  247.   
  248.   def draw_actor_param_to_s(x,y,param_id)
  249.     a=0
  250.     for i in 0 .. POINT_KIND-1
  251.       a+=$temp_point[i]*POINT_ADD_PARAM[i][param_id]
  252.     end
  253.     s1 = Vocab::param(param_id)
  254.     s2 = @actor.param(param_id).to_s
  255.     s3 = (@actor.param(param_id) + a).to_s
  256.     if @index < POINT_KIND
  257.       if POINT_ADD_PARAM[@index][param_id]==0
  258.         s4 = ""
  259.       else
  260.         s4 = "+" + POINT_ADD_PARAM[@index][param_id].to_s
  261.       end
  262.     else
  263.       s4 = ""
  264.     end
  265.    
  266.     change_color(system_color)
  267.     draw_text(x,y+16*param_id,100,line_height,s1)
  268.     change_color(normal_color)
  269.     s2+= " →"
  270.     draw_text(x+82,y+16*param_id,120,line_height,s2,2)
  271.     change_color(system_color)
  272.     draw_text(x+150,y+16*param_id,100,line_height,s3,2)
  273.     change_color(normal_color)
  274.     contents.font.size = 14
  275.     draw_text(x+266,y+16*param_id,100,line_height,s4)
  276.     contents.font.size = 16
  277.   end
  278.   def draw_actor_xparam_to_s(x,y,xparam_id)
  279.     a=0.00
  280.     for i in 0 .. POINT_KIND-1
  281.       a+=($temp_point[i]*POINT_ADD_XPARAM[i][xparam_id]/10000.0)
  282.     end
  283.     s1 = XARAM_NAME[xparam_id]
  284.     s2 = sprintf("%02.2f%%",@actor.xparam(xparam_id)*100)
  285.     s3 = sprintf("%02.2f%%",(@actor.xparam(xparam_id) + a)*100)

  286.     if @index < POINT_KIND
  287.       if POINT_ADD_XPARAM[@index][xparam_id]==0
  288.         s4=""
  289.       else
  290.         s4 = sprintf("+%02.2f%%",POINT_ADD_XPARAM[@index][xparam_id]/100.0)
  291.       end
  292.     else
  293.       s4 = ""
  294.     end
  295.    
  296.     change_color(system_color)
  297.     draw_text(x,y+16*xparam_id,100,line_height,s1)
  298.     change_color(normal_color)
  299.     s2+= " →"
  300.     draw_text(x+82,y+16*xparam_id,120,line_height,s2,2)
  301.     change_color(system_color)
  302.     draw_text(x+150,y+16*xparam_id,100,line_height,s3,2)
  303.     change_color(normal_color)
  304.     contents.font.size = 14
  305.     draw_text(x+266,y+16*xparam_id,100,line_height,s4)
  306.     contents.font.size = 16
  307.    
  308.    
  309.   end
  310. end

  311. class Scene_Point < Scene_Base
  312.   include Point_Tree
  313.   def start
  314.     super
  315.     create_background
  316.     @actor = $game_party.menu_actor
  317.     create_command_window
  318.     create_status_window
  319.     create_help_window
  320.     @command_window.activate
  321.   end
  322.   def terminate
  323.     super
  324.     dispose_background
  325.   end
  326.   def create_background
  327.     @background_sprite = Sprite.new
  328.     @background_sprite.bitmap = SceneManager.background_bitmap
  329.     @background_sprite.color.set(16, 16, 16, 128)
  330.   end
  331.   def dispose_background
  332.     @background_sprite.dispose
  333.   end
  334.   
  335.   def create_command_window
  336.     @command_window = Window_Point_Command.new(@actor)
  337.     @command_window.set_handler(:cancel,      method(:return_scene))
  338.     @command_window.set_handler(:pagedown,    method(:next_actor))
  339.     @command_window.set_handler(:pageup,      method(:prev_actor))
  340.     @command_window.set_handler(:point_add,   method(:add_point))
  341.     @command_window.set_handler(:point_ok,    method(:add_ok))
  342.     @command_window.set_handler(:point_cancle,method(:add_cancle))
  343.    
  344.   end
  345.   def return_scene
  346.     add_cancle
  347.     SceneManager.return
  348.   end
  349.   def create_status_window
  350.     @status_window = Window_Point_Actor.new(@actor)
  351.     @command_window.status_window = @status_window
  352.   end
  353.   def create_help_window
  354.     @help_window = Window_Point_Help.new(0,@command_window.height,160,[email]Graphics.height-@command_window.height[/email])
  355.     #(0, 216, 160, 200)
  356.     @help_window.viewport = @viewport
  357.     @command_window.help_window = @help_window
  358.   end
  359.   
  360.   def add_point
  361.     if temp_all >= $game_variables[@actor.id*(POINT_KIND+1) + POINT_VARIABLE]
  362.       @command_window.activate
  363.       return
  364.     end
  365.     $temp_point[@command_window.index] += 1
  366.     @status_window.refresh
  367.     @command_window.refresh
  368.     @command_window.activate
  369.   end
  370.   

  371.   def add_ok
  372.     for i in 0 .. POINT_KIND-1
  373.       $game_variables[@actor.id*(POINT_KIND+1) + POINT_VARIABLE+i+1] += $temp_point[i]
  374.     end
  375.     $game_variables[@actor.id*(POINT_KIND+1) + POINT_VARIABLE] -= temp_all
  376.     add_cancle
  377.   end
  378.   
  379.   def add_cancle
  380.     for i in 0 .. POINT_KIND-1
  381.       $temp_point[i]=0
  382.     end
  383.     @status_window.refresh
  384.     @command_window.refresh
  385.     @command_window.activate
  386.   end
  387.   
  388.   
  389.   def next_actor
  390.     @actor = $game_party.menu_actor_next
  391.     on_actor_change
  392.   end
  393.   #--------------------------------------------------------------------------
  394.   # ● 切换到上一个角色
  395.   #--------------------------------------------------------------------------
  396.   def prev_actor
  397.     @actor = $game_party.menu_actor_prev
  398.     on_actor_change
  399.   end
  400.   #--------------------------------------------------------------------------
  401.   # ● 切换角色
  402.   #--------------------------------------------------------------------------
  403.   def on_actor_change
  404.     add_cancle
  405.     @status_window.actor = @actor
  406.     @command_window.actor = @actor
  407.     @command_window.activate
  408.   end
  409.   
  410. end

  411. class Window_MenuCommand < Window_Command
  412.   alias add_original_commands_old add_original_commands
  413.   def add_original_commands
  414.     add_original_commands_old
  415.     add_command(Point_Tree::ADDPOINT,    :addpoint)
  416.   end
  417. end

  418. class Scene_Menu < Scene_MenuBase
  419.   alias create_command_window_old create_command_window
  420.   def create_command_window
  421.     create_command_window_old
  422.     @command_window.set_handler(:addpoint,method(:add_point))
  423.   end
  424.   def add_point
  425.     @status_window.select_last
  426.     @status_window.activate
  427.     @status_window.set_handler(:ok,     method(:on_ok))
  428.     @status_window.set_handler(:cancel, method(:on_personal_cancel))
  429.   end
  430.   def on_ok
  431.     SceneManager.call(Scene_Point)
  432.     Window_Point_Command::init_command_position
  433.   end
  434. end



  435. class Scene_ItemBase < Scene_MenuBase
  436.   def item_usable?
  437.     if item.id == Point_Tree::RESET_ITEM
  438.       return true
  439.     end
  440.     user.usable?(item) && item_effects_valid?
  441.   end
  442. end





  443. class Window_Status < Window_Selectable
  444.   include Point_Tree
  445.   alias draw_parameters_old draw_parameters
  446.   def draw_parameters(x, y)
  447.     draw_parameters_old(x,y)
  448.     draw_point(x,y)
  449.   end
  450.   def draw_point(x,y)
  451.     for i in 0..5
  452.       change_color(system_color)
  453.       draw_text(x+100, y+ line_height * i, 80, line_height, STR_POINT[i])
  454.       change_color(normal_color)
  455.       draw_text(x+180, y+ line_height * i, 36, line_height,@actor.point[i+1], 2)
  456.     end
  457.   end
  458.   
  459. end

  460. class Window_Base < Window
  461.   def draw_actor_param(actor, x, y, param_id)
  462.     change_color(system_color)
  463.     draw_text(x-30, y, 80, line_height, Vocab::param(param_id))
  464.     change_color(normal_color)
  465.     draw_text(x+ 50, y, 36, line_height, actor.param(param_id), 2)
  466.   end
  467. end
复制代码
------落尽红樱君不见,轻绘梨花泪沾衣。~~~

老鹰

梦石
40
星屑
38049
在线时间
7128 小时
注册时间
2012-5-26
回帖
3306

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

发表于 2017-6-21 09:16:45 | 显示全部楼层
SceneManager.call(Scene_Point)
看下里面对menu类的改写就知道了

点评

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

评分

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

查看全部评分

回复

使用道具 举报

梦石
0
星屑
2457
在线时间
912 小时
注册时间
2014-10-14
回帖
1155

开拓者

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

测试 根本无法使用{:2_271:}  能看看咋了吗。。。
360截图20170621140422047.jpg

点评

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

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部