Galv's Magic Shards - Force Equip Script Call

Hey! 👋

I was wondering if someone could help me create a script call add on for Galv's Magic Shards script.

What I'm hoping to have is a script call that can automatically equip an actor with a specific shard. Something along the lines of

Code:
shard_equip(x,y,z)

Where X is the actor ID, Y is the item type (item/weapon/armor), and Z is the item ID.

Thank you!
This should work fine:
Spoiler
Code:
class Game_Actor < Game_Battler
 
  def add_shard(item, index = 0)
    return if @shards.empty?
    if @shards[index].is_a?(RPG::BaseItem)
      $game_party.gain_item(@shards[index], 1)
    end
    @shards.delete_at(index)
    @shards.insert(index, item)
  end
    
end

class Game_Interpreter
 
  def shard_equip(actor_id, type, item_id, index = 0)
    case type
    when :item; item = $data_items[item_id]
    when :weapon; item = $data_weapons[item_id]
    when :armor; item = $data_armors[item_id]
    end
    return unless item && item.shard
    $game_actors[actor_id].add_shard(item, index)
  end
    
end

Use the following:
Code:
shard_equip(actor_id, type, item_id, index)
# actor_id is the ID of the actor
# type is either :item, :armor or :weapon
# item_id is the ID of the item
# index is the index you want to equip the shard to (starting from 0, so the first slot would be 0)

# You can also do:
shard_equip(actor_id, type, item_id)
# and it will use the first shard slot index

Hope this helps. Of course, it doesn't take into account whether the item is in your inventory. If there's already a shard equipped in the slot index you choose, then it will swap it out.
Works beautifully! The fact that it doesn't check the inventory shouldn't be any issue, but thanks for letting me know.

Thank you again! 🙏

Original thread: https://forums.rpgmakerweb.com/threads/galvs-magic-shards-force-equip-script-call.104538/