Advertisement
roninator2

Yanfly Save Engine Addon New Game+ for CSCA encyclopedia

Dec 8th, 2024
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.96 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Save Engine Add-On: New Game+ for CSCA Encyclopedia v1.01
  4. # -- Last Updated: 2011.12.26
  5. # -- Level: Normal
  6. # -- Requires: YEA - Ace Save Engine v1.01+
  7. # -- Requires: YEA - Ace Save Engine Addon: New Game+ v1.00
  8. #==============================================================================
  9.  
  10. #==============================================================================
  11. # ▼ Updates
  12. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  13. # 2020.05.13 - Started Script and Finished.
  14. #
  15. #==============================================================================
  16. # ▼ Introduction
  17. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  18. # set the range of variables used for saving the csca data.
  19. # This script is using by default variables
  20. # 101, 101, 102, 103, 104, 105, 107, 108, 109 # a total of 9
  21. # Also lets you specify what data to save.
  22. # Change items to false to not save items, etc.
  23. #==============================================================================
  24. module YEA
  25.   module NEW_GAME_PLUS
  26.     CARRY_OVER_CSCA_VARIABLES = [101..109] # must be a range of 9 inclusive
  27.     CSCA_ITEMS = true
  28.     CSCA_WEAPONS = true
  29.     CSCA_ARMOR = true
  30.     CSCA_SKILLS = true
  31.     CSCA_STATES = true
  32.     CSCA_ENEMY = true
  33.     CSCA_CUSTOM = true
  34.     CSCA_DESCRIPTION = true
  35.   end
  36. end
  37. if $imported["YEA-SaveEngine"]
  38.   if $imported["YEA-NewGame+"]
  39.  
  40. module YEA
  41.   module NEW_GAME_PLUS
  42.     module_function
  43.     def convert_integer_array(array)
  44.       result = []
  45.       array.each { |i|
  46.         case i
  47.         when Range; result |= i.to_a
  48.         when Integer; result |= [i]
  49.         end }
  50.       return result
  51.     end
  52.     CARRY_OVER_CSCA_VARIABLES = convert_integer_array(CARRY_OVER_CSCA_VARIABLES)
  53.   end
  54. end
  55.  
  56. module DataManager
  57.   def self.setup_new_game_plus(index)
  58.     create_new_game_plus_objects(index)
  59.     $game_map.setup($data_system.start_map_id)
  60.     $game_player.moveto($data_system.start_x, $data_system.start_y)
  61.     $game_player.refresh
  62.     $game_party.csca_reset_encyclopedia
  63.     Graphics.frame_count = 0
  64.   end
  65.   def self.create_new_game_plus_objects(index)
  66.     load_game_without_rescue(index)
  67.     ngp_reset_switches
  68.     ngp_reset_variables
  69.     ngp_reset_self_switches
  70.         ngp_reset_csca_variables
  71.     ngp_reset_actors
  72.     ngp_reset_party
  73.   end
  74.   def self.ngp_reset_csca_variables
  75.     $game_variables[YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES[0]] = $game_party.csca_items
  76.     $game_variables[YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES[1]] = $game_party.csca_weapons
  77.     $game_variables[YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES[2]] = $game_party.csca_armors
  78.     $game_variables[YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES[3]] = $game_party.csca_states
  79.     $game_variables[YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES[4]] = $game_party.csca_skills
  80.     $game_variables[YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES[5]] = $game_party.csca_custom_enc
  81.     $game_variables[YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES[6]] = $game_party.csca_descriptions
  82.     $game_variables[YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES[7]] = $game_party.csca_enemies
  83.     $game_variables[YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES[8]] = $game_party.csca_defeated_number
  84.   end
  85. end
  86.  
  87. class Game_Party < Game_Unit
  88.   def csca_reset_encyclopedia
  89.     @csca_items = []
  90.     @csca_weapons = []
  91.     @csca_armors = []
  92.     @csca_states = []
  93.     @csca_skills = []
  94.     @csca_custom_enc = []
  95.     @csca_descriptions = []
  96.     @csca_enemies = []
  97.     @csca_defeated_number = []
  98.     YEA::NEW_GAME_PLUS::CSCA_ITEMS ? @csca_items = $game_variables[YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES[0]] : nil
  99.     YEA::NEW_GAME_PLUS::CSCA_WEAPONS ? @csca_weapons = $game_variables[YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES[1]] : nil
  100.     YEA::NEW_GAME_PLUS::CSCA_ARMOR ? @csca_armors = $game_variables[YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES[2]] : nil
  101.     YEA::NEW_GAME_PLUS::CSCA_STATES ? @csca_states = $game_variables[YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES[3]] : nil
  102.     YEA::NEW_GAME_PLUS::CSCA_SKILLS ? @csca_skills = $game_variables[YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES[4]] : nil
  103.     YEA::NEW_GAME_PLUS::CSCA_CUSTOM ? @csca_custom_enc = $game_variables[YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES[5]]: nil
  104.     YEA::NEW_GAME_PLUS::CSCA_DESCRIPTION ? @csca_descriptions = $game_variables[YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES[6]] : nil
  105.     YEA::NEW_GAME_PLUS::CSCA_ENEMY ? @csca_enemies = $game_variables[YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES[7]] : nil
  106.     YEA::NEW_GAME_PLUS::CSCA_ENEMY ? @csca_defeated_number = $game_variables[YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES[8]] : nil
  107.     for i in 0...$data_system.variables.size
  108.       next if i <= 0
  109.       next if !YEA::NEW_GAME_PLUS::CARRY_OVER_CSCA_VARIABLES.include?(i)
  110.       $game_variables[i] = 0
  111.     end
  112.   end
  113. end
  114.  
  115.   end
  116. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement