Author Topic: Syns Actor Customization  (Read 1793 times)

0 Members and 1 Guest are viewing this topic.
Synthesize
**
Rep: +5/-0
Offline Offline
Level 66 (50%)
Syns Actor Customization
« on: January 08, 2007, 09:53:14 AM »

  • What is it?

      Do you want a system where you can let the player decide what they specialize in? As in, the player 'upgrades' their stats based upon the points provided? If so, Synthesizes Actor Customization is for you! The script allows players to upgrade the stats of their party based on the amount of upgrade points that the have. Popular among most commercial Online Role Playing Games.

    What is new?

     Creating a skin has never been so easy! In the previous versions you had constant trouble trying to create your own skin that you like, not no more. With a new customization section the entire skin stands before your eyes in a very easy to edit basis. Before it could take hours to create a nice looking skin, now you can get a basic skin in almost half the time!

    Feature List
    - Turn various controls of the script ON/OFF
    - Adjust Numerical Values of Statistics quick and easy
    - Code is much cleaner then before
    - Create new skins in a snap!
    - Auto Statistics feature! Allow the computer to place your points for you!
    More...

    Screen shots:


    In older versions, it never displayed if the stats goes up or not. Now it does. You can also choose weather to display the map or not.

    Only one screen this time. Since most of the improvements were made on the script itself. I was mainly focused on getting a system set-up where those with not a lot of RGSS can create their own unique and fun skins. I think I accomplished that.

    The Script:



    Name Scene_Upgrade
    Code: [Select]

    #--------------------------------------------------------------------------------
    # kS System - Upgrade System V3.5
    # kS System - Customize System V1.0
    # Created by Synthesize
    # Add point on level-up: IcedMetal57
    # Help from Raziel & Trickster
    #--------------------------------------------------------------------------------
    #==========================================================================
    # Begin Customization Section.
    # Only Edit the Customization Section. Leave the rest of the script alone.
    #==========================================================================
    #------------------------------------------------------------------                                                                                                 
    # Begin System Customization
    # You handle what features you would like turned ON or OFF.
    #------------------------------------------------------------------
    $automatic_stats = true # Turn Auto Stats on or off. True = ON. False = OFF
    $show_mapbg = true # Turn the Map BackGround ON or OFF. True = ON (Not Recommended). False = OFF
    Display_points = true # Show the Point Window? True = YES. False = NO
    $actor_swap = true # Allow player to swap actors? True = YES. False = NO
    Swap_right = Input::R # Button used to Swap Actors
    Swap_left = Input::L # Button used to Swap Actors
    Auto_distribute = Input::X # Button used to automatically distribute stats
    Points_Gained = 3 # Points gained on level-up.
    #------------------------------------------------------------------
    #------------------------------------------------------------------
    # Skin Customization
    # This is where the skin is created.
    #------------------------------------------------------------------
    # Command Window
    Command_x = 300 # Change the X location of the command window
    Command_y = 110 # Change the Y location of the command window
    Command_opacity = 150 # Change the opacity of the command window
    #------------------------------------------------------------------
    # Status (Raise) Screen Values
    Raise_x = 300 # Change the X values for the Raise Window
    Raise_y = 50 # Change the Y for the Raise window
    Raise_opacity = 150 # Change the values of Raise opacity
    #------------------------------------------------------------------
    # Status (Invalid) Screen Values
    Error_x = 300 # Change Error X Values
    Error_y = 50 # Change Errors Y values
    Error_opacity = 150 # Change Errors Opacity
    #------------------------------------------------------------------
    # Point Stock Screen Values
    Points_x = 300 # Change Points X Values
    Points_y = 350 # Change Points Y values
    Points_opacity = 150 # Change Points Opacity
    #------------------------------------------------------------------
    # Actor Screen Values
    $auto_x = 500 # Adjust Auto Text X Values
    $auto_y = 875 # Adjust Auto Text Y Values
    $swap_x = 400 # Adjust Swap Text X Values
    $swap_y = 875 # Adjust Swap Text Y Values
    Status_x = 0 # Adjust Status X Values
    Status_y = 0 # Adjust Status Y Values
    Status_opacity = 200 # Adjust Status Opacity Values
    $super_w = 640 # Change Actor Status Width
    $super_h = 480 # Change Actor Status Height
    #------------------------------------------------------------------
    #------------------------------------------------------------------
    # Begin Value Customization
    # Here you handle what values to increase.
    #------------------------------------------------------------------
    # Change these Values to what you want the values to add to that max stat.
    $point_count = 3 # Set the Starting Point Count
    Hp_raise = 10 # Set the amount of HP to Raise
    Sp_raise = 10 # Set amount of SP to raise
    Str_raise = 1 # Set amount of STR to Raise
    Dex_raise = 1 # Set amount of Dex to Raise
    Agi_raise = 1 # Set amount of Agility to Raise
    Int_raise = 1 # Set amount of Intellegence to Raise
    $points_used = 0 # The amount of points used, Do not Change.
    Points_used_raise = 1 # The amount the $points_used increases with each point used
    # --------------------------------------------------------------------------------------
    #------------------------------------------------------------------
    # Text Customization
    # Change what the Commands say
    #------------------------------------------------------------------
    Hp_text = "HP"
    Sp_text = "SP"
    Str_text = "Strength"
    Dex_text = "Dexterity"
    Agi_text = "Agility"
    Int_text = "Intellegence"
    Increase_by = "Increase"
    #==================================================================================
    # END CUSTOMIZATION
    # Leave everything below this point alone!!!
    #==================================================================================



    #------------------------------------------------------------------
    # Command Save
    # Handles Save and Load Functions
    #------------------------------------------------------------------
    #============================================================
    # If a script requires the use of saving to a savile file simply:
    # Add         Marshal.dump(variable, file) in the Scene_Save class and:
    #  $variable = Marshal.load(file)
    #============================================================
    class Game_Actor < Game_Battler
      #--------------------------------------------------------------------------
      # * Change EXP
      #     exp : new EXP
      #--------------------------------------------------------------------------
      def exp=(exp)
        @exp = [[exp, 9999999].min, 0].max
        # Level up
        while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
          @level += 1
          $point_count += Points_Gained
          # Learn skill
          for j in $data_classes[@class_id].learnings
            if j.level == @level
              learn_skill(j.skill_id)
            end
          end
        end
        # Level down
        while @exp < @exp_list[@level]
          @level -= 1
        end
        # Correction if exceeding current max HP and max SP
        @hp = [@hp, self.maxhp].min
        @sp = [@sp, self.maxsp].min
      end
    end

    class Scene_Save < Scene_File
        def write_save_data(file)
     characters = []
        for i in 0...$game_party.actors.size
          actor = $game_party.actors[i]
          characters.push([actor.character_name, actor.character_hue])
        end
        Marshal.dump(characters, file)
        Marshal.dump(Graphics.frame_count, file)
        $game_system.save_count += 1
        $game_system.magic_number = $data_system.magic_number
        Marshal.dump($game_system, file)
        Marshal.dump($game_switches, file)
        Marshal.dump($game_variables, file)
        Marshal.dump($game_self_switches, file)
        Marshal.dump($game_screen, file)
        Marshal.dump($game_actors, file)
        Marshal.dump($game_party, file)
        Marshal.dump($game_troop, file)
        Marshal.dump($game_map, file)
        Marshal.dump($game_player, file)
        Marshal.dump($point_count, file)
        Marshal.dump($points_used, file)   
      end
    end

    class Scene_Load < Scene_File
        def read_save_data(file)
        characters = Marshal.load(file)
        Graphics.frame_count = Marshal.load(file)
        $game_system        = Marshal.load(file)
        $game_switches      = Marshal.load(file)
        $game_variables     = Marshal.load(file)
        $game_self_switches = Marshal.load(file)
        $game_screen        = Marshal.load(file)
        $game_actors        = Marshal.load(file)
        $game_party         = Marshal.load(file)
        $game_troop         = Marshal.load(file)
        $game_map           = Marshal.load(file)
        $game_player        = Marshal.load(file)
        $point_count = Marshal.load(file)
        $points_used = Marshal.load(file)
        if $game_system.magic_number != $data_system.magic_number
          $game_map.setup($game_map.map_id)
          $game_player.center($game_player.x, $game_player.y)
        end
      end
    end 


    #============================================================
    # Begin Windows
    #============================================================
    #--------------------------------------------------------------------------
    # Random Window
    #--------------------------------------------------------------------------
    class Window_Raise< Window_Base
      def initialize
        super(0, 0, 240, 60)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = "Arial" # Font used in Points Window
        self.contents.font.size = 22 # Font Size in Points Window
        refresh
      end
      def refresh
        self.contents.clear
        self.contents.font.color = system_color
        # Display text in the Point Window
      if $random_stat == 0
      self.contents.draw_text(4, 0, 200, 30, "HP Has been Raised by #{Hp_raise}")
    elsif $random_stat == 1
        self.contents.draw_text(4, 0, 200, 30, "SP Has been Raised by #{Sp_raise}")
    elsif $random_stat == 2
      self.contents.draw_text(4, 0, 200, 30, "Str. Has been Raised by #{Str_raise}")
    elsif $random_stat == 3
      self.contents.draw_text(4, 0, 200, 30, "Dex. Has been Raised by #{Dex_raise}")
    elsif $random_stat == 4
      self.contents.draw_text(4, 0, 200, 30, "Agi. Has been Raised by #{Agi_raise}")
    elsif $random_stat == 5
      self.contents.draw_text(4, 0, 200, 30, "Int. Has been Raised by #{Int_raise}")
      end
      end
    end
    #--------------------------------------------------------------------------
    # Points Window
    #--------------------------------------------------------------------------
    class Window_Points< Window_Base
      def initialize
        super(0, 0, 160, 60)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = "Arial" # Font used in Points Window
        self.contents.font.size = 22 # Font Size in Points Window
        refresh
      end
      def refresh
        self.contents.clear
        self.contents.font.color = system_color
        # Display text in the Point Window
        self.contents.draw_text(4, 0, 120, 32, "Points:")
        self.contents.font.color = normal_color
        self.contents.draw_text(4, 0, 80, 32, $point_count.to_s, 2)
      end
    end
     #----------------------------------------------------------------------
     # Error Status Window
     #----------------------------------------------------------------------
    class Window_Error< Window_Base
      def initialize
        super(0, 0, 240, 60)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = "Arial" # Font used in Points Window
        self.contents.font.size = 22 # Font Size in Points Window
        refresh
      end
      def refresh
        self.contents.clear
        self.contents.font.color = system_color
        self.contents.draw_text(4, 0, 200, 30, "Not Enough Stat Points.") # Display text in the Error Window
      end
    end

    #============================================================
    # Begin Upgrade Script
    #============================================================

    class Scene_Upgrade
      #--------------------------------------------------------------------------
      # Object Initalize
      #--------------------------------------------------------------------------
      def initialize(actor_index = 0)
        @actor_index = actor_index
      end
      #--------------------------------------------------------------------------
      # Main Processing
      #--------------------------------------------------------------------------
      def main
        file = File.open("Data/Point_Count.rxdata", "w")
        Marshal.dump($point_count, file)
        if $show_mapbg == true
        @spriteset = Spriteset_Map.new
      end
        # Begin Upgrade Commands
        s1 = "#{Increase_by} #{Hp_text}: #{Hp_raise}"
        s2 = "#{Increase_by} #{Sp_text}: #{Sp_raise} "
        s3 = "#{Increase_by} #{Str_text}: #{Str_raise}"
        s4 = "#{Increase_by} #{Dex_text}: #{Dex_raise}"
        s5 = "#{Increase_by} #{Agi_text}: #{Agi_raise}"
        s6 = "#{Increase_by} #{Int_text}: #{Int_raise}"
        @command_window = Window_Command.new(260, [s1, s2, s3, s4, s5, s6])
        # Set Player Data
        @actor = $game_party.actors[@actor_index]
        @status_window = Window_CustomStatus.new(@actor)
        @status_window.opacity= Status_opacity
        @status_window.x = Status_x
        @status_window.y = Status_y
        # Set Command Window Data
        @command_window.x = Command_x
        @command_window.y = Command_y
        @command_window.z = 103
        @command_window.opacity = Command_opacity
      # Set Raise Window Data
        @raise_window = Window_Raise.new
        @raise_window.x = 300
        @raise_window.y = 50
        @raise_window.opacity = Raise_opacity
        # Set Stat Points Window
        @new_window = Window_Points.new
        @new_window.opacity= Points_opacity
        @new_window.x = Points_x
        @new_window.y = Points_y
        if Display_points == true
        @new_window.visible = true
      else
        @new_window.visible = false
        end
        # Graphics Transition
        Graphics.transition
        # Main Loop
        loop do
          # Update Graphics
          Graphics.update
          # Update Input
          Input.update
          # Renew
          update
          # Discontinue Loop
          if $scene != self
            break
          end
        end
        # Prepare Transition
        Graphics.freeze
        # Dispose Windows
        @command_window.dispose
        @new_window.dispose
        @status_window.dispose
        @raise_window.dispose
        if @spriteset != nil
          @spriteset.dispose
          end
        if @error_window != nil
          @error_window.dispose
        end
      end
      #--------------------------------------------------------------------------
      # Window Update
      #--------------------------------------------------------------------------
      def update
        if Input.trigger?(Swap_right)
        if $actor_swap == true
          $game_system.se_play($data_system.cursor_se)
          @actor_index += 1
          @actor_index %= $game_party.actors.size
          $scene = Scene_Upgrade.new(@actor_index)
          end
          return
        end
        if Input.trigger?(Swap_left)
          if $actor_swap == true
          $game_system.se_play($data_system.cursor_se)
          @actor_index += $game_party.actors.size - 1
          @actor_index %= $game_party.actors.size
          $scene = Scene_Upgrade.new(@actor_index)
          end
          return
        end
        if Input.trigger?(Auto_distribute)
          if $automatic_stats == true
         $random_stat = rand(6)
         if $random_stat == 0
          if $point_count >= 1
              $game_system.se_play($data_system.shop_se)
              @actor.maxhp += Hp_raise
              $point_count -= 1
              $points_used += Points_used_raise
              @raise_window.visible = true
              $scene = Scene_Upgrade.new
            else
              $game_system.se_play($data_system.buzzer_se)
              if @error_window ==nil
                @raise_window.visible = false
                @error_window = Window_Error.new
                @error_window.opacity= Error_opacity
                @error_window.x = Error_x
                @error_window.y = Error_y
                return
              end
             end
           end
        if $random_stat == 1
          if $point_count >= 1
              $game_system.se_play($data_system.shop_se)
              @actor.maxsp += Sp_raise
              $point_count -= 1
                        $points_used += Points_used_raise
                        @raise_window.visible = true
              $scene = Scene_Upgrade.new
            else
              $game_system.se_play($data_system.buzzer_se)
              if @error_window ==nil
                    @raise_window.visible = false
                @error_window = Window_Error.new
                @error_window.opacity= Error_opacity
                @error_window.x = Error_x
                @error_window.y = Error_y
                return
              end
             end
              end
        if $random_stat == 2
          if $point_count >= 1
              $game_system.se_play($data_system.shop_se)
              @actor.str += Str_raise
              $point_count -= 1
                        $points_used += Points_used_raise
                        @raise_window.visible = true
              $scene = Scene_Upgrade.new
            else
              $game_system.se_play($data_system.buzzer_se)
              if @error_window ==nil
                    @raise_window.visible = false
                @error_window = Window_Error.new
                @error_window.opacity= Error_opacity
                @error_window.x = Error_x
                @error_window.y = Error_y
                return
              end
             end
           end
        if $random_stat == 3
          if $point_count >= 1
              $game_system.se_play($data_system.shop_se)
              @actor.dex += Dex_raise
              $point_count -= 1
                        $points_used += Points_used_raise
                        @raise_window.visible = true
              $scene = Scene_Upgrade.new
            else
              $game_system.se_play($data_system.buzzer_se)
              if @error_window ==nil
                    @raise_window.visible = false
                @error_window = Window_Error.new
                @error_window.opacity= Error_opacity
                @error_window.x = Error_x
                @error_window.y = Error_y
                return
              end
             end
          end
        if $random_stat == 4
          if $point_count >= 1
              $game_system.se_play($data_system.shop_se)
              @actor.agi += Agi_raise
              $point_count -= 1
                        $points_used += Points_used_raise
                        @raise_window.visible = true
              $scene = Scene_Upgrade.new
            else
              $game_system.se_play($data_system.buzzer_se)
              if @error_window ==nil
                    @raise_window.visible = false
                @error_window = Window_Error.new
                @error_window.opacity= Error_opacity
                @error_window.x = Error_x
                @error_window.y = Error_y
                return
              end
            end
            end
        if $random_stat == 5
          if $point_count >= 1
              $game_system.se_play($data_system.shop_se)
              @actor.int += Int_raise
              $point_count -= 1
                        $points_used += Points_used_raise
                        @raise_window.visible = true
              $scene = Scene_Upgrade.new
            else
              $game_system.se_play($data_system.buzzer_se)
              if @error_window ==nil
                    @raise_window.visible = false
                @error_window = Window_Error.new
                @error_window.opacity= Error_opacity
                @error_window.x = Error_x
                @error_window.y = Error_y
                end
                return
              end
             end
          end
          return
        end
        # Update Window
        @command_window.update
        @status_window.update
        # When Command Window Active
        if @command_window.active
          update_command
          return
        end
        if @status_window.active
          update_status
          return
        end
      end
      #--------------------------------------------------------------------------
      # ? When frame renewal (the command window is active)
      #--------------------------------------------------------------------------
      def update_command
        # When Button B is Pushed...
        if Input.trigger?(Input::B)
          # Play Cancel SE
          $game_system.se_play($data_system.cancel_se)
          # Load Map
          $scene = Scene_Map.new
          return
        end
        # When C is Pushed
        if Input.trigger?(Input::C)
          # Collect Cursor Position
          case @command_window.index
          # Activate Desired Command
          when 0
            if $point_count >= 1
              $game_system.se_play($data_system.shop_se)
              @actor.maxhp += Hp_raise
              $point_count -= 1
              $points_used += Points_used_raise
              $random_stat = 0
              $scene = Scene_Upgrade.new
            else
              $game_system.se_play($data_system.buzzer_se)
              if @error_window ==nil
                                            @raise_window.visible = false
                @error_window = Window_Error.new
                @error_window.opacity= Error_opacity
                @error_window.x = Error_x
                @error_window.y = Error_y
                return
              end
            end
          when 1
            if $point_count >= 1
              $game_system.se_play($data_system.shop_se)
              @actor.maxsp += Sp_raise
              $point_count -= 1
                        $points_used += Points_used_raise
                        $random_stat = 1
              $scene = Scene_Upgrade.new
            else
              $game_system.se_play($data_system.buzzer_se)
              if @error_window ==nil
                                @raise_window.visible = false
              @error_window = Window_Error.new
                @error_window.opacity= Error_opacity
                @error_window.x = Error_x
                @error_window.y = Error_y
              return
            end
          end
          when 2
            if $point_count >= 1
              $game_system.se_play($data_system.shop_se)
              @actor.str += Str_raise
              $point_count -= 1
                        $points_used += Points_used_raise
                        $random_stat = 2
              $scene = Scene_Upgrade.new
            else
              $game_system.se_play($data_system.buzzer_se)
              if @error_window ==nil
                                @raise_window.visible = false
                @error_window = Window_Error.new
                @error_window.opacity= Error_opacity
                @error_window.x = Error_x
                @error_window.y = Error_y
                return
              end
            end
          when 3
            if $point_count >= 1
              $game_system.se_play($data_system.shop_se)
              @actor.dex += Dex_raise
              $point_count -= 1
                        $points_used += Points_used_raise
                        $random_stat = 3
              $scene = Scene_Upgrade.new
            else
              $game_system.se_play($data_system.buzzer_se)
              if @error_window ==nil
                                @raise_window.visible = false
              @error_window = Window_Error.new
                @error_window.opacity= Error_opacity
                @error_window.x = Error_x
                @error_window.y = Error_y
              return
              end
            end
          when 4
            if $point_count >= 1
              $game_system.se_play($data_system.shop_se)
              @actor.agi += Agi_raise
              $point_count -= 1
                        $points_used += Points_used_raise
                        $random_stat = 4
              $scene = Scene_Upgrade.new
            else
              $game_system.se_play($data_system.buzzer_se)
              if @error_window ==nil
                                @raise_window.visible = false
                @error_window = Window_Error.new
                @error_window.opacity= Error_opacity
                @error_window.x = Error_x
                @error_window.y = Error_y
                return
              end
            end
          when 5
            if $point_count >= 1
              $game_system.se_play($data_system.shop_se)
              @actor.int += Int_raise
              $point_count -= 1
                        $points_used += Points_used_raise
                        $random_stat = 5
              $scene = Scene_Upgrade.new
            else
              $game_system.se_play($data_system.buzzer_se)
              if @error_window ==nil
                                @raise_window.visible = false
                @error_window = Window_Error.new
                @error_window.opacity= Error_opacity
                @error_window.x = Error_x
                @error_window.y = Error_y
                return
              end
            end
          end
          return
        end
      end
      end
    #=============================================================
    # End Script
    # Created by Synthesize.
    # V3.0 Exclusive ONLY to:
    # Symptco Designs
    # RPG RPG Revolution
    # Netplay Plus™ Forums.
    # Creation Asylum
    # Rpg Underground
    # hbgames.org
    #=============================================================


    Call Window_CustomStatus

    Code: [Select]
    #--------------------------------------------------------------------------------
    # Created by Synthesize
    # Based from Default Scene_Menu
    #--------------------------------------------------------------------------------
    class Window_CustomStatus < Window_Base

      def initialize(actor)
        super(0, 0, $super_w, $super_h)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = "Arial"
        self.contents.font.size = 22
        @actor = actor
        refresh
      end
      def refresh
        self.contents.clear
        draw_actor_graphic(@actor, 40, 112)
        draw_actor_name(@actor, 4, 0)
        draw_actor_class(@actor, 4 + 144, 0)
        draw_actor_level(@actor, 96, 32)
        draw_actor_state(@actor, 96, 64)
        draw_actor_hp(@actor, 96, 112, 172)
        draw_actor_sp(@actor, 96, 144, 172)
        draw_actor_parameter(@actor, 96, 192, 0)
        draw_actor_parameter(@actor, 96, 224, 1)
        draw_actor_parameter(@actor, 96, 256, 2)
        draw_actor_parameter(@actor, 96, 304, 3)
        draw_actor_parameter(@actor, 96, 336, 4)
        draw_actor_parameter(@actor, 96, 368, 5)
        draw_actor_parameter(@actor, 96, 400, 6)
        if $automatic_stats == true
        self.contents.draw_text($auto_x, 0, 600, $auto_y, "X: Auto Stats")
      end
      if $actor_swap == true
       self.contents.draw_text($swap_x, 0, 600, $swap_y, "L: <- R: ->")
      end
       end
    end
    Customization
      Only edit the first 74 lines of Scene_Upgrade. Since those lines handle everything in the script itself. It is all pretty heavily commented so you should not have any trouble understanding. The sections are also organized accordingly but I will do a breif run-down.

    Quote
    # Begin System Customization
    In this section you can choose what features you want on/off. True means it is on while false means it is off.

    Quote
    # Skin Customization
    This is the section where you can build your skin. You change the X and Y of windows and place them where you want. Note: This does not handle Parameters requests. It will in a later version.

    Quote
    # Begin Value Customization
    Nothing changed here, adjust the values by the amount you want each stat to rise.

    Questions/concerns? Please feel free to post them.

    Synthesize.
    « Last Edit: January 08, 2007, 10:01:44 AM by Synthesize »
    JBabz
    **
    Rep: +0/-0
    Offline Offline
    Level 53 (08%)
    Re: Syns Actor Customization
    « Reply #1 on: December 02, 2009, 09:02:35 PM »

  • So how exactly do you insert this and have it call up when you level?
     

    hi

    RMRK.net Theme Super Ultra Mega Beta

    Follow RMRK on Twitter Ask RMRK Questions on Formspring Get RMRK Updates via Windows Live

    Page created in 0.707 seconds with 19 queries.