DescriptionThis script takes the equipment your character currently has equipped and shows graphics based on the equipment. If the equipment has no graphic setup, it won't show anything.
Note: This script does not work with the Caterpillar script (in that it won't show any but the lead character's equipment). Also, it may or may not conflict with the reflection/shadow scripts. This is untested.
How to UseFind this line:
CODE
def game_equip_filler
Below it, you need to add a line for each item you have a visual equipment for:
For weapons, the line of code looks like this:
$game_w_equipment[
WeaponID] = Game_Equipment.new(
file_name,
hue of characterset)
For armor, it looks like this:
$game_a_equipment[
ArmorID] = Game_Equipment.new(
file_name,
hue of characterset)
So. For the Bronze Sword, for example, you'd put:
$game_w_equipment[1] = Game_Equipment.new("BronzeSword", 0)
Of course,
file_name isn't just the name of the file. Since some charactersets are different sizes, I felt it necessary to make it so that things were characterset specific. For example, the character set image for the BronzeSword, if equipped by Arshes, would look like this:
001-Fighter01-BronzeSword.png
For Undead02, it'd look like this:
052-Undead02-BronzeSword.png
Of course, there will be duplicates of some images, if the characters are the same height, but this is a sacrifice for proper alignment of the sets.
For any additional information refer to the demo.
The ScriptCODE
class Game_Equipment
attr_accessor :character_name
attr_accessor :character_hue
def initialize(character_name, character_hue)
@character_name = character_name
@character_hue = character_hue
end
end
class Game_Player < Game_Character
attr_accessor :equip_name
attr_accessor :equip_hue
def initialize
super
@equip_name = [nil, nil, nil, nil, nil] # 5 for 5 slots (weapon, shield, head, body, accessory)
@equip_hue = [0, 0, 0, 0, 0]
end
alias ve_player_refresh refresh
def refresh
ve_player_refresh
actor = $game_party.actors[0]
if actor != nil
if $game_w_equipment[actor.weapon_id] != nil
@equip_name[0] = actor.character_name.to_s + "-" + $game_w_equipment[actor.weapon_id].character_name.to_s
@equip_hue[0] = $game_w_equipment[actor.weapon_id].character_hue
end
if $game_a_equipment[actor.armor1_id] != nil
@equip_name[1] = actor.character_name.to_s + "-" + $game_a_equipment[actor.armor1_id].character_name.to_s
@equip_hue[1] = $game_a_equipment[actor.armor1_id].character_hue
end
if $game_a_equipment[actor.armor2_id] != nil
@equip_name[2] = actor.character_name.to_s + "-" + $game_a_equipment[actor.armor2_id].character_name.to_s
@equip_hue[2] = $game_a_equipment[actor.armor2_id].character_hue
end
if $game_a_equipment[actor.armor3_id] != nil
@equip_name[3] = actor.character_name.to_s + "-" + $game_a_equipment[actor.armor3_id].character_name.to_s
@equip_hue[3] = $game_a_equipment[actor.armor3_id].character_hue
end
if $game_a_equipment[actor.armor4_id] != nil
@equip_name[4] = actor.character_name.to_s + "-" + $game_a_equipment[actor.armor4_id].character_name.to_s
@equip_hue[4] = $game_a_equipment[actor.armor4_id].character_hue
end
end
end
end
class Sprite_Equipment < RPG::Sprite
attr_accessor :character
def initialize(viewport, slotid, character = nil)
super(viewport)
@character = character
@slot_id = slotid
update
end
def update
super
if @tile_id != @character.tile_id or
@character_name != @character.equip_name[@slot_id] or
@character_hue != @character.equip_hue[@slot_id]
@tile_id = @character.tile_id
@character_name = @character.equip_name[@slot_id]
@character_hue = @character.equip_hue[@slot_id]
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.equip_name[@slot_id])
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = RPG::Cache.character(@character.equip_name[@slot_id],
@character.equip_hue[@slot_id])
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
end
end
self.visible = (not @character.transparent)
if @tile_id == 0
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
self.x = @character.screen_x
self.y = @character.screen_y
self.z = @character.screen_z(@ch)
self.opacity = @character.opacity
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
end
end
class Spriteset_Map
def initialize
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 200
@viewport3.z = 5000
@tilemap = Tilemap.new(@viewport1)
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
for i in 0..6
autotile_name = $game_map.autotile_names[i]
@tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
end
@tilemap.map_data = $game_map.data
@tilemap.priorities = $game_map.priorities
@panorama = Plane.new(@viewport1)
@panorama.z = -1000
@fog = Plane.new(@viewport1)
@fog.z = 3000
@character_sprites = []
for i in $game_map.events.keys.sort
sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
@character_sprites.push(sprite)
end
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
actor = $game_party.actors[0]
if $game_w_equipment[actor.weapon_id] != nil
@character_sprites.push(Sprite_Equipment.new(@viewport1, 0, $game_player))
end
if $game_a_equipment[actor.armor1_id] != nil
@character_sprites.push(Sprite_Equipment.new(@viewport1, 1, $game_player))
end
if $game_a_equipment[actor.armor2_id] != nil
@character_sprites.push(Sprite_Equipment.new(@viewport1, 2, $game_player))
end
if $game_a_equipment[actor.armor3_id] != nil
@character_sprites.push(Sprite_Equipment.new(@viewport1, 3, $game_player))
end
if $game_a_equipment[actor.armor4_id] != nil
@character_sprites.push(Sprite_Equipment.new(@viewport1, 4, $game_player))
end
@weather = RPG::Weather.new(@viewport1)
@picture_sprites = []
for i in 1..50
@picture_sprites.push(Sprite_Picture.new(@viewport2, $game_screen.pictures[i]))
end
@timer_sprite = Sprite_Timer.new
update
end
end
class Game_Party
alias ve_party_starting_members setup_starting_members
def setup_starting_members
ve_party_starting_members
$game_player.refresh
end
end
class Game_Actor
alias ve_actor_equip equip
def equip(equip_type, id)
ve_actor_equip(equip_type, id)
$game_player.refresh
end
end
class Game_System
alias ve_system_initialize initialize
def initialize
ve_system_initialize
$game_w_equipment = []
$game_a_equipment = []
game_equip_filler
end
# This is where you define new image files for the weapons/armor:
def game_equip_filler
# WEAPONS (*'d items need to be changed)
#$game_w_equipment[*WeaponID*] = Game_Equipment.new(*FileExtension*, *hue*)
# ARMORS (*'d items need to be changed)
$game_a_equipment[*ArmorID*] = Game_Equipment.new(*FileExtension*, *hue*)
end
end
The DemoThe DemoCredits go to Prexus. Idea was inspired by the similar script by Rataime which went missing during a forum attack however all the code is original and unique to Prexus.</div>