Advertisement
kurashi

Player Stat Allocation Choice v 1.0[RGSS3]

Jan 5th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.02 KB | None | 0 0
  1. =begin
  2. Player Stat Allocation Choice v 1.0
  3. Created by Kio Kurashi
  4. Version History:
  5. 1.0 = Initial Version
  6.  
  7. Free for commercial and personal use. Credit is not required, but appreciated.
  8.  
  9. Known bugs: None.
  10.  
  11. Instructions: Use a Script Call command (Page 3) in an Event with the following:
  12.     give_stats( amount, Actor ID)
  13.  
  14. Example(Natalie gets 5 points):
  15.     give_stats(5, 2)
  16.  
  17. If the second value is left out it will default to Actor 1.
  18. =end
  19.  
  20. class Game_Interpreter
  21.  
  22.   def give_stats(count, actor = 1)
  23.     @loop_count = count
  24.     actor = $game_actors[actor]
  25.     while @loop_count > 0
  26.       $game_message.add("Spend your attribute points.\nPoints to spend: #{@loop_count}")
  27.       params = []
  28.       choices = []
  29.       choices.push("Power     (Current: #{actor.atk})")  
  30.       choices.push("Tenacity  (Current: #{actor.def})")
  31.       choices.push("Moxie     (Current: #{actor.mdf})")
  32.       choices.push("Cunning   (Current: #{actor.mat})")
  33.       choices.push("Reflexes  (Current: #{actor.agi})")
  34.       choices.push("Favor     (Current: #{actor.luk})")
  35.       params.push(choices)
  36.       params.push(0)
  37.       $choice_result = 0
  38.       setup_choices(params)
  39.       Fiber.yield while $game_message.choice? if SceneManager.scene.is_a?(Scene_Map)
  40.       SceneManager.scene.wait_for_message while $game_message.choice? if SceneManager.scene.is_a?(Scene_Battle)
  41.       case $choice_result
  42.         when 1
  43.           actor.add_param(2, 1)
  44.         when 2
  45.           actor.add_param(3, 1)      
  46.         when 3
  47.           actor.add_param(4, 1)      
  48.         when 4
  49.           actor.add_param(5, 1)
  50.         when 5
  51.           actor.add_param(6, 1)
  52.         when 6
  53.           actor.add_param(7, 1)
  54.       end
  55.     @loop_count -= 1
  56.     end
  57.     actor.refresh
  58.   end
  59.  
  60.   def setup_choices(params)
  61.     params[0].each {|s| $game_message.choices.push(s) }
  62.     $game_message.choice_cancel_type = params[1]
  63.     $game_message.choice_proc = Proc.new {|n|
  64.     begin; @branch[@indent] = n;rescue;end
  65.     $choice_result = n + 1
  66.     }
  67.   end
  68. end=begin
  69. Player Stat Allocation Choice v 1.0
  70. Created by Kio Kurashi
  71. Version History:
  72. 1.0 = Initial Version
  73.  
  74. Free for commercial and personal use. Credit is not required, but appreciated.
  75.  
  76. Known bugs: None.
  77.  
  78. Instructions: Use a Script Call command (Page 3) in an Event with the following:
  79.     give_stats( amount, Actor ID)
  80.  
  81. Example(Natalie gets 5 points):
  82.     give_stats(5, 2)
  83.  
  84. If the second value is left out it will default to Actor 1.
  85. =end
  86.  
  87. class Game_Interpreter
  88.  
  89.   def give_stats(count, actor = 1)
  90.     @loop_count = count
  91.     actor = $game_actors[actor]
  92.     while @loop_count > 0
  93.       $game_message.add("Spend your attribute points.\nPoints to spend: #{@loop_count}")
  94.       params = []
  95.       choices = []
  96.       choices.push("Power     (Current: #{actor.atk})")  
  97.       choices.push("Tenacity  (Current: #{actor.def})")
  98.       choices.push("Moxie     (Current: #{actor.mdf})")
  99.       choices.push("Cunning   (Current: #{actor.mat})")
  100.       choices.push("Reflexes  (Current: #{actor.agi})")
  101.       choices.push("Favor     (Current: #{actor.luk})")
  102.       params.push(choices)
  103.       params.push(0)
  104.       $choice_result = 0
  105.       setup_choices(params)
  106.       Fiber.yield while $game_message.choice? if SceneManager.scene.is_a?(Scene_Map)
  107.       SceneManager.scene.wait_for_message while $game_message.choice? if SceneManager.scene.is_a?(Scene_Battle)
  108.       case $choice_result
  109.         when 1
  110.           actor.add_param(2, 1)
  111.         when 2
  112.           actor.add_param(3, 1)      
  113.         when 3
  114.           actor.add_param(4, 1)      
  115.         when 4
  116.           actor.add_param(5, 1)
  117.         when 5
  118.           actor.add_param(6, 1)
  119.         when 6
  120.           actor.add_param(7, 1)
  121.       end
  122.     @loop_count -= 1
  123.     end
  124.     actor.refresh
  125.   end
  126.  
  127.   def setup_choices(params)
  128.     params[0].each {|s| $game_message.choices.push(s) }
  129.     $game_message.choice_cancel_type = params[1]
  130.     $game_message.choice_proc = Proc.new {|n|
  131.     begin; @branch[@indent] = n;rescue;end
  132.     $choice_result = n + 1
  133.     }
  134.   end
  135. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement