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.

Level Requirement Equipment

I am in the process of making an MMORPG, and I thought this would be a great script. Basically, all I want is a script that lets you set level requirements for weapons.

Example, since I suck at explaining:
Bronze Sword Requirements: Level 1 needed to equip this weapon.
Steel Sword Requirements: Level 7 needed to equip this weapon.

I saw one of these scripts a while back, but it didn't work, so I was wondering if there is another one or if anyone could whip up one of these? :D

Thanks in advance. :)
 
Heh I already did this for a request too bad hack messed it up, there was an edit history but the script I posted wasn't there anymore I'll try and look through my old projects, no use giving Trickster more work than he needs, since he needs to hurry up and finish his mission system ;)
 
Here I found it, Trickster, If you have started on it then go on ahead and finish it.

Code:
class Window_EquipItem
  def draw_item(index)
    item = @data[index]
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    case item
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    if item.req_level < @actor.level
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    opacity = self.contents.font.color == normal_color ? 255 : 128
    bitmap = RPG::Cache.icon(item.icon_name)
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
end

class Scene_Equip
  def update_item
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Activate right window
      @right_window.active = true
      @item_window.active = false
      @item_window.index = -1
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      item = @item_window.item
      if item != nil
        if item.req_level > @actor.level
          $game_system.se_play($data_system.buzzer_se)
          return
        end  
      end
      # Play equip SE
      $game_system.se_play($data_system.equip_se)
      # Get currently selected data on the item window
      item = @item_window.item
      # Change equipment
      @actor.equip(@right_window.index, item == nil ? 0 : item.id)
      # Activate right window
      @right_window.active = true
      @item_window.active = false
      @item_window.index = -1
      # Remake right window and item window contents
      @right_window.refresh
      @item_window.refresh
      return
    end
  end
end

module RPG
  class Weapon
    def req_level
      case id
      when 1
        level = 10
      else
        level = 0
      end
      return level
    end
  end
  
  class Armor
    def req_level
      case id
      when 1
        level = 10
      else
        level = 0
      end
      return level
    end
  end
end

To use this modify the method req_level in module RPG class Weapon and Armor the format is

when id
level = level

from my example Bronze Sword and Bronze Shield has a level requirement of level 10

where id is the id of the weapon or armor and level is the minimum level required, be warned if a hero has a weapon that level requirement is over their level and they unequip it they will not be able to requip it
 
Thanks Sephiroth ^^ This one must be a different version than what I tried before.

@Trickster: Well, if you havn't started yet, don't worry about it :P But like Sephiroth said, if you want to keep working on it, go ahead:)

I've just tested it, and I noticed only one thing. When you hit the required level, you can equip the weapon, but the weapon is still transparrant when you are selecting it to equip it untill you gain another level, then it is non-transparrant. It's just one small thing, but if you could fix it, it would be great :D
 
sirsk8aton said:
I've just tested it, and I noticed only one thing. When you hit the required level, you can equip the weapon, but the weapon is still transparrant when you are selecting it to equip it untill you gain another level, then it is non-transparrant. It's just one small thing, but if you could fix it, it would be great :D


Nvm, I just found it. That was an easy fix :D
 

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