Galv's Magic Shards - Force Equip Script Call

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
467
Reaction score
165
First Language
English
Primarily Uses
RMMV
Hey! :kaohi:

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!
 

A-Moonless-Night

WINTER IS COMING
Veteran
Joined
Mar 17, 2012
Messages
605
Reaction score
404
First Language
English
Primarily Uses
RMVXA
This should work fine:
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.
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
467
Reaction score
165
First Language
English
Primarily Uses
RMMV
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! :kaothx:
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Every RPG and MMO should let you transmog\glamour your gear so you can look the way you want.
So, to clear up things, this section is to speak about personal life stuff and such? or maybe upload game content?
excerpt from my game FW: WHAT?! You want me to shear sheep? I had servants, who had servants, that had servants that did peasants work. Vincent: Do you see any of your servants here? FW: Well... no. Of course not. Vincent: Then get to work.
The dumbest mechanic I just encountered today : boss recovers 10% HP when a party member is KO-ed, who thinks this is a great idea again...?
Apparently my brain took a holiday today, so far I've stared blankly at the maker for 3 hours. Duuuuuuuuh.

Forum statistics

Threads
97,760
Messages
946,777
Members
128,970
Latest member
FreePint97
Top