Project1

标题: 新人关于脚本问题 [打印本页]

作者: b209009    时间: 2011-11-2 19:11
标题: 新人关于脚本问题
本帖最后由 b209009 于 2011-11-3 17:09 编辑
  1. #等级可无限提升
  2. #パラメータの算出が適当すぎるので、各自修正が必要かと。
  3.   BASE_FINAL_LEVEL = 9999   #上限レベル(あんまり大きな値を設定するとハングします)
  4.   MAXHP_LIMIT = 99999999    #HP限界値
  5.   MAXSP_LIMIT = 99999999    #SP限界値
  6.   STR_LIMIT   = 999999      #STR限界値
  7.   DEX_LIMIT   = 999999      #DEX限界値
  8.   AGI_LIMIT   = 999999      #AGI限界値
  9.   INT_LIMIT   = 999999      #INT限界値
  10. class Game_Actor < Game_Battler
  11.   def new_final_level
  12.     lv = BASE_FINAL_LEVEL
  13.     #以下上限LV個別指定用
  14.     #case self.id
  15.     #when 1
  16.     #  lv = 255
  17.     #when 2
  18.     #  lv = 999
  19.     #when 8
  20.     #  lv = 15600
  21.     #end
  22.     return lv
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● EXP 計算
  26.   #--------------------------------------------------------------------------
  27.   def make_exp_list
  28.     actor = $data_actors[@actor_id]
  29.     @exp_list = Array.new(new_final_level + 2)
  30.     @exp_list[1] = 0
  31.     pow_i = 2.4 + actor.exp_inflation / 100.0
  32.     for i in 2..new_final_level + 1
  33.       if i > new_final_level
  34.         @exp_list[i] = 0
  35.       else
  36.         n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i)
  37.         @exp_list[i] = @exp_list[i-1] + Integer(n)
  38.       end
  39.     end
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # ● MaxHP の取得
  43.   #--------------------------------------------------------------------------
  44.   def maxhp
  45.     n = [[base_maxhp + @maxhp_plus, 1].max, MAXHP_LIMIT].min
  46.     for i in @states
  47.       n *= $data_states[i].maxhp_rate / 100.0
  48.     end
  49.     n = [[Integer(n), 1].max, MAXHP_LIMIT].min
  50.     return n
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # ● 基本 MaxHP の取得
  54.   #--------------------------------------------------------------------------
  55.   def base_maxhp
  56.     n = $data_actors[@actor_id].parameters[0, 1]
  57.     n += $data_actors[@actor_id].parameters[0, 2] * @level
  58.     return n
  59.   end
  60.   #--------------------------------------------------------------------------
  61.   # ● 基本 MaxSP の取得
  62.   #--------------------------------------------------------------------------
  63.   def base_maxsp
  64.     n = $data_actors[@actor_id].parameters[1, 1]
  65.     n += $data_actors[@actor_id].parameters[1, 2] * @level
  66.     return n
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   # ● 基本腕力の取得
  70.   #--------------------------------------------------------------------------
  71.   def base_str
  72.     n = $data_actors[@actor_id].parameters[2, 1]
  73.     n += $data_actors[@actor_id].parameters[2, 2] * @level
  74.     weapon = $data_weapons[@weapon_id]
  75.     armor1 = $data_armors[@armor1_id]
  76.     armor2 = $data_armors[@armor2_id]
  77.     armor3 = $data_armors[@armor3_id]
  78.     armor4 = $data_armors[@armor4_id]
  79.     n += weapon != nil ? weapon.str_plus : 0
  80.     n += armor1 != nil ? armor1.str_plus : 0
  81.     n += armor2 != nil ? armor2.str_plus : 0
  82.     n += armor3 != nil ? armor3.str_plus : 0
  83.     n += armor4 != nil ? armor4.str_plus : 0
  84.     return [[n, 1].max, STR_LIMIT].min
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   # ● 基本器用さの取得
  88.   #--------------------------------------------------------------------------
  89.   def base_dex
  90.     n = $data_actors[@actor_id].parameters[3, 1]
  91.     n += $data_actors[@actor_id].parameters[3, 2] * @level
  92.     weapon = $data_weapons[@weapon_id]
  93.     armor1 = $data_armors[@armor1_id]
  94.     armor2 = $data_armors[@armor2_id]
  95.     armor3 = $data_armors[@armor3_id]
  96.     armor4 = $data_armors[@armor4_id]
  97.     n += weapon != nil ? weapon.dex_plus : 0
  98.     n += armor1 != nil ? armor1.dex_plus : 0
  99.     n += armor2 != nil ? armor2.dex_plus : 0
  100.     n += armor3 != nil ? armor3.dex_plus : 0
  101.     n += armor4 != nil ? armor4.dex_plus : 0
  102.     return [[n, 1].max, DEX_LIMIT].min
  103.   end
  104.   #--------------------------------------------------------------------------
  105.   # ● 基本素早さの取得
  106.   #--------------------------------------------------------------------------
  107.   def base_agi
  108.     n = $data_actors[@actor_id].parameters[4, 1]
  109.     n += $data_actors[@actor_id].parameters[4, 2] * @level
  110.     weapon = $data_weapons[@weapon_id]
  111.     armor1 = $data_armors[@armor1_id]
  112.     armor2 = $data_armors[@armor2_id]
  113.     armor3 = $data_armors[@armor3_id]
  114.     armor4 = $data_armors[@armor4_id]
  115.     n += weapon != nil ? weapon.agi_plus : 0
  116.     n += armor1 != nil ? armor1.agi_plus : 0
  117.     n += armor2 != nil ? armor2.agi_plus : 0
  118.     n += armor3 != nil ? armor3.agi_plus : 0
  119.     n += armor4 != nil ? armor4.agi_plus : 0
  120.     return [[n, 1].max, AGI_LIMIT].min
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ● 基本魔力の取得
  124.   #--------------------------------------------------------------------------
  125.   def base_int
  126.     n = $data_actors[@actor_id].parameters[5, 1]
  127.     n += $data_actors[@actor_id].parameters[5, 2] * @level
  128.     weapon = $data_weapons[@weapon_id]
  129.     armor1 = $data_armors[@armor1_id]
  130.     armor2 = $data_armors[@armor2_id]
  131.     armor3 = $data_armors[@armor3_id]
  132.     armor4 = $data_armors[@armor4_id]
  133.     n += weapon != nil ? weapon.int_plus : 0
  134.     n += armor1 != nil ? armor1.int_plus : 0
  135.     n += armor2 != nil ? armor2.int_plus : 0
  136.     n += armor3 != nil ? armor3.int_plus : 0
  137.     n += armor4 != nil ? armor4.int_plus : 0
  138.     return [[n, 1].max, INT_LIMIT].min
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ● EXP の変更
  142.   #     exp : 新しい EXP
  143.   #--------------------------------------------------------------------------
  144.   def exp=(exp)
  145.     # ★EXPの上限チェックを解除
  146.     @exp = [exp, 0].max
  147.     # レベルアップ
  148.     while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
  149.       @level += 1
  150.       # スキル習得
  151.       for j in $data_classes[@class_id].learnings
  152.         if j.level == @level
  153.           learn_skill(j.skill_id)
  154.         end
  155.       end
  156.     end
  157.     # レベルダウン
  158.     while @exp < @exp_list[@level]
  159.       @level -= 1
  160.     end
  161.     # 現在の HP と SP が最大値を超えていたら修正
  162.     @hp = [@hp, self.maxhp].min
  163.     @sp = [@sp, self.maxsp].min
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● レベルの変更
  167.   #     level : 新しいレベル
  168.   #--------------------------------------------------------------------------
  169.   def level=(level)
  170.     # 上下限チェック
  171.     # ★LV上限をnew_final_levelでチェックするように変更
  172.     level = [[level, new_final_level].min, 1].max
  173.     # EXP を変更
  174.     self.exp = @exp_list[level]
  175.   end
  176. end
  177.   
  178.   
  179. class Game_Battler
  180.   #--------------------------------------------------------------------------
  181.   # ● MaxSP の取得
  182.   #--------------------------------------------------------------------------
  183.   def maxsp
  184.     n = [[base_maxsp + @maxsp_plus, 0].max, MAXSP_LIMIT].min
  185.     for i in @states
  186.       n *= $data_states[i].maxsp_rate / 100.0
  187.     end
  188.     n = [[Integer(n), 0].max, MAXSP_LIMIT].min
  189.     return n
  190.   end
  191.   #--------------------------------------------------------------------------
  192.   # ● 腕力の取得
  193.   #--------------------------------------------------------------------------
  194.   def str
  195.     n = [[base_str + @str_plus, 1].max, STR_LIMIT].min
  196.     for i in @states
  197.       n *= $data_states[i].str_rate / 100.0
  198.     end
  199.     n = [[Integer(n), 1].max, STR_LIMIT].min
  200.     return n
  201.   end
  202.   #--------------------------------------------------------------------------
  203.   # ● 器用さの取得
  204.   #--------------------------------------------------------------------------
  205.   def dex
  206.     n = [[base_dex + @dex_plus, 1].max, DEX_LIMIT].min
  207.     for i in @states
  208.       n *= $data_states[i].dex_rate / 100.0
  209.     end
  210.     n = [[Integer(n), 1].max, DEX_LIMIT].min
  211.     return n
  212.   end
  213.   #--------------------------------------------------------------------------
  214.   # ● 素早さの取得
  215.   #--------------------------------------------------------------------------
  216.   def agi
  217.     n = [[base_agi + @agi_plus, 1].max, AGI_LIMIT].min
  218.     for i in @states
  219.       n *= $data_states[i].agi_rate / 100.0
  220.     end
  221.     n = [[Integer(n), 1].max, AGI_LIMIT].min
  222.     return n
  223.   end
  224.   #--------------------------------------------------------------------------
  225.   # ● 魔力の取得
  226.   #--------------------------------------------------------------------------
  227.   def int
  228.     n = [[base_int + @int_plus, 1].max, INT_LIMIT].min
  229.     for i in @states
  230.       n *= $data_states[i].int_rate / 100.0
  231.     end
  232.     n = [[Integer(n), 1].max, INT_LIMIT].min
  233.     return n
  234.   end
  235.   #--------------------------------------------------------------------------
  236.   # ● MaxHP の設定
  237.   #     maxhp : 新しい MaxHP
  238.   #--------------------------------------------------------------------------
  239.   def maxhp=(maxhp)
  240.     @maxhp_plus += maxhp - self.maxhp
  241.     @maxhp_plus = [[@maxhp_plus, -MAXHP_LIMIT].max, MAXHP_LIMIT].min
  242.     @hp = [@hp, self.maxhp].min
  243.   end
  244.   #--------------------------------------------------------------------------
  245.   # ● MaxSP の設定
  246.   #     maxsp : 新しい MaxSP
  247.   #--------------------------------------------------------------------------
  248.   def maxsp=(maxsp)
  249.     @maxsp_plus += maxsp - self.maxsp
  250.     @maxsp_plus = [[@maxsp_plus, -MAXSP_LIMIT].max, MAXSP_LIMIT].min
  251.     @sp = [@sp, self.maxsp].min
  252.   end
  253.   #--------------------------------------------------------------------------
  254.   # ● 腕力の設定
  255.   #     str : 新しい腕力
  256.   #--------------------------------------------------------------------------
  257.   def str=(str)
  258.     @str_plus += str - self.str
  259.     @str_plus = [[@str_plus, -STR_LIMIT].max, STR_LIMIT].min
  260.   end
  261.   #--------------------------------------------------------------------------
  262.   # ● 器用さの設定
  263.   #     dex : 新しい器用さ
  264.   #--------------------------------------------------------------------------
  265.   def dex=(dex)
  266.     @dex_plus += dex - self.dex
  267.     @dex_plus = [[@dex_plus, -DEX_LIMIT].max, DEX_LIMIT].min
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ● 素早さの設定
  271.   #     agi : 新しい素早さ
  272.   #--------------------------------------------------------------------------
  273.   def agi=(agi)
  274.     @agi_plus += agi - self.agi
  275.     @agi_plus = [[@agi_plus, -AGI_LIMIT].max, AGI_LIMIT].min
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # ● 魔力の設定
  279.   #     int : 新しい魔力
  280.   #--------------------------------------------------------------------------
  281.   def int=(int)
  282.     @int_plus += int - self.int
  283.     @int_plus = [[@int_plus, -INT_LIMIT].max, INT_LIMIT].min
  284.   end
  285. end
复制代码
刚在网上复制了个突破等级,能力脚本。本身741HP,但弄上脚本就1551。其它的都是RMXP自带的脚本无修改。


dsu_plus_rewardpost_czw
作者: iisnow    时间: 2011-11-3 17:22
这个脚本的用法是这样的:
设定的1级时的属性作为基础属性
每升一级就会加上第2级时的相应属性

就是说公式为:
y[n] = x[1] + x[2] * n

Y[n]为使用脚本后游戏中的数值
X[n]为你设定的数值
2级以后的数据是没有用的






欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1