RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Equipment Groups by Lytanathan

0 Members and 2 Guests are viewing this topic.

**
Rep:
Level 82
Living proof that paradoxes exist in reality.
Equipment Sets
Author: Lytanathan
Date: January 18, 2011
Version History


  • <Version 1.0> 01.18.2011 - Original Release

Description


This script is somewhat difficult to describe. It doesn't really add any functionality to the game itself, but rather is intended to make making the game a little bit easier.

Basically, what it does it allows you to create groups of equipment, and when you create an actor's class, you can select that group as being equippable rather than selecting every single item in the group.
For example, rather than having a knight who can equip Guard's Sword, Longsword, Mythril Sword, and Heron Sword, you simply have a knight who can equip Swords, and the script takes care of the rest.

Features

  • Allows you to create equipment groups that can be easily assigned to multiple classes.
  • You can use an ordinary job class as an equipment group, too! For example, a Mage-Knight could use the equipment groups of Knight and Wizard, allowing them full access to both classes' equipment sets.

Instructions

See script for instructions.
Note: My instructions are somewhat...  not that great, which is why I've included a demo. That way, you can see how I've set things up in the database, and that may help you understand how it works.

Script


Code: [Select]
#==============================================================================
# Equipment Sets by Lytanathan
#
# This script does not add any functionality to your project, but it can make
# making the project easier.
#
# It enables you to create groups of equipment, which can then be added to your
# character's equipment sets, without actually having to assign the individual
# items to the character's class.
#
# For example, rather than having a knight who can equip Guard's Sword,
# Longsword, Mythril Sword, and Heron Sword, you simply have a knight who can
# equip Swords, and the script takes care of the rest.
#
# Personally, I find this useful when I have large collections of weapons that
# can be used by multiple classes, such as Swords, Staves, Heavy Armor, Robes,
# etcetera, etcetera. Then, if you decide to rearrange the weapon or armor lists
# for any reason, perhaps to add new items you hadn't considered before or
# whatever, you don't need to change every class's equipment lists.
# Another use for it would be if you have a hybrid class like a MageKnight, as
# it can be used to combine the equipment sets of Mage and Knight without much
# effort.
#
# Note: If each class has a unique type of weapon or armor, like in FFX, where
# Tidus uses swords and shields, Yuna uses staves and rings, and Wakka uses
# blitzballs and armguards, then using this script is more work than it is
# worth. It works best when said groups are shared.
#------------------------------------------------------------------------------
# Anyways, Instructions for Use:
#
# 1. Create a dummy class for the item group. I usually use things like Swords,
#    Staves, Heavy Armor, Robes, etc.
#
# 2. In that dummy class, select the items that belong to that group.
#    Eg/Guard's Sword, Longsword, Mythril Sword, Heron Sword.
#    Groups can include both weapons and armor at the same time.
#
# 3. Create a dummy weapon or armor. It doesn't matter which.
#    In the notes box of said dummy equipment, include the following:
#
#        /LINK_TO_CLASS[x]
#    or
#        /LINK_TO_CLASS[x,x]

#    where x is the number of a class where you selected the actual equippable
#    items. Note that it doesn't have to be a dummy class as mentioned above,
#    you can use your actual job classes as well.
#
# 4. In your character's actual class, select the dummy item. Congratulations!
#    Your character can now equip everything that the classes the item are
#    linked to can equip.
#------------------------------------------------------------------------------
# Thing to be careful of:
#
# 1. If you have multiple "/LINK_TO_CLASS[x]"es on an item, only the
#    first will be used. It shouldn't be a problem, however, as you can link as
#    many classes as you want in one note.
#    "/LINK_TO_CLASS[1,2,3,5,8,13,21,34,55]" is perfectly valid, as long as you
#    have at least 55 classes.
#
# 2. Class order matters! I don't really know how to explain this,
#    so I will offer an example:
#
#    ------------------------------------------------+
#    Swords                                          |
#    Staves                                          | RIGHT! Your knight-mage
#    Knight (uses swords)                            | can now equip any sword
#    Wizard (uses staves)                            | or staff.
#    Mage-Knight (uses Knight and Wizard)            |
#    ------------------------------------------------+
#     
#    ------------------------------------------------+
#    Swords                                          | WRONG! Your knight-mage
#    Staves                                          | can equip the dummy items
#    Mage-Knight (uses Knight and Wizard)            | for swords and staves,
#    Knight (uses swords)                            | but no actual weapons.
#    Wizard (uses staves)                            | Poor knight-mage!
#    ------------------------------------------------+
#
#    The equipment sets are combined from top to bottom.
#    In the second example, the Mage-Knight will grab the equipment sets of the
#    Knight and Mage before their equipment sets are compiled. Your Mage-Knight
#    would be able to equip the dummy items Swords and Staves, but not any
#    actual swords or staves. This only matters when you stack classes like
#    this, however. You could list the Swords and Staves classes below Knight
#    and Wizard and it would work, as those base classes don't link to others.
#
# 3. Starting equipment and equipment that is equipped via events must be
#    included in the character's normal class, unless you want to equip them
#    using script calls.
#==============================================================================

