RMVX - PointSpendSystem

RMVX - PointSpendSystem
Version: 1.05
By: Drago del Fato

Introduction

With this script you will increase the attributes by yourself inside the game. I've already made one for RMXP back in the day and I decided to make another one just for RMVX. You can set a limited number of points to be spent per each new level, and you can also customize it the way you want (set other text and stuff like that).

Features
  • Diablo Style spending points per level.
  • Customizeable
  • Option to select wether will notify you until you have all the points spend or just until the next level.

Screenshots

Content Hidden Spoiler
Image
Image
Image
Image


Script

Drago del Fato - PointSpendSystem (PSS) Spoiler
  1. #==============================================================================
  2. # ** RMVX Drago del Fato - PointSpendSystem
  3. #    -              Type: Custom Material
  4. #    -            Author: Drago del Fato
  5. #    -           Version: 1.05
  6. #    - RPG Maker Version: VX
  7. #    -    Implementation: Put in Materials list.
  8. #------------------------------------------------------------------------------
  9. # When you gain a new level in your RPG your character attributes will need to
  10. # be manually increased instead of automatically. You can set a specified number
  11. # of points user can spend on each level as well as how much each attribute will
  12. # be increased. If you use this script please give credits, thx ^^
  13. #==============================================================================
  14.  
  15.  
  16.  #--------------------------------------------------------------------------
  17.  # * Phase 1 - Language and Other Resources
  18.  #--------------------------------------------------------------------------
  19.  
  20.  
  21.  #--- Main Text Resources
  22.  PSS_TEXT = "You've got to a new level! Do you want to spend your points now?"
  23.  PSS_ANSWERS = ["Yes","No"]
  24.  PSS_ACTOR_TEXT = "[Lv +]"
  25.  
  26.  PSS_DESCRIPTION = "Left - Decrease, Right - Increase, C - Confirm, B - Cancel"
  27.  PSS_B1 = "Reset Current Modifications"
  28.  PSS_B2 = "Save Modifications"
  29.  PSS_B3 = "Cancel"
  30.  PSS_RES1 = "Special Points Left - "
  31.  PSS_RES2 = "Are you sure with this?"
  32.  
  33.  PSS_SEP = " <> "
  34.  
  35.  PSS_NAME = "Name"
  36.  
  37.  #--- Other Resources
  38.  $PSS_POINTS = 6
  39.  
  40.  PSS_HP = 10
  41.  PSS_MP = 10
  42.  PSS_ATK = 1
  43.  PSS_DEF = 2
  44.  PSS_SPI = 3
  45.  PSS_AGI = 4
  46.  
  47.  #--- Set to True if you want to be notified until that character has points left
  48.  PSS_NOTIFY_POINTS = true
  49.  
  50.  #--- Global Resources (do not modify if you arent skilled in RGSS)
  51.  $PSS_ACTOR_POINTS = []
  52.  $PSS_ACTOR_LVL_UP = []
  53.  $PSS_ACTOR_ATTR = [1,1,1,1,1,1]
  54.  $PSS_ACTOR_ADD = [1,1,1,1,1,1]
  55.  $PSS_RETURN_POINTS = 0
  56.  $PSS_POINTER = [PSS_HP, PSS_MP, PSS_ATK, PSS_DEF, PSS_SPI, PSS_AGI]
  57.    
  58.  #--------------------------------------------------------------------------
  59.  # * Phase 2 - Class Modifications
  60.  #--------------------------------------------------------------------------
  61.  
  62.  
  63.  class Game_Actor < Game_Battler
  64.    
  65.   #--------------------------------------------------------------------------
  66.   # * Change Experience
  67.   #     exp  : New experience
  68.   #     show : Level up display flag
  69.   #--------------------------------------------------------------------------
  70.   def change_exp(exp, show)
  71.     last_level = @level
  72.     last_skills = skills
  73.     @exp = [[exp, 9999999].min, 0].max
  74.     while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
  75.       level_up
  76.      
  77.       #-- Overwrite the new level parameters with past level one.
  78.       if !$BTEST
  79.        actor.parameters[0, @level] = actor.parameters[0, @level - 1]
  80.        actor.parameters[1, @level] = actor.parameters[1, @level - 1]
  81.        actor.parameters[2, @level] = actor.parameters[2, @level - 1]
  82.        actor.parameters[3, @level] = actor.parameters[3, @level - 1]
  83.        actor.parameters[4, @level] = actor.parameters[4, @level - 1]
  84.        actor.parameters[5, @level] = actor.parameters[5, @level - 1]
  85.       end
  86.      
  87.       #-- Add Points to an actor when he levels up.
  88.       $PSS_ACTOR_LVL_UP[@actor_id] = true
  89.       $PSS_ACTOR_POINTS[@actor_id] += $PSS_POINTS
  90.      
  91.     end
  92.    
  93.     #-- Level down is deleted.
  94.    
  95.     @hp = [@hp, maxhp].min
  96.     @mp = [@mp, maxmp].min
  97.     if show and @level > last_level
  98.       display_level_up(skills - last_skills)
  99.     end
  100.   end
  101.  
  102.   def pss_change_actor_params(param_id, new_value)
  103.     actor.parameters[param_id, @level] = new_value
  104.   end
  105.  
  106. end
  107.  
  108.  class Scene_Title < Scene_Base
  109.    
  110.   #--------------------------------------------------------------------------
  111.   # * Create Game Objects
  112.   #--------------------------------------------------------------------------
  113.    def create_game_objects
  114.     $game_temp          = Game_Temp.new
  115.     $game_message       = Game_Message.new
  116.     $game_system        = Game_System.new
  117.     $game_switches      = Game_Switches.new
  118.     $game_variables     = Game_Variables.new
  119.     $game_self_switches = Game_SelfSwitches.new
  120.     $game_actors        = Game_Actors.new
  121.     $game_party         = Game_Party.new
  122.     $game_troop         = Game_Troop.new
  123.     $game_map           = Game_Map.new
  124.     $game_player        = Game_Player.new
  125.    
  126.     for i in 0..$data_actors.size - 2
  127.       $PSS_ACTOR_POINTS.push(0)
  128.       $PSS_ACTOR_LVL_UP.push(false)
  129.     end
  130.   end
  131.  
  132. end
  133.  
  134. #-- Draw Level Up when a character goes to a new level, delete this class if
  135. #-- you don't like this
  136. class Window_Base < Window
  137.  
  138.    def draw_actor_name(actor, x, y)
  139.     self.contents.font.color = hp_color(actor)
  140.     if $PSS_ACTOR_POINTS[actor.id] == 0
  141.      self.contents.draw_text(x, y, 108, WLH, actor.name)
  142.     else
  143.      ts = self.contents.text_size(actor.name + PSS_ACTOR_TEXT)
  144.      self.contents.draw_text(x, y, ts.width, ts.height, actor.name + PSS_ACTOR_TEXT)
  145.     end
  146.   end
  147.  
  148. end
  149. #-- End of Level Up Character Name
  150.  
  151. class Scene_Status < Scene_Base
  152.  
  153.    def start
  154.     #-- Original Status commands
  155.     super
  156.     create_menu_background
  157.     @actor = $game_party.members[@actor_index]
  158.     @status_window = Window_Status.new(@actor)
  159.     #-- End
  160.     if $PSS_ACTOR_LVL_UP[@actor_index + 1]
  161.      @pss_help = Window_PSS_Help.new
  162.      @pss_help.z = 9998
  163.      @pss_help.refresh_3
  164.      @status_window.opacity = 100
  165.      @status_window.contents_opacity = 100
  166.      @pss_confirm = Window_Command.new(300, [PSS_ANSWERS[0], PSS_ANSWERS[1]])
  167.      @pss_confirm.x = 245
  168.      @pss_confirm.y = 255
  169.      @pss_confirm.active = true
  170.     end
  171.    end
  172.  
  173.    def update
  174.     if @pss_confirm != nil and @pss_confirm.active
  175.      @pss_confirm.update
  176.      if Input.trigger?(Input::C)
  177.       case @pss_confirm.index
  178.       when 0
  179.        @pss_confirm.visible = false
  180.        @pss_help.visible = false
  181.        $scene = Scene_PSS.new(@actor_index + 1)
  182.       when 1
  183.        @pss_confirm.visible = false
  184.        @pss_help.visible = false
  185.        @status_window.opacity = 160
  186.        @status_window.contents_opacity = 255
  187.      end
  188.      elsif Input.trigger?(Input::B)
  189.        @pss_confirm.visible = false
  190.        @pss_help.visible = false
  191.        @status_window.opacity = 160
  192.        @status_window.contents_opacity = 255
  193.      end
  194.     end
  195.     #-- Original Status commands
  196.     update_menu_background
  197.     @status_window.update
  198.     if Input.trigger?(Input::B)
  199.       Sound.play_cancel
  200.       return_scene
  201.     elsif Input.trigger?(Input::R)
  202.       Sound.play_cursor
  203.       next_actor
  204.     elsif Input.trigger?(Input::L)
  205.       Sound.play_cursor
  206.       prev_actor
  207.     end
  208.     super    
  209.     #-- End
  210.   end
  211.  
  212.   def terminate
  213.    #-- Original Status Commands
  214.    super
  215.    dispose_menu_background
  216.    @status_window.dispose
  217.    #-- End
  218.    @pss_confirm.dispose if @pss_confirm != nil
  219.    @pss_help.dispose if @pss_help != nil
  220.   end
  221. end
  222.  
  223.  #--------------------------------------------------------------------------
  224.  # * Phase 3 - PointSpendSystem Scene
  225.  #--------------------------------------------------------------------------
  226.  
  227. class Window_PSS_Help < Window_Base
  228.  
  229.   def initialize
  230.     super(0,352,544,64)
  231.     refresh
  232.   end
  233.  
  234.   def refresh
  235.     self.contents.clear
  236.     ts = self.contents.text_size(PSS_DESCRIPTION)
  237.     self.contents.draw_text(0,0,ts.width,ts.height, PSS_DESCRIPTION)
  238.   end
  239.  
  240.   def refresh_2
  241.     self.contents.clear
  242.     ts = self.contents.text_size(PSS_RES2)
  243.     self.contents.draw_text(0,0,ts.width,ts.height, PSS_RES2)
  244.   end
  245.  
  246.   def refresh_3
  247.     self.contents.clear
  248.     ts = self.contents.text_size(PSS_TEXT)
  249.     self.contents.draw_text(0,0,ts.width,ts.height, PSS_TEXT)
  250.   end
  251.  
  252. end
  253.  
  254.  
  255. class Window_PSS_Main < Window_Selectable
  256.  
  257.    def initialize(actor)
  258.     super(0, 0, 544, 352)
  259.     @actor = actor
  260.     refresh
  261.     self.index = 0
  262.   end
  263.  
  264.   def refresh
  265.     self.contents.clear
  266.    
  267.     #-- Draw Text Data
  268.     ts = self.contents.text_size(PSS_NAME)
  269.     self.contents.draw_text(160,32,ts.width,ts.height, PSS_NAME)
  270.  
  271.     ts_a = self.contents.text_size(@actor.name)
  272.     self.contents.draw_text(170 + ts.width,32,ts_a.width,ts_a.height, @actor.name)
  273.    
  274.     ts = self.contents.text_size(Vocab.level_a)
  275.     self.contents.draw_text(160,50,ts.width,ts.height,Vocab.level_a)
  276.    
  277.     ts_a = self.contents.text_size(@actor.level)
  278.     self.contents.draw_text(170 + ts.width,50,ts_a.width,ts_a.height, @actor.level)
  279.  
  280.     ts = self.contents.text_size(Vocab.atk)
  281.     self.contents.draw_text(160,96,ts.width,ts.height,Vocab.atk)
  282.    
  283.     ts_a = self.contents.text_size(@actor.base_atk)
  284.     self.contents.draw_text(170 + ts.width,96,ts_a.width,ts_a.height, @actor.base_atk)
  285.  
  286.     ts = self.contents.text_size(Vocab.def)
  287.     self.contents.draw_text(160,128,ts.width,ts.height,Vocab.def)
  288.    
  289.     ts_a = self.contents.text_size(@actor.base_def)
  290.     self.contents.draw_text(170 + ts.width,128,ts_a.width,ts_a.height, @actor.base_def)
  291.    
  292.     ts = self.contents.text_size(Vocab.spi)
  293.     self.contents.draw_text(160,160,ts.width,ts.height,Vocab.spi)
  294.    
  295.     ts_a = self.contents.text_size(@actor.base_spi)
  296.     self.contents.draw_text(170 + ts.width,160,ts_a.width,ts_a.height, @actor.base_spi)
  297.    
  298.     ts = self.contents.text_size(Vocab.agi)
  299.     self.contents.draw_text(160,192,ts.width,ts.height,Vocab.agi)
  300.    
  301.     ts_a = self.contents.text_size(@actor.base_agi)
  302.     self.contents.draw_text(170 + ts.width,192,ts_a.width,ts_a.height, @actor.base_agi)
  303.    
  304.     ts = self.contents.text_size(Vocab.hp)
  305.     self.contents.draw_text(160,224,ts.width,ts.height,Vocab.hp)
  306.    
  307.     ts_a = self.contents.text_size(@actor.base_maxhp)
  308.     self.contents.draw_text(170 + ts.width,224,ts_a.width,ts_a.height, @actor.base_maxhp)
  309.    
  310.     ts = self.contents.text_size(Vocab.mp)
  311.     self.contents.draw_text(160,256,ts.width,ts.height,Vocab.mp)
  312.    
  313.     ts_a = self.contents.text_size(@actor.base_maxmp)
  314.     self.contents.draw_text(170 + ts.width,256,ts_a.width,ts_a.height, @actor.base_maxmp)
  315.    
  316.     p_text = PSS_RES1 + $PSS_ACTOR_POINTS[@actor.id].to_s
  317.     ts_a = self.contents.text_size(p_text)
  318.     self.contents.draw_text(170 + ts.width,290,ts_a.width,ts_a.height, p_text)
  319.  
  320.     #-- Draw Face
  321.     draw_actor_face(@actor, 8, 32)
  322.     draw_actor_graphic(@actor, 64, 180)
  323.    
  324.     s1 = Vocab.hp + " " + $PSS_ACTOR_ATTR[0].to_s + PSS_SEP + $PSS_ACTOR_ADD[0].to_s
  325.     s2 = Vocab.mp + " " + $PSS_ACTOR_ATTR[1].to_s + PSS_SEP + $PSS_ACTOR_ADD[1].to_s
  326.     s3 = Vocab.atk + " " + $PSS_ACTOR_ATTR[2].to_s + PSS_SEP + $PSS_ACTOR_ADD[2].to_s
  327.     s4 = Vocab.def + " " + $PSS_ACTOR_ATTR[3].to_s + PSS_SEP + $PSS_ACTOR_ADD[3].to_s
  328.     s5 = Vocab.spi + " " + $PSS_ACTOR_ATTR[4].to_s + PSS_SEP + $PSS_ACTOR_ADD[4].to_s
  329.     s6 = Vocab.agi + " " + $PSS_ACTOR_ATTR[5].to_s + PSS_SEP + $PSS_ACTOR_ADD[5].to_s
  330.    
  331.     @commands = [s1,s2,s3,s4,s5,s6]
  332.    
  333.     for i in 0...6
  334.       draw_item(i)
  335.     end
  336.    
  337.     @item_max = 6
  338.     @column_max = 1
  339.    
  340.   end
  341.  
  342.    def item_rect(index)
  343.     rect = Rect.new(0, 0, 0, 0)
  344.     rect.width = 200
  345.     rect.height = WLH
  346.     rect.x = 280 + (index % @column_max * (rect.width + @spacing))
  347.     rect.y = 96 + (index / @column_max * WLH)
  348.     return rect
  349.   end
  350.  
  351.   def draw_item(index, enabled = true)
  352.     rect = item_rect(index)
  353.     rect.x += 30
  354.     self.contents.clear_rect(rect)
  355.     self.contents.font.color = normal_color
  356.     self.contents.font.color.alpha = enabled ? 255 : 128
  357.     self.contents.draw_text(rect, @commands[index])
  358.   end
  359.  
  360.   def update
  361.     super
  362.   end
  363.    
  364.  
  365. end
  366.  
  367. class Scene_PSS < Scene_Base
  368.  
  369.   def initialize(actor_id)
  370.    @actor = $game_actors[actor_id]
  371.   end
  372.  
  373.   def start
  374.     get_attributes
  375.     @pss_main = Window_PSS_Main.new(@actor)
  376.     @pss_help = Window_PSS_Help.new
  377.     @pss_confirm = Window_Command.new(300, [PSS_B1, PSS_B2, PSS_B3])
  378.     @pss_confirm.x = 245
  379.     @pss_confirm.y = 245
  380.     @pss_confirm.visible = false
  381.   end
  382.  
  383.   def set_attributes
  384.     @actor.pss_change_actor_params(0,$PSS_ACTOR_ADD[0])
  385.     @actor.pss_change_actor_params(1,$PSS_ACTOR_ADD[1])
  386.     @actor.pss_change_actor_params(2,$PSS_ACTOR_ADD[2])
  387.     @actor.pss_change_actor_params(3,$PSS_ACTOR_ADD[3])
  388.     @actor.pss_change_actor_params(4,$PSS_ACTOR_ADD[4])
  389.     @actor.pss_change_actor_params(5,$PSS_ACTOR_ADD[5])
  390.    end
  391.    
  392.    def get_attributes
  393.     $PSS_ACTOR_ATTR[0] = @actor.maxhp
  394.     $PSS_ACTOR_ATTR[1] = @actor.maxmp
  395.     $PSS_ACTOR_ATTR[2] = @actor.base_atk
  396.     $PSS_ACTOR_ATTR[3] = @actor.base_def
  397.     $PSS_ACTOR_ATTR[4] = @actor.base_spi
  398.     $PSS_ACTOR_ATTR[5] = @actor.base_agi
  399.    
  400.     for i in 0..$PSS_ACTOR_ADD.size - 1
  401.       $PSS_ACTOR_ADD[i] = $PSS_ACTOR_ATTR[i]
  402.     end
  403.    
  404.     $PSS_RETURN_POINTS = $PSS_ACTOR_POINTS[@actor.id]
  405.   end
  406.  
  407.   def subtract_points
  408.     $PSS_ACTOR_ADD[@pss_main.index] -= $PSS_POINTER[@pss_main.index]
  409.    
  410.     #-- When subtracted, add points back
  411.     $PSS_ACTOR_POINTS[@actor.id] += 1
  412.    
  413.     #-- No subtraction if values is less than original
  414.     if $PSS_ACTOR_ADD[@pss_main.index] < $PSS_ACTOR_ATTR[@pss_main.index]
  415.      $PSS_ACTOR_ADD[@pss_main.index] = $PSS_ACTOR_ATTR[@pss_main.index]
  416.      $PSS_ACTOR_POINTS[@actor.id] -= 1
  417.     end
  418.   end
  419.  
  420.   def add_points
  421.    if $PSS_ACTOR_POINTS[@actor.id] > 0
  422.     $PSS_ACTOR_ADD[@pss_main.index] += $PSS_POINTER[@pss_main.index]
  423.     $PSS_ACTOR_POINTS[@actor.id] -= 1
  424.    end
  425.   end
  426.  
  427.  
  428.   def update
  429.    @pss_main.update if @pss_main.active
  430.    @pss_confirm.update if @pss_confirm.active
  431.    if Input.trigger?(Input::LEFT)
  432.     if @pss_main.active
  433.      subtract_points
  434.      @pss_main.refresh
  435.     end
  436.    elsif Input.trigger?(Input::RIGHT)
  437.     if @pss_main.active
  438.      add_points
  439.      @pss_main.refresh
  440.     end
  441.    elsif Input.trigger?(Input::C)
  442.     if @pss_main.active
  443.      @pss_main.opacity = 100
  444.      @pss_main.contents_opacity = 100
  445.      @pss_help.refresh_2
  446.      @pss_confirm.visible = true
  447.      @pss_confirm.active = true
  448.      @pss_main.active = false
  449.     elsif @pss_confirm.active
  450.      case @pss_confirm.index
  451.      when 0
  452.       for i in 0..$PSS_ACTOR_ADD.size - 1
  453.        $PSS_ACTOR_ADD[i] = $PSS_ACTOR_ATTR[i]
  454.       end
  455.       $PSS_ACTOR_POINTS[@actor.id] = $PSS_RETURN_POINTS
  456.       @pss_main.refresh
  457.       pss_return_back
  458.      when 1
  459.       set_attributes
  460.       $PSS_ACTOR_LVL_UP[@actor.id] = false
  461.       if PSS_NOTIFY_POINTS
  462.        $PSS_ACTOR_LVL_UP[@actor.id] = true if $PSS_ACTOR_POINTS[@actor.id] > 0
  463.       end
  464.       $scene = Scene_Map.new
  465.      when 2
  466.       pss_return_back
  467.      end
  468.     end
  469.    
  470.    elsif Input.trigger?(Input::B)
  471.     if @pss_main.active
  472.      $scene = Scene_Map.new
  473.     elsif @pss_confirm.active
  474.      pss_return_back
  475.     end
  476.    end
  477.  end
  478.  
  479.  def pss_return_back
  480.    @pss_main.opacity = 255
  481.    @pss_main.contents_opacity = 255
  482.    @pss_help.refresh
  483.    @pss_confirm.visible = false
  484.    @pss_confirm.active = false
  485.    @pss_main.active = true
  486.  end
  487.  
  488.  def pre_terminate
  489.    @pss_main.dispose
  490.    @pss_help.dispose
  491.    @pss_confirm.dispose
  492.  end
  493.  
  494. end
Expand to see the code.


Instructions

Just place the script in the Materials, above Main. :)

FAQ

Q. I have a question... what do I do?
A. Post it. :)

Q. Can you decrease points to get stat?
A. Yes, but no more than original stats at that current level are.

Demo

VX Demo 351KB
Click Here to download

Compatibility

For now this is unknown. Please post feedback so I can fill this.

Author's Notes

There is a same version of this script made for RMXP but because RMXP scripts aren't compatible with RMVX scripts I made a completely new one just for RMVX. :P

Terms and Conditions

This script is FREE for personal and commercial use. If you use this script I only want my name in the credits, that's all. :)
It's good looking(though your windows theme clashes with VX's windows :haha: ). Can you decrease stats to gain points?
Yep did that already. :grin:
But you can't decrease more than original stats which were at that level.

Although I don't really understand what you mean by windows theme... XD
Is there a way i can make it run off something other than status from the menu?
Well i thought it was best as a notification. But I'm open for suggestions.

What do you think?

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=67661