I don't own this. I didn't make it, so blah. Author wants credit, let us know, blah blah. Anyways, it was from an old site that got deleted. No idea if there's an updated version anywhere, but this seems pretty advanced.
Here it is (take it from the demo): Edit- outdated link removed
#============================================================================== # Materia System #============================================================================== # SephirothSpawn # 1.28.06 # Version 2.01 #==============================================================================
#------------------------------------------------------------------------------ # * Explanations: #------------------------------------------------------------------------------ # ~ Weapon & Armor Materia Slots # - Basic Syntax: Item ID # => Slots Array # - Slots Array: [Number of Paired Slots, Single Slots] # ** You must not exceed 8 (Paired * 2 + Single * 1 <= 10) # ~ Materia List # * Creating Your Own Materia # - Basic Syntax: Materia.new(id, name, type, stat_effects, # elements, states, new_value, m_value, # skills, exp_levels, special_effect) # # - id : The Idea Number of you materia. Start from 1 and add 1 # - name : The Name of your materia # - type : The Type Of Materia. Choose From One of The Following: # 'Skill', 'Command', 'Summon', 'Support', 'Independent' # - stat_effects : The Percent of each stat that materia will effect # [ Hp, Sp, Str, Dex, Agi, Int ] # - elements : An Array of each Element ID from the systems tab # - states : An Array of each State Id from the Status tab # - new_value : The cost to buy the Materia # - master_value : The value of the Materia when Mastered # - Skills : An array of the skills you learn from the Materia. # (Use for Skill, Command & Summon) # - Exp Levels : An array of the experience required to level # The First value in the array is required to get level 2 # - Special Effect : A special Effect of the Materia. # ~ All # ~ Elemental # ~ Status # ~ Steal As Well # ~ HP Absorb # ~ MP Absorb # ~ MP Turbo # ~ Exp Plus # ~ Gil Plus # ~ HP Plus # ~ SP Plus # ~ Strength Plus # ~ Defense Plus # ~ Speed Plus # ~ Magic Plus #------------------------------------------------------------------------------
#------------------------------------------------------------------------------ # * Begin SDK Enable Test #------------------------------------------------------------------------------
class Game_Battler #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias seph_materiasystem_gamebattler_skilleffect skill_effect #-------------------------------------------------------------------------- # * Apply Skill Effects # user : the one using skills (battler) # skill : skill #-------------------------------------------------------------------------- def skill_effect(user, skill) # Orginal Skill Effects Method seph_materiasystem_gamebattler_skilleffect(user, skill) if user.is_a?(Game_Actor) # Gets Paired Materia materia_set = user.return_paired_materia for paired_set in materia_set materia = paired_set[2] other_materia = paired_set[3] # HP Absorb if materia.special_effect == 'HP Absorb' for skill_id in other_materia.skills unless skill_id == 0 m_skill = $data_skills[skill_id] if skill == m_skill hp = (user.maxhp * 0.1).to_i user.hp += [hp, user.maxhp - hp].min user.damage = - [hp, user.maxhp - hp].min user.damage_pop = true end end end end # MP Absorb if materia.special_effect == 'MP Absorb' for skill_id in other_materia.skills unless skill_id == 0 m_skill = $data_skills[skill_id] if skill == m_skill sp = (user.maxsp * 0.1).to_i user.sp += [sp, user.maxsp - sp].min user.damage = - [sp, user.maxsp - sp].min user.damage_pop = true end end end end # MP Turbo if materia.special_effect == 'MP Turbo' for skill_id in other_materia.skills unless skill_id == 0 m_skill = $data_skills[skill_id] if skill == m_skill unless user.sp < skill.sp_cost * 2 if self.damage > 0 self.damage *= 2 user.sp -= skill.sp_cost user.damage = 'MP TURBO!' user.damage_pop = true end end end end end end # Steal As Well if materia.special_effect == 'Steal as well' for skill_id in other_materia.skills unless skill_id == 0 m_skill = $data_skills[skill_id] if skill == m_skill if self.is_a?(Game_Battler) if (rand(100) < self.treasure_prob) unless self.item_id == 0 item = $data_items[self.item_id] end unless self.weapon_id == 0 item = $data_weapons[self.weapon_id] end unless self.armor_id == 0 item = $data_armors[self.armor_id] end unless item.nil? case item when RPG::Item $game_party.gain_item(self.item_id, 1) when RPG::Weapon $game_party.gain_weapon(self.weapon_id, 1) when RPG::Armor $game_party.gain_armor(self.armor_id, 1) end user.damage = "Stole #{item.name}" user.damage_pop = true end end end end end end end end end end end
class Game_Actor #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :weapon_materia attr_accessor :armor1_materia attr_accessor :armor2_materia attr_accessor :armor3_materia attr_accessor :armor4_materia attr_accessor :materia_skills #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias seph_materiasystem_gameactor_init initialize alias seph_materiasystem_gameactor_setup setup alias seph_materiasystem_gameactor_skills skills alias seph_materiasystem_gameactor_maxhp maxhp alias seph_materiasystem_gameactor_maxsp maxsp alias seph_materiasystem_gameactor_str str alias seph_materiasystem_gameactor_dex dex alias seph_materiasystem_gameactor_agi agi alias seph_materiasystem_gameactor_int int alias seph_materiasystem_gameactor_equip equip alias seph_materiasystem_gameactor_exp exp alias seph_materiasystem_gameactor_elementrate element_rate alias seph_materiasystem_gameactor_stateguard? state_guard? alias seph_materiasystem_gameactor_elementset element_set alias seph_materiasystem_gameactor_plusstateset plus_state_set #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(actor_id) # Sets Up Materia Slots @weapon_materia = Array.new @armor1_materia = Array.new @armor2_materia = Array.new @armor3_materia = Array.new @armor4_materia = Array.new # Orginal Initialization Method seph_materiasystem_gameactor_init(actor_id) end #-------------------------------------------------------------------------- # * Setup #-------------------------------------------------------------------------- def setup(actor_id) # Orginal Setup Method seph_materiasystem_gameactor_setup(actor_id) # Materia Skills @materia_skills = [] # Adds Weapon Materia sn = $data_weapons[@weapon_id].paired_materia * 2 + $data_weapons[@weapon_id].single_materia unless @weapon_id == 0 @weapon_materia = @weapon_id == 0 ? [] : Array.new(sn, nil) # Adds Shield Materia sn = $data_armors[@armor1_id].paired_materia * 2 + $data_armors[@armor1_id].single_materia unless @armor1_id == 0 @armor1_materia = @armor1_id == 0 ? [] : Array.new(sn, nil) # Adds Head Materia sn = $data_armors[@armor2_id].paired_materia * 2 + $data_armors[@armor2_id].single_materia unless @armor2_id == 0 @armor2_materia = @armor2_id == 0 ? [] : Array.new(sn, nil) # Adds Body Materia sn = $data_armors[@armor3_id].paired_materia * 2 + $data_armors[@armor3_id].single_materia unless @armor3_id == 0 @armor3_materia = @armor3_id == 0 ? [] : Array.new(sn, nil) # Adds Accessory Materia sn = $data_armors[@armor4_id].paired_materia * 2 + $data_armors[@armor4_id].single_materia unless @armor4_id == 0 @armor4_materia = @armor4_id == 0 ? [] : Array.new(sn, nil) end #-------------------------------------------------------------------------- # * Skills #-------------------------------------------------------------------------- def skills # Deletes Materia Skills for skill_id in @materia_skills self.forget_skill(skill_id) end # Original Skills Method skills = seph_materiasystem_gameactor_skills # Adds Skills Attached to Weapon & Armors for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia unless materia.nil? self.learn_materia_skill(materia) end end # Returns Skills return @skills end #-------------------------------------------------------------------------- # * Learn Materia Skill #-------------------------------------------------------------------------- def learn_materia_skill(materia) # If Skill Materia if materia.type == 'Skill' || materia.type == 'Command' || materia.type == 'Summon' for i in 0...materia.level skill_id = materia.skills[i] # Learn Skill self.learn_skill(skill_id) # Adds Skills To Materia Skills @materia_skills << skill_id end end end #-------------------------------------------------------------------------- # * Get Maximum HP #-------------------------------------------------------------------------- def maxhp # Orginal Max Hp Method n = seph_materiasystem_gameactor_maxhp # Collects HP Difference From Materia variance = 0 for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia unless materia.nil? variance += materia.stat_effects[0] if materia.special_effect == 'HP Plus' variance += (materia.level * 10) end end end # Takes Percentage n *= ((100 + variance) / 100.0) n = [[Integer(n), 0].max, 9999].min return n end #-------------------------------------------------------------------------- # * Get HP #-------------------------------------------------------------------------- def hp @hp = [@hp, maxhp].min return @hp end #-------------------------------------------------------------------------- # * Get Maximum SP #-------------------------------------------------------------------------- def maxsp # Orginal Max Sp Method n = seph_materiasystem_gameactor_maxsp # Collects SP Difference From Materia variance = 0 for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia unless materia.nil? variance += materia.stat_effects[1] if materia.special_effect == 'SP Plus' variance += (materia.level * 10) end end end # Takes Percentage n *= ((100 + variance) / 100.0) n = [[Integer(n), 0].max, 9999].min return n end #-------------------------------------------------------------------------- # * Get SP #-------------------------------------------------------------------------- def sp @sp = [@sp, maxsp].min return @sp end #-------------------------------------------------------------------------- # * Get Strength (STR) #-------------------------------------------------------------------------- def str # Orginal Max Str Method n = seph_materiasystem_gameactor_str # Collects SP Difference From Materia variance = 0 for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia unless materia.nil? variance += materia.stat_effects[2] if materia.special_effect == 'Strength Plus' variance += (materia.level * 5) end end end # Takes Percentage n *= ((100 + variance) / 100.0) n = [[Integer(n), 1].max, 999].min return n end #-------------------------------------------------------------------------- # * Get Dexterity (DEX) #-------------------------------------------------------------------------- def dex # Orginal Max Dex Method n = seph_materiasystem_gameactor_dex # Collects SP Difference From Materia variance = 0 for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia unless materia.nil? variance += materia.stat_effects[3] if materia.special_effect == 'Defense Plus' variance += (materia.level * 5) end end end # Takes Percentage n *= ((100 + variance) / 100.0) n = [[Integer(n), 1].max, 999].min return n end #-------------------------------------------------------------------------- # * Get Agility (AGI) #-------------------------------------------------------------------------- def agi # Orginal Max Agi Method n = seph_materiasystem_gameactor_agi # Collects SP Difference From Materia variance = 0 for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia unless materia.nil? variance += materia.stat_effects[4] if materia.special_effect == 'Speed Plus' variance += (materia.level * 5) end end end # Takes Percentage n *= ((100 + variance) / 100.0) n = [[Integer(n), 1].max, 999].min return n end #-------------------------------------------------------------------------- # * Get Intelligence (INT) #-------------------------------------------------------------------------- def int # Orginal Max Int Method n = seph_materiasystem_gameactor_int # Collects SP Difference From Materia variance = 0 for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia unless materia.nil? variance += materia.stat_effects[5] if materia.special_effect == 'Magic Plus' variance += (materia.level * 5) end end end # Takes Percentage n *= ((100 + variance) / 100.0) n = [[Integer(n), 1].max, 999].min return n end #-------------------------------------------------------------------------- # * Change Equipment # equip_type : type of equipment # id : weapon or armor ID (If 0, remove equipment) #-------------------------------------------------------------------------- def equip(equip_type, id) # Removes Equipped Materia case equip_type when 0 # Weapon for materia in @weapon_materia $game_party.materia << materia unless materia.nil? end when 1 # Shield for materia in @armor1_materia $game_party.materia << materia unless materia.nil? end when 2 # Head for materia in @armor2_materia $game_party.materia << materia unless materia.nil? end when 3 # Body for materia in @armor3_materia $game_party.materia << materia unless materia.nil? end when 4 # Accessory for materia in @armor4_materia $game_party.materia << materia unless materia.nil? end end # Orginal Eqip Method seph_materiasystem_gameactor_equip(equip_type, id) # Resets Materia Slots case equip_type when 0 # Weapon sn = $data_weapons[@weapon_id].paired_materia * 2 + $data_weapons[@weapon_id].single_materia unless @weapon_id == 0 @weapon_materia = @weapon_id == 0 ? [] : Array.new(sn, nil) when 1 # Shield sn = $data_armors[@armor1_id].paired_materia * 2 + $data_armors[@armor1_id].single_materia unless @armor1_id == 0 @armor1_materia = @armor1_id == 0 ? [] : Array.new(sn, nil) when 2 # Head sn = $data_armors[@armor2_id].paired_materia * 2 + $data_armors[@armor2_id].single_materia unless @armor2_id == 0 @armor2_materia = @armor2_id == 0 ? [] : Array.new(sn, nil) when 3 # Body sn = $data_armors[@armor3_id].paired_materia * 2 + $data_armors[@armor3_id].single_materia unless @armor3_id == 0 @armor3_materia = @armor3_id == 0 ? [] : Array.new(sn, nil) when 4 # Accessory sn = $data_armors[@armor4_id].paired_materia * 2 + $data_armors[@armor4_id].single_materia unless @armor4_id == 0 @armor4_materia = @armor4_id == 0 ? [] : Array.new(sn, nil) end end #-------------------------------------------------------------------------- # * Change EXP # exp : new EXP #-------------------------------------------------------------------------- def exp=(exp) # If Gaining Exp if exp > @exp # Gets New Exp new_exp = exp - @exp # Sets Exp + % to 0 exp_plus = 0 for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia unless materia.nil? # Gains Exp materia.experience += new_exp if materia.special_effect == 'Exp Plus' exp_plus += (materia.level * 10) end end end new_exp *= ((100 + exp_plus) / 100.0) exp = new_exp.to_i + @exp end # Orginal Exp Method @exp = [[exp, 9999999].min, 0].max # Level up while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0 @level += 1 # 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 #-------------------------------------------------------------------------- # * Get Element Revision Value : Defense #-------------------------------------------------------------------------- def element_rate(element_id) # Gets Orginal Element Set result = seph_materiasystem_gameactor_elementrate(element_id) # Gets Paired Materia list paired = return_paired_materia # Checks each set for set in paired # Checks Armors if set[0] > 0 # Checks Support Materia materia = set[2] if materia.special_effect == 'Elemental' other_materia = set[3] if other_materia.elements.include?(element_id) result /= 2 end end end end return result end #-------------------------------------------------------------------------- # * Determine State Guard #-------------------------------------------------------------------------- def state_guard?(state_id) result = seph_materiasystem_gameactor_stateguard?(state_id) unless result # Gets Paired Materia list paired = return_paired_materia # Checks each set for set in paired # Checks Armors if set[0] > 0 # Checks Support Materia materia = set[2] if materia.special_effect == 'Status' other_materia = set[3] if other_materia.states.include?(state_id) result = true end end end end end return result end #-------------------------------------------------------------------------- # * Get Normal Attack Element #-------------------------------------------------------------------------- def element_set # Gets Previous Element Set result = seph_materiasystem_gameactor_elementset # Adds Materia Element Sets # Gets Paired Materia list paired = return_paired_materia # Checks each set for set in paired # Checks Weapon if set[0] == 0 # Checks Support Materia materia = set[2] if materia.special_effect == 'Elemental' other_materia = set[3] for elem_id in other_materia.elements result << elem_id unless set.include?(elem_id) end end end end return result end #-------------------------------------------------------------------------- # * Get Normal Attack State Change (+) #-------------------------------------------------------------------------- def plus_state_set # Gets Previous Status Set result = seph_materiasystem_gameactor_plusstateset # Gets Paired Materia list paired = return_paired_materia # Checks each set for set in paired # Checks Weapon if set[0] == 0 # Checks Support Materia materia = set[2] if materia.special_effect == 'Status' other_materia = set[3] for state_id in other_materia.states result << state_id unless set.include?(state_id) end end end end return result end #-------------------------------------------------------------------------- # * Equip Materia # equip_type : type of equipment # slot_index : index of materia # index : index in $game_party.materia #-------------------------------------------------------------------------- def equip_materia(equip_type, slot_index, index) # Gets Materia new_materia = $game_party.materia[index] # Unequip Materia materia = equip_type == 0 ? @weapon_materia[slot_index] : (eval "@armor#{equip_type}_materia")[slot_index] unless materia.nil? $game_party.materia << materia end # Modifies Materia case equip_type when 0 # Weapon return if @weapon_materia.size == 0 @weapon_materia[slot_index] = new_materia when 1 # Shield return if @armor1_materia.size == 0 @armor1_materia[slot_index] = new_materia when 2 # Head return if @armor2_materia.size == 0 @armor2_materia[slot_index] = new_materia when 3 # Body return if @armor3_materia.size == 0 @armor3_materia[slot_index] = new_materia when 4 # Accessory return if @armor4_materia.size == 0 @armor4_materia[slot_index] = new_materia end # Deletes Materia From Party: Materia $game_party.materia.delete_at(index) end #-------------------------------------------------------------------------- # * Equip Materia # equip_type : type of equipment # slot_index : index of materia #-------------------------------------------------------------------------- def unequip_materia(equip_type, slot_index) materia = equip_type == 0 ? @weapon_materia[slot_index] : (eval "@armor#{equip_type}_materia")[slot_index] unless materia.nil? $game_party.materia << materia end equip_type == 0 ? @weapon_materia[slot_index] = nil : (eval "@armor#{equip_type}_materia")[slot_index] = nil end #-------------------------------------------------------------------------- # * Return Paired Materia #-------------------------------------------------------------------------- def return_paired_materia # Creates Your Return Array paired = [] # Checks Weapon unless @weapon_id == 0 if $data_weapons[@weapon_id].paired_materia > 0 for i in 0...($data_weapons[@weapon_id].paired_materia * 2) materia = @weapon_materia[i] if materia.type == 'Support' o_i = i + ([0, 2, 4, 6].include?(i) ? 1 : - 1) other_materia = @weapon_materia[o_i] unless other_materia.nil? paired << [0, [i, o_i].min, materia, other_materia] end end end end end # Checks Armors for a in 1..4 unless (eval "@armor#{a}_id") == 0 if (eval "$data_armors[@armor#{a}_id].paired_materia") > 0 for i in 0...((eval "$data_armors[@armor#{a}_id].paired_materia") * 2) materia = (eval "@armor#{a}_materia")[i] if materia.type == 'Support' o_i = i + ([0, 2, 4, 6].include?(i) ? 1 : - 1) other_materia = (eval "@armor#{a}_materia")[o_i] unless other_materia.nil? paired << [a, [i, o_i].min, materia, other_materia] end end end end end end return paired end end
class Game_Party #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :materia #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias seph_materiasystem_gameparty_init initialize alias seph_materiasystem_gameparty_gaingold gain_gold #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize # Orginal Initialization Method seph_materiasystem_gameparty_init # Sets Up Materia Listings @materia = [] end #-------------------------------------------------------------------------- # * Gain Materia #-------------------------------------------------------------------------- def gain_materia(materia_index) # Adds Materia @materia << $data_materia[materia_index].dup end #-------------------------------------------------------------------------- # * Gain Gold (or lose) # n : amount of gold #-------------------------------------------------------------------------- def gain_gold(n) gil_plus = 0 for actor in @actors for materia in actor.weapon_materia + actor.armor1_materia + actor.armor2_materia + actor.armor3_materia + actor.armor4_materia unless materia.nil? if materia.special_effect == 'Gil Plus' gil_plus += (materia.level * 5) end end end end n *= (100 + gil_plus) / 100.0 # Orginal Gain Gold Method seph_materiasystem_gameparty_gaingold(n.to_i) end end
class Scene_Title #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias seph_materiasystem_scenetitle_main main alias seph_materiasystem_scenetitle_newgame command_new_game alias seph_materiasystem_scenetitle_continue command_continue #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # Orginal Main Method seph_materiasystem_scenetitle_main # Creates Materia Data List $data_materia = Materia_System::MATERIA_LIST end #-------------------------------------------------------------------------- # * Command: New Game #-------------------------------------------------------------------------- def command_new_game # Sets Weapon Materia Slots for i in 1...$data_weapons.size $data_weapons[i].set_materia_slots(Materia_System::WEAPON_MATERIA_SLOTS[i]) end # Sets Armors Materia Slots for i in 1...$data_armors.size $data_armors[i].set_materia_slots(Materia_System::ARMORS_MATERIA_SLOTS[i]) end # Orginal Command: New Game Method seph_materiasystem_scenetitle_newgame end #-------------------------------------------------------------------------- # * Command: Continue #-------------------------------------------------------------------------- def command_continue # Orginal Continue Method seph_materiasystem_scenetitle_continue # Sets Weapon Materia Slots for i in 1...$data_weapons.size $data_weapons[i].set_materia_slots(Materia_System::WEAPON_MATERIA_SLOTS[i]) end # Sets Armors Materia Slots for i in 1...$data_armors.size $data_armors[i].set_materia_slots(Materia_System::ARMORS_MATERIA_SLOTS[i]) end end end
class Scene_MateriaShop #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(materia_avialable = []) @materia_avialable = materia_avialable end #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # Help Window @help_window = Window_Help.new @help_window.set_text('What Would You like to Do?') # Shop Commands Window @shop_options_window = Window_HorizCommand.new( ['Buy Materia', 'Sell Materia', 'Exit'], 480) @shop_options_window.y = 64 # Party Gold Window @gold_window = Window_Gold.new @gold_window.x, @gold_window.y = 480, 64 # Dummy Window @dummy_window = Window_Base.new(0, 128, 640, 352) # Buy Materia Window @buy_items = Window_MateriaList.new(true, @materia_avialable) # Sell Materia Window @sell_items = Window_MateriaList.new(false) # Materia Bio Window @materia_bio = Window_MateriaBio.new # Scene Objects @objects = [@help_window, @shop_options_window, @gold_window, @buy_items, @sell_items, @dummy_window, @materia_bio] # Execute transition Graphics.transition # Main loop while $scene == self # Update game screen Graphics.update # Update input information Input.update # Update Scene Objects @objects.each {|x| x.update} # Frame update update end # Prepare for transition Graphics.freeze # Dispose of Scene Objects @objects.each {|x| x.dispose} end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Update : Shop Commands if @shop_options_window.active update_shop_commands # Update : Buy Materia elsif @buy_items.active update_buy_materia # Update : Sell Materia elsif @sell_items.active update_sell_materia end end #-------------------------------------------------------------------------- # * Frame Update : Shop Commands #-------------------------------------------------------------------------- def update_shop_commands # Sets Help Window Text @help_window.set_text('What Would You like to Do?') # If B is Pressed if Input.trigger?(Input::B) # Plays Cancel SE $game_system.se_play($data_system.cancel_se) # Proceeds To Map $scene = Scene_Map.new end # If C is Pressed if Input.trigger?(Input::C) # Plays Decision SE $game_system.se_play($data_system.decision_se) # Branch Shop Commands Index case @shop_options_window.index when 0 # Buy # Turns Off Shop Command Window @shop_options_window.active = false # Turns On Materia Bio Window @materia_bio.visible = true # Refreshes Materia Bio Window @materia_bio.refresh(@buy_items.materia) # Turns On Buy Items Window @buy_items.visible = @buy_items.active = true when 1 # Sell # Turns Off Shop Command Window @shop_options_window.active = false # Turns On Materia Bio Window @materia_bio.visible = true # Refreshes Materia Bio Window @materia_bio.refresh(@sell_items.materia) # Turns On Sell Items Window @sell_items.visible = @sell_items.active = true when 2 # Exit $scene = Scene_Map.new end end end #-------------------------------------------------------------------------- # * Frame Update : Buy Materia #-------------------------------------------------------------------------- def update_buy_materia # Sets Help Window Text @help_window.set_text('Which Materia Would You like To Purchase?') # If B is Pressed if Input.trigger?(Input::B) # Plays Cancel SE $game_system.se_play($data_system.cancel_se) # Turns Off Buy Materia Window @buy_items.visible = @buy_items.active = false # Resets index @buy_items.index = 0 # Turns Off Materia Bio Window @materia_bio.visible = false # Turns On Shop Commands Window @shop_options_window.active = true end # If C is Pressed if Input.trigger?(Input::C) # Gets materia materia = @buy_items.materia # Checks to see enought money is possesed if $game_party.gold < materia.buy_value # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play Shop SE $game_system.se_play($data_system.shop_se) # Gains Materia $game_party.gain_materia(materia.id) # Loses the Gold $game_party.lose_gold(materia.buy_value) # Refreshes Party Gold Window @gold_window.refresh # Refreshes Buy Materia Window @buy_items.refresh # Refreshes Sell Materia Window @sell_items.refresh # Refreshes Materia Bio Window @materia_bio.refresh(@buy_items.materia) end # If UP or DOWN is pressed if Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN) || Input.press?(Input::UP) || Input.press?(Input::DOWN) # Refreshes Materia Bio Window @materia_bio.refresh(@buy_items.materia) end end #-------------------------------------------------------------------------- # * Frame Update : Sell Materia #-------------------------------------------------------------------------- def update_sell_materia # Sets Help Window Text @help_window.set_text('Which Materia Would You like To Sell') # If B is Pressed if Input.trigger?(Input::B) # Plays Cancel SE $game_system.se_play($data_system.cancel_se) # Turns Off Buy Materia Window @sell_items.visible = @sell_items.active = false # Resets index @sell_items.index = 0 # Turns Off Materia Bio Window @materia_bio.visible = false # Turns On Shop Commands Window @shop_options_window.active = true end # If C is Pressed if Input.trigger?(Input::C) if @sell_items.materia.nil? # Play Buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play Shop SE $game_system.se_play($data_system.shop_se) # Gains the Gold $game_party.gain_gold(@sell_items.materia.sell_value) # Refreshes Party Gold Window @gold_window.refresh # Deletes Materia $game_party.materia.delete_at(@sell_items.index) # Refreshes Sell Materia Window @sell_items.refresh # Resets index @sell_items.index = 0 # Refreshes Materia Bio Window @materia_bio.refresh(@sell_items.materia) end # If UP or DOWN is pressed if Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN) || Input.press?(Input::UP) || Input.press?(Input::DOWN) # Refreshes Materia Bio Window @materia_bio.refresh(@sell_items.materia) end end end
class Scene_MateriaEquip #-------------------------------------------------------------------------- # * Object Initialization # actor_index : actor index # equip_index : equipment index #-------------------------------------------------------------------------- def initialize(actor_index = 0, equip_index = 0) @actor_index = actor_index @equip_index = equip_index @materia_index = 0 @actor = $game_party.actors[@actor_index] end #--------------------------------------------------------------------------- #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # Character Bio Window @character_bio_window = Window_MateriaActor.new(@actor) # Materia Bio Window @materia_bio_window = Window_MateriaEquipBio.new # Materia List @materia_list_window = Window_MateriaList.new(false, $game_party.materia, false) @materia_list_window.x, @materia_list_window.y = 400, 152 @materia_list_window.height = 328 @materia_list_window.visible = true # Materia Pointer Sprite @pointer_sprite = Sprite.new @pointer_sprite.x = 416 + (@materia_index + 1) * 24 - 28 @pointer_sprite.y = @equip_index * 24 + 18 @pointer_sprite.z = 9999 @pointer_sprite.bitmap = RPG::Cache.icon('Materia Cursor') # Updates Materia Bio update_materia_bio # Scene Objects @objects = [@character_bio_window, @materia_bio_window, @materia_list_window, @pointer_sprite] # Execute transition Graphics.transition # Main loop while $scene == self # Update game screen Graphics.update # Update input information Input.update # Updates Scene Objects @objects.each {|x| x.update} # Frame update update end # Prepare for transition Graphics.freeze # Dispose of Scene Objects @objects.each {|x| x.dispose} end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # List Update !@materia_list_window.active ? update_weapon_select : update_materia_select end #-------------------------------------------------------------------------- # * Frame Update : Weapon Select #-------------------------------------------------------------------------- def update_weapon_select # Updates Pointer Cursor @pointer_sprite.x = 416 + (@materia_index + 1) * 24 - 28 @pointer_sprite.y = @equip_index * 24 + 18 # If Up is pressed if Input.trigger?(Input::UP) # Plays Cursor SE $game_system.se_play($data_system.cursor_se) # Changes Equip Index @equip_index = @equip_index == 0 ? @equip_index = 4 : @equip_index -= 1 # Resets Materia Index @materia_index = 0 # Updates Materia Bio Window update_materia_bio end # If Down is pressed if Input.trigger?(Input::DOWN) # Plays Cursor SE $game_system.se_play($data_system.cursor_se) # Changes Equip Index @equip_index = @equip_index == 4 ? @equip_index = 0 : @equip_index += 1 # Resets Materia Index @materia_index = 0 # Updates Materia Bio Window update_materia_bio end # If Right is pressed if Input.trigger?(Input::RIGHT) # Plays Cursor SE $game_system.se_play($data_system.cursor_se) # Moves Cursor Right case @equip_index when 0 max = @actor.weapon_materia.size when 1 max = @actor.armor1_materia.size when 2 max = @actor.armor2_materia.size when 3 max = @actor.armor3_materia.size when 4 max = @actor.armor4_materia.size end return if max == 0 @materia_index = @materia_index == max - 1 ? @materia_index = 0 : @materia_index += 1 # Updates Materia Bio Window update_materia_bio end # If Left is pressed if Input.trigger?(Input::LEFT) # Plays Cursor SE $game_system.se_play($data_system.cursor_se) # Moves Cursor Left case @equip_index when 0 max = @actor.weapon_materia.size when 1 max = @actor.armor1_materia.size when 2 max = @actor.armor2_materia.size when 3 max = @actor.armor3_materia.size when 4 max = @actor.armor4_materia.size end return if max == 0 @materia_index = @materia_index == 0 ? @materia_index = max - 1 : @materia_index -= 1 # Updates Materia Bio Window update_materia_bio end # If L is pressed if Input.trigger?(Input::L) @actor_index = @actor_index == 0 ? @actor_index = $game_party.actors.size - 1 : @actor_index -= 1 $scene = Scene_MateriaEquip.new(@actor_index, @equip_index) end # If R is pressed if Input.trigger?(Input::R) @actor_index = @actor_index == $game_party.actors.size - 1 ? @actor_index = 0: @actor_index += 1 $scene = Scene_MateriaEquip.new(@actor_index, @equip_index) end # If A button is pressed if Input.trigger?(Input::A) # Play equip SE $game_system.se_play($data_system.equip_se) # Unequips materia @actor.unequip_materia(@equip_index, @materia_index) # Refreshes List Window @materia_list_window.refresh # Update Actor Bio Portion @character_bio_window.draw_actor_bio # Updates Actor Materia Portion @character_bio_window.draw_actor_materia # Updates Bio Window update_materia_bio end # If B button is pressed if Input.trigger?(Input::B) # Plays Cancel SE $game_system.se_play($data_system.cancel_se) # Proceeds To Map $scene = Scene_Menu.new end # If C button is pressed if Input.trigger?(Input::C) # Plays Cancel SE $game_system.se_play($data_system.decision_se) # Turns on the Materia Select Window @materia_list_window.active = true # Updates Materia Bio Window update_materia_bio end end #-------------------------------------------------------------------------- # * Frame Update : Materia Select #-------------------------------------------------------------------------- def update_materia_select # If B button is pressed if Input.trigger?(Input::B) # Plays Cancel SE $game_system.se_play($data_system.cancel_se) # Turns on the Materia Select Window @materia_list_window.active = false end # If C button is pressed if Input.trigger?(Input::C) if @materia_list_window.materia.nil? # Plays Buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play equip SE $game_system.se_play($data_system.equip_se) # Equips Materia @actor.equip_materia(@equip_index, @materia_index, @materia_list_window.index) # Refreshes List Window @materia_list_window.refresh # Update Actor Bio Portion @character_bio_window.draw_actor_bio # Updates Actor Materia Portion @character_bio_window.draw_actor_materia # Turns on the Materia Select Window @materia_list_window.active = false # Updates Bio Window update_materia_bio end # If Index Changes if Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN) || Input.press?(Input::UP) || Input.press?(Input::DOWN) # Updates Materia Bio Window update_materia_bio end end #-------------------------------------------------------------------------- # * Update Materia Bio Window #-------------------------------------------------------------------------- def update_materia_bio # If Materia Select if @materia_list_window.active @materia_bio_window.refresh(@materia_list_window.materia) # If Weapon Select else case @equip_index when 0 item = @actor.weapon_materia when 1 item = @actor.armor1_materia when 2 item = @actor.armor2_materia when 3 item = @actor.armor3_materia when 4 item = @actor.armor4_materia end @materia_bio_window.refresh(item[@materia_index]) end end end
class Scene_Battle #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias seph_materiasystem_scenebattle_init initialize #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize # Gets Data Skills Size @data_skill_size = $data_skills.size # Orgianl Main Method seph_materiasystem_scenebattle_init end end
class Scene_Battle #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias seph_materiasystem_scenebattle_skillselect update_phase3_skill_select alias seph_materiasystem_scenebattle_prior_actor phase3_prior_actor #-------------------------------------------------------------------------- # * Go to Command Input of Previous Actor #-------------------------------------------------------------------------- def phase3_prior_actor # Orginal Previous Actor Method seph_materiasystem_scenebattle_prior_actor unless @active_battler.nil? # Checks to See if Skill Was already selected if @active_battler.current_action.skill_id > @data_skill_size - 1 # Forgets Skill @active_battler.forget_skill(@active_battler.current_action.skill_id) # Deletes Skill From $data_skills $data_skills.pop # Sets Skill Selection to nil @skill = nil end end end #-------------------------------------------------------------------------- # * Frame Update (actor command phase : skill selection) #-------------------------------------------------------------------------- def update_phase3_skill_select # Orignal Enemy Select Method seph_materiasystem_scenebattle_skillselect # Gets Active Battlers Paired Mater paired_materia_set = @active_battler.return_paired_materia for paired_set in paired_materia_set materia = paired_set[2] other_materia = paired_set[3] if materia.special_effect == 'All' for skill_id in other_materia.skills if skill_id == @skill.id # Duplicates Skill and Changes ID new_skill = @skill.dup new_skill.scope = 2 if @skill.scope == 1 new_skill.scope = 4 if @skill.scope == 3 || @skill.scope == 7 new_skill.scope = 6 if @skill.scope == 5 new_skill.id = $data_skills.size $data_skills << new_skill @active_battler.learn_skill(new_skill.id) # Set action @active_battler.current_action.skill_id = new_skill.id # End skill selection end_skill_select # End enemy selection end_enemy_select unless @enemy_arrow.nil? # End actor selection end_actor_select unless @actor_arrow.nil? # Go to command input for next actor phase3_next_actor end end end end return end end #-------------------------------------------------------------------------- # * End SDK Enable Test #-------------------------------------------------------------------------- end