class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    load_database                     # Load database
    fuse_equipment                    # Fuse equipment lists
    create_game_objects               # Create game objects
    check_continue                    # Determine if continue is enabled
    create_title_graphic              # Create title graphic
    create_command_window             # Create command window
    play_title_music                  # Play title screen music
  end
  #--------------------------------------------------------------------------
  # * Perform equipment list fusion
  #--------------------------------------------------------------------------
  def fuse_equipment
    for i in 1..$data_classes.length - 1
      for x in 0..$data_classes[i].weapon_set.length - 1
        text = $data_weapons[$data_classes[i].weapon_set[x]].note.dup
        if m = text.match (/\\LINK_TO_CLASS\[\d+(,\d+)*\]/i)
          text = m[0].sub(/\\LINK_TO_CLASS\[/i) { '' }
          text = text.sub(/\]/) { '' }
          a = text.split(',')
          for b in 0..a.length - 1
            a[b] = a[b].to_i
            $data_classes[i].weapon_set = $data_classes[i].weapon_set + $data_classes[a[b]].weapon_set
            $data_classes[i].armor_set = $data_classes[i].armor_set + $data_classes[a[b]].armor_set
          end
        end
      end
     
      for x in 0..$data_classes[i].armor_set.length - 1
        text = $data_armors[$data_classes[i].armor_set[x]].note.dup
        if m = text.match (/\\LINK_TO_CLASS\[\d+(,\d+)*\]/i)
          text = m[0].sub(/\\LINK_TO_CLASS\[/i) { '' }
          text = text.sub(/\]/) { '' }
          a = text.split(',')
          for b in 0..a.length - 1
            a[b] = a[b].to_i
            $data_classes[i].weapon_set = $data_classes[i].weapon_set + $data_classes[a[b]].weapon_set
            $data_classes[i].armor_set = $data_classes[i].armor_set + $data_classes[a[b]].armor_set
          end
        end
      end
    end
  end
end


Credit


  • Lytanathan

Demo


See attached.

Restrictions

Eh, I don't really care how anyone decides to use this. Just don't claim it as your own, and if you modify it so that it works more efficiently/effectively, or you fix one of the "Things to be careful of" listed in the instructions in the script, I would like to know so that I can improve the original. I'm still a newbie scripter, and can use all the advice I can get.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
nice little idea. It might have been better to alias either load_database or create_game_objects rather than overwrite the start method of Scene_Title (as that could potentially cause compatibility issues), but all in all a good idea. Nice work.

**
Rep:
Level 73
.
I don't really get what that script does. You can set wich class what item can equip in database, and as i read instruction, this script is doing exacly the same. Can you explain me how it really works? (sorry for bad english)

**
Rep:
Level 82
Living proof that paradoxes exist in reality.
Well, it doesn't really do anything... the reason I made it goes kinda like this...
I have a tendency to use large numbers of classes and different types of weapons.
Next, I will quite often for one reason or another re-arrange the weapon/armor lists... after already assigning all the equipment to the classes.
Using this script, I don't need to change 16+ entire equip set lists, only a small portion of the list for each different type of equip. And when you're dealing with mile-long equip lists, believe me, it saves time and reduces rapid-clicky-finger-soreness.

And to better explain how it actually works, imagine it like a character having multiple subclasses, allowing them to equip different types of equipment. Which ones they can use are defined by the dummy items their main class is capable of equiping. (if character can equip dummy item Swords, then character has subclass of Swords).
« Last Edit: January 21, 2011, 07:46:05 AM by Lytanathan »

**
Rep:
Level 84
Oh this looks really useful. I always go through tons and tons of things. But I hate setting equipment over and over again lol.