Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

The Merge Script by Mike_Black

Hi everybody! (Hi Sasuke446). Anyway, as the title says, the prob is something about the Merge Script Version 2.0 . I understand that when you merge two things you lose the origanal items. So when I merge with any of the ores i don't lose 1 of them. Mind you, the armor changes. I am very confused.@_@ If the soloution works, I PROMISE i will put you in Special Thanks.
^^First post the script , else we wont be able to help you. Chaosg1
Code:
#==============================================================================
  # ** Scene_Enchant
  #------------------------------------------------------------------------------
  # Mike Black
  # Version 1.1
  # August 7th 2006
  #==============================================================================

class Scene_Enchant
  def initialize(menu_index = 0)
    @menu_index = menu_index #Store the cursor position
    @weapon = false
    @base_stats = []
    @attr_stats = []
    @elements_fortext = []
    @elements= []
    @plus_state = []
    @minus_state = []
    @ore_list = []
    load_ores
  end  

  def load_ores
    
    #----------------------------------------Begin Ore-----------------------------------------------
    
    #default ore settings
    new_ore = RPG::Ore.new("Fire Ore")   #name
    new_ore.set_id(48)  #id link to database  *** must be the same as the id in the database with the corresponding ore
    new_ore.set_icon_name("043-Item12")
    new_ore.set_description("An ore to give a 'firery' touch to weapons.") 
    new_ore.set_elements([18]) 
    new_ore.set_plus_states([]) 
    new_ore.set_minus_states([])
    new_ore.set_price_bonus(500)
    
    #ore settings for weapons
    new_ore.set_wep_atk(1)
    new_ore.set_wep_pdef(1)
    new_ore.set_wep_mdef(0)
    new_ore.set_wep_str(2)
    new_ore.set_wep_agi(0)
    new_ore.set_wep_dex(0)
    new_ore.set_wep_int(0)
    new_ore.set_wep_prefix("Fire Enchanted")  #will go before weapon name
    new_ore.set_wep_postfix("")  #will go after weapon name
    new_ore.set_wep_anim(201)  #id of animation to use with a weapon forged with this ore
    
    #ore settings for armor
    new_ore.set_arm_eva(0)
    new_ore.set_arm_pdef(3)
    new_ore.set_arm_mdef(9)
    new_ore.set_arm_str(10)
    new_ore.set_arm_agi(0)
    new_ore.set_arm_dex(0)
    new_ore.set_arm_int(0)
    new_ore.set_arm_prefix("Hot ")  #will go before armor name
    new_ore.set_arm_postfix("")  #will go after armor name
    
    @ore_list.push(new_ore)
    
    #--------------------------------------------end of ore-------------------------------------------
    
    #----------------------------------------Begin Ore-----------------------------------------------
    
    #default ore settings
    new_ore = RPG::Ore.new("Earth Ore")   #name
    new_ore.set_id(49)  #id link to database  *** must be the same as the id in the database with the corresponding ore
    new_ore.set_icon_name("043-Item12")
    new_ore.set_description("An ore that will give a 'earthly' touch.") 
    new_ore.set_elements([16]) 
    new_ore.set_plus_states([]) 
    new_ore.set_minus_states([])
    new_ore.set_price_bonus(500)
    
    #ore settings for weapons
    new_ore.set_wep_atk(5)
    new_ore.set_wep_pdef(0)
    new_ore.set_wep_mdef(0)
    new_ore.set_wep_str(0)
    new_ore.set_wep_agi(0)
    new_ore.set_wep_dex(5)
    new_ore.set_wep_int(0)
    new_ore.set_wep_prefix("")  #will go before weapon name
    new_ore.set_wep_postfix(" of Earth")  #will go after weapon name
    new_ore.set_wep_anim(202)  #id of animation to use with a weapon forged with this ore
    
    #ore settings for armor
    new_ore.set_arm_eva(0)
    new_ore.set_arm_pdef(7)
    new_ore.set_arm_mdef(10)
    new_ore.set_arm_str(0)
    new_ore.set_arm_agi(0)
    new_ore.set_arm_dex(10)
    new_ore.set_arm_int(0)
    new_ore.set_arm_prefix("")  #will go before armor name
    new_ore.set_arm_postfix(" of Rocks")  #will go after armor name
    
    @ore_list.push(new_ore)
    
    #--------------------------------------------end of ore-------------------------------------------
    
    #----------------------------------------Begin Ore-----------------------------------------------
    
    #default ore settings
    new_ore = RPG::Ore.new("Ice Ore")   #name
    new_ore.set_id(50)  #id link to database  *** must be the same as the id in the database with the corresponding ore
    new_ore.set_icon_name("043-Item12")
    new_ore.set_description("An ore that will give a 'cold' touch.") 
    new_ore.set_elements([17]) 
    new_ore.set_plus_states([]) 
    new_ore.set_minus_states([])
    new_ore.set_price_bonus(500)
    
    #ore settings for weapons
    new_ore.set_wep_atk(5)
    new_ore.set_wep_pdef(0)
    new_ore.set_wep_mdef(0)
    new_ore.set_wep_str(0)
    new_ore.set_wep_agi(0)
    new_ore.set_wep_dex(0)
    new_ore.set_wep_int(5)
    new_ore.set_wep_prefix("")  #will go before weapon name
    new_ore.set_wep_postfix("of Ice")  #will go after weapon name
    new_ore.set_wep_anim(203)  #id of animation to use with a weapon forged with this ore
    
    #ore settings for armor
    new_ore.set_arm_eva(0)
    new_ore.set_arm_pdef(-1)
    new_ore.set_arm_mdef(15)
    new_ore.set_arm_str(0)
    new_ore.set_arm_agi(0)
    new_ore.set_arm_dex(0)
    new_ore.set_arm_int(5)
    new_ore.set_arm_prefix("Frosty")  #will go before armor name
    new_ore.set_arm_postfix("")  #will go after armor name
    
    @ore_list.push(new_ore)
    
    #--------------------------------------------end of ore-------------------------------------------
    
    #----------------------------------------Begin Ore-----------------------------------------------
    
    #default ore settings
    new_ore = RPG::Ore.new("Light Ore")   #name
    new_ore.set_id(51)  #id link to database  *** must be the same as the id in the database with the corresponding ore
    new_ore.set_icon_name("043-Item12")
    new_ore.set_description("An ore that will give a 'heavenly' touch.") 
    new_ore.set_elements([5]) 
    new_ore.set_plus_states([]) 
    new_ore.set_minus_states([])
    new_ore.set_price_bonus(500)
    
    #ore settings for weapons
    new_ore.set_wep_atk(7)
    new_ore.set_wep_pdef(0)
    new_ore.set_wep_mdef(9)
    new_ore.set_wep_str(2)
    new_ore.set_wep_agi(0)
    new_ore.set_wep_dex(6)
    new_ore.set_wep_int(0)
    new_ore.set_wep_prefix("")  #will go before weapon name
    new_ore.set_wep_postfix("of Light")  #will go after weapon name
    new_ore.set_wep_anim(202)  #id of animation to use with a weapon forged with this ore
    
    #ore settings for armor
    new_ore.set_arm_eva(0)
    new_ore.set_arm_pdef(9)
    new_ore.set_arm_mdef(13)
    new_ore.set_arm_str(0)
    new_ore.set_arm_agi(0)
    new_ore.set_arm_dex(2)
    new_ore.set_arm_int(0)
    new_ore.set_arm_prefix("")  #will go before armor name
    new_ore.set_arm_postfix(" of Light")  #will go after armor name
    
    @ore_list.push(new_ore)
    
    #--------------------------------------------end of ore----------------------
    
    
  end
    
  def main
    @help_window = Window_Help.new

    @window_2=Window_Enchant_Left.new
    @window_2.y=50
    @window_2.active = true
    @window_2.index = @menu_index

    @window_3=Window_Enchant_Right.new(@ore_list)
    @window_3.x=320
    @window_3.y=50
    @window_3.active = false
   
    @window_4=Window_Enchant_Bottom.new
    @window_4.x=0
    @window_4.y=250

    @window_2.help_window = @help_window
    @window_3.help_window = @help_window
   
    Graphics.transition
    loop do
    Graphics.update
    Input.update
    update
    if $scene != self
      break
    end
  end

  Graphics.freeze
  @help_window.dispose
  @window_2.dispose
  @window_3.dispose
  @window_4.dispose
  end

  
  def update
    @window_2.update
    @help_window.update
    @window_3.update
    @window_4.update
    if @window_2.active
      update_2
      return
    end
    if @window_3
      update_3
      return
    end
  end
  
  #For Window_Enchant_Left active:
  def update_2
    stats = []
    item = @window_2.item
    case item
      when RPG::Weapon
        stats[0] = item.atk
        stats[1] = item.pdef
        stats[2] = item.mdef
        stats[3] = (0 - item.agi_plus)
        stats[4] = item.str_plus
        stats[5] = item.dex_plus
        stats[6] = item.int_plus
        stats[7] = item.price             
        stats[8] = "Attack Power :"
        stats[9] = "Physical Defense :"
        stats[10] = "Magic Defense :"
        stats[11] = item.name
        stats[12] = item.id
        stats[13] = item.icon_name
        stats[14] = item.animation1_id
        stats[15] = item.animation2_id
        @weapon = true
       
      when RPG::Armor
        stats[0] = item.pdef
        stats[1] = item.mdef
        stats[2] = item.eva
        stats[3] = (0 - item.agi_plus)
        stats[4] = item.str_plus
        stats[5] = item.dex_plus
        stats[6] = item.int_plus
        stats[7] = item.price
        stats[8] = "Physical Defense :"
        stats[9] = "Magic Defense :"
        stats[10] = "Evade :"
        stats[11] = item.name
        stats[12] = item.id
        stats[13] = item.icon_name
        stats[14] = item.kind
        @weapon = false
      end
      
    @base_stats = stats
    @window_4.update_stats(stats)
      
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      @window_2.active = false
      @window_3.active = true
      return
    end
  end
  
  
  #For Window_Enchant_Right active:
  def update_3
    stats = []
    item = @window_3.item
    @elements = item.element_set #elements
    @plus_state = item.plus_state_set  #add state
    @minus_state = item.minus_state_set  #minus state
    stats[0] = item.atk_w   #atk
    stats[1] = item.pdef_w  #def
    stats[2] = item.mdef_w  #mdef
    stats[3] = item.agi_w #agi
    stats[4] = item.str_w  #str
    stats[5] = item.dex_w  #vit
    stats[6] = item.int_w  #int
    stats[7] = item.animation_id_w 
    stats[8]  = item.prefix_w
    stats[9] = item.postfix_w
    stats[10] = item.pdef_a
    stats[11] = item.mdef_a
    stats[12] = item.eva_a #evade (armor)
    stats[13] = item.agi_a #agi
    stats[14] = item.str_a  #str
    stats[15] = item.dex_a  #vit
    stats[16] = item.int_a  #int
    stats[17] = item.price_bonus
    stats[18] = item.prefix_a
    stats[19] = item.postfix_a
    
    
    @attr_stats = stats
    
    @window_4.draw_improve(stats,@elements,@plus_state,@weapon)
    
    if Input.trigger?(Input::B)
      @window_3.active = false
      @window_2.active = true
      return
    end
    flag = true
    if Input.trigger?(Input::C)
      if(@weapon)
        @full_name = @attr_stats[8].to_s + @base_stats[11].to_s + @attr_stats[9].to_s
        #check for dupe
        for i in 1...$data_weapons.size
          if(@full_name == $data_weapons[i].name)
            flag = false
            $game_party.gain_weapon(i, 1)
          end
        end
        if(flag)
          forge_weapon
        else
          $scene = Scene_Map.new
        end
      else
        @full_name = @attr_stats[18].to_s + @base_stats[11].to_s + @attr_stats[19].to_s
        #check for dupe
        for i in 1...$data_armors.size
          if(@full_name == $data_armors[i].name)
            flag = false
            $game_party.gain_armor(i, 1)
          end
        end
        if(flag)
          forge_armor
        else
          $scene = Scene_Map.new
        end
      end
    end
  end
 
  
  def forge_weapon
    newid = $data_weapons.size
    newweapon = RPG::Weapon.new
    newweapon.name = @full_name
    newweapon.icon_name = @base_stats[13]
    newweapon.description = "A custom made Magical Weapon of Power"
    newweapon.animation1_id = @base_stats[14]
    newweapon.animation2_id = @attr_stats[7]
    newweapon.price = (@base_stats[7] + @attr_stats[17])
    newweapon.atk = (@base_stats[0] + @attr_stats[0])
    newweapon.pdef = (@base_stats[1] + @attr_stats[1])
    newweapon.mdef = (@base_stats[2] + @attr_stats[2])
    newweapon.agi_plus = (0 - (@base_stats[3] + @attr_stats[3]))
    newweapon.str_plus = (@base_stats[4] + @attr_stats[4])
    newweapon.dex_plus = (@base_stats[5] + @attr_stats[5])
    newweapon.int_plus = (@base_stats[6] + @attr_stats[6])
    newweapon.element_set = @elements
    newweapon.plus_state_set = @plus_state
    newweapon.minus_state_set = @minus_state
    newweapon.id = newid
    $data_weapons.push(newweapon)
    $game_party.gain_weapon(newid, 1)
    for i in 1...$data_classes.size 
      for j in 0...$data_weapons.size
        if($data_classes[i].weapon_set[j] == @base_stats[12])
          $data_classes[i].weapon_set.push(newid)
        end
      end
    end
    $game_party.lose_weapon(@base_stats[12], 1)
    $scene = Scene_Map.new
  end
  

  def forge_armor
    newid = $data_armors.size
    newarmor = RPG::Armor.new
    newarmor.name = @full_name
    newarmor.icon_name = @base_stats[13]
    newarmor.description = "A custom made Magical armor of Power"
    newarmor.price = (@base_stats[7] + @attr_stats[17])
    newarmor.eva = (@base_stats[2] + @attr_stats[12])
    newarmor.pdef = (@base_stats[0] + @attr_stats[10])
    newarmor.mdef = (@base_stats[1] + @attr_stats[11])
    newarmor.agi_plus = (0 - (@base_stats[3] + @attr_stats[13]))
    newarmor.str_plus = (@base_stats[4] + @attr_stats[14])
    newarmor.dex_plus = (@base_stats[5] + @attr_stats[15])
    newarmor.int_plus = (@base_stats[6] + @attr_stats[16])
    newarmor.kind = @base_stats[14]
    newarmor.guard_element_set = @elements
    newarmor.guard_state_set = @plus_state
    newarmor.id = newid
    $data_armors.push(newarmor)
    $game_party.gain_armor(newid, 1)
    for i in 1...$data_classes.size 
      for j in 0...$data_armors.size
        if($data_classes[i].armor_set[j] == @base_stats[12])
          $data_classes[i].armor_set.push(newid)
        end
      end
    end
    $game_party.lose_armor(@base_stats[12], 1)
    $scene = Scene_Map.new
  end
end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top