Help - Search - Members - Calendar
Full Version: Submission: Visual Equipment
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS-Submissions
Prexus
Description
This 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 Use
Find 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 Script

CODE


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 Demo

The Demo

Credits 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>
Rpgx
Sweeeeet! Keep it up man! Awesome scripts! I love the Transparent one. Awesome!

Peace!
LocalScriptE
Could you put this up without the scroll bar?
It all comes up on ! line.
And the little "A" things make a syntax error
Creepy
Set your browser encoding as Unicode(UTF-8)
LocalScriptE
Thatks that worked
Soku
NOOOOO!!! the site doesnt work for the dmoe.. can we get a screeny or a fixed up demo pleasE?
Quinn
The link seems to be broken!
reaven
O M F G this is what if been looking for about 2 weeks GREAT JOB keep it up m8!!!
reaven
this doesnt work .........
i get syntax error at line 2
? attr_accessor :character_name

plz help
jens009
You have to delete every question mark (?) of the beginning of every line. These are extra characters that were created when the forum crashed.
SpawnUchiha
How'd you all download it?

EDIT: The Demo, not the Script.
reaven
thx for help but if got another problem = [
syntax error at line 180
$game_a_equipment[*ArmorID*] = Game_Equipment.new(*FileExtension*, *hue*)
plz help[again] ? = D
Faraway Life
QUOTE (reaven @ Jan 3 2009, 02:35 PM) *
thx for help but if got another problem = [
syntax error at line 180
$game_a_equipment[*ArmorID*] = Game_Equipment.new(*FileExtension*, *hue*)
plz help[again] ? = D


Here, just copy and paste this. I took the liberty of removing all the question marks and correcting the last line you're having trouble with, it'll work now smile.gif

QUOTE
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


Also I've rigged up this lamp character set to work with it, if you need something to test it with... Just rename the file to 001-Fighter01-BronzeSword
kinloads
hi, man this is a cool script but it doesnt work to me, can you create a new demo or fix a demo URL? i realy need that i creating online game smile.gif
davidjie
i used that script but why when i test the game the character still didnt show the equipment ?
BlackStatic
QUOTE (davidjie @ Jun 29 2009, 09:54 PM) *
i used that script but why when i test the game the character still didnt show the equipment ?

I've got a problem with line 35...

Script "Equipment" line 35: NoMethodError occurred.
undefined method `[]=' for NilClass

EDIT: Nevermind, I fixed it.
Imsosupafly
Does this only work for the main character? If so is it possible to make if for more? Lets say four characters in your party?
efeplaya35
please Only 1 Working Demo ... Its hard??? mad.gif
Rik evil of final fantasy
please anyone can give me the demo?
DreadOmen
This somehow conflicts with Blizz ABS:

Script 'Blizz-ABS 2' line 1533: NoMethodError occurred.

undefined method `refresh' for nil:NilClass

When I took Visual Equipment off, the game worked just fine.

Anybody know how to fix this?
BlackStatic
Hey, guys. I created a quick new demo for this script, if you still want one. All credit goes to Prexus, by the way. I'm not taking credit by making this demo.

Prexus' Visual Equipment Script. Demo by BlackStatic
dwellercoc
Ty for the Script and the new Demo.

How can i put Weapon sprite always on Top, cause Armor always put on top?.

[EDIT]

I solved the issue using this code:

#=================================================================
=============
# ** Visual_Equipment Re-Edited (version Kappa)
#------------------------------------------------------------------------------
# Written by Rataime
# New Edits by DerVVulfman
# February 10, 2008
#------------------------------------------------------------------------------
#
#------------------------------------------------------------------------------
# Revisions to note:
# 1) Added formatted headers and comments throughout the script.
# 2) Encapsulated the working code in a Visual Equipment module.
# 3) Set the equipment array into an instance value to lower resource costs.
# 4) Discovered a 'nil' $game_party bug. Added 'return if...' statements.
# 5) Removed unnecessary Window_SaveFile edit.
# 6) Interpreter routine for 'Change Equipment' now aliased.
# 7) Interpreter routine for 'Change Equipment' now changes visible equipment.
# 8) Support for 'Change Party Members' now works, even w/ Large Party systems.
# 9) 'Change Equipment' now compatible with Fukuyama's Train Actor script.
# 10) System should now be usable with or without RMXP SDK.
#------------------------------------------------------------------------------
# ** Changing party members or equipment while still visible on the map will
# ** force the map to refresh, giving a slight pause.
#==============================================================================



#==============================================================================
# ** module Visual Equipment
#------------------------------------------------------------------------------
# This module handles the image name and equipment drawing process.
#==============================================================================

module Visual_Equipment
module_function
#--------------------------------------------------------------------------
# * Update Visual Equipment
#--------------------------------------------------------------------------
def equip_update
@visual_equipment = Array.new
for i in 0..$game_party.actors.size
@visual_equipment[i+1] = []
end

#========================================================================
# ** C O N F I G U R A T I O N S Y S T E M ** #
#========================================================================
#
# Syntax to set weapons or armors in this script are as follows:
# add_weapon_sprite(weaponID, characterset)
# -or- add_armor_sprite(armorID, characterset)
#
# The ID number is the same as the ID number in the database.
# The charactersets are the extra graphics for the weapon/armor that is
# stored in the 'Graphics\Characterset' folder of your project.
# ARMOR LISTINGS
add_armor_sprite( 13, "ProtaPetoBronce")
add_armor_sprite( 14, "ProtaPetoOro")
add_armor_sprite( 15, "ProtaDragonRojo")
add_armor_sprite( 16, "ProtaMateriaNegra")
add_armor_sprite( 17, "CarcasaEsmeralda")
add_armor_sprite( 18, "WhiteArmor")
# CABEZA/HEAD
add_armor_sprite( 6, "CascoOro")
add_armor_sprite( 7, "CascoBronce")
# Anillos/COMPLEMENTO2/RINGS
add_armor_sprite( 25, "Colgante1")
add_armor_sprite( 26, "Colgante2")
# WEAPON LISTINGS
#add_weapon_sprite(33, "tpl_helmet_1") # <-didn't make a weapon image tongue.gif
add_weapon_sprite( 1, "espada1")
add_weapon_sprite( 2, "espadon")
add_weapon_sprite( 3, "ManaSword")
add_weapon_sprite( 4, "Combustion")
add_weapon_sprite( 5, "Frozee")
add_weapon_sprite( 6, "Terradigma")
add_weapon_sprite( 7, "Hoja de Acero")
add_weapon_sprite( 8, "ToxicBlade")
add_weapon_sprite( 9, "Raulra")
# ESCUDO/COMPLEMENTO1/SHIELD
add_armor_sprite( 1, "EscudoBronce")
add_armor_sprite( 33, "BolaMana")
add_armor_sprite( 35, "BolaVioleta")
add_armor_sprite( 34, "BolaVida")

#========================================================================
# **** E N D O F C O N F I G U R A T I O N S Y S T E M **** #
#========================================================================

#------------------------------------------------------------------------
# * Visual Equipment Functions
#------------------------------------------------------------------------
RPG::Cache.clear
return if $game_party == nil
for i in 0...$game_party.actors.size
for img in @visual_equipment[i+1]
bitmap = RPG::Cache.character($game_party.actors[i].character_name,
$game_party.actors[i].character_hue)
if img!=true and img!=false
add_equip(bitmap,img,i)
end
end
end
end
#--------------------------------------------------------------------------
# * Add Equipment
# sprite : Original sprite bitmap
# to_add : Equipment characterset
# character : Member in party
#--------------------------------------------------------------------------
def add_equip(sprite, to_add, character)
return if $game_party == nil
bmp = Sprite.new
bmp.visible = false
bmp.bitmap = RPG::Cache.character(to_add,
$game_party.actors[character].character_hue)
color = bmp.bitmap.get_pixel(0, 0)
x = sprite.width
y = sprite.height
if @visual_equipment[0]
x = x/4
y = y/4
end
for i in 0..x
for j in 0..y
color_get = bmp.bitmap.get_pixel(i, j)
if color_get != color
sprite.set_pixel(i, j ,color_get)
end
end
end
bmp = nil
end
#--------------------------------------------------------------------------
# * Add Weapon Sprite
# id : Weapon ID
# sprite : Weapon characterset
#--------------------------------------------------------------------------
def add_weapon_sprite(id, sprite)
return if $game_party == nil
for i in 0...$game_party.actors.size
if $game_party.actors[i].weapon_id == id
@visual_equipment[i+1].push(sprite)
end
end
end
#--------------------------------------------------------------------------
# * Add Armor Sprite
# id : Armor ID
# sprite : Armor characterset
#--------------------------------------------------------------------------
def add_armor_sprite(id, sprite)
return if $game_party == nil
for i in 0...$game_party.actors.size
if $game_party.actors[i].armor1_id == id or
$game_party.actors[i].armor2_id == id or
$game_party.actors[i].armor3_id == id or
$game_party.actors[i].armor4_id == id
@visual_equipment[i+1].push(sprite)
end
end
end
end



#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# Refer to "$game_temp" for the instance of this class.
#==============================================================================

class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :visual_transfer # Equipment changed in field switch
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias visual_initialize initialize
def initialize
# Perform the original call
visual_initialize
@visual_transfer = false # Equipment changed in field
end
end



#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs equipment screen processing.
#==============================================================================

class Scene_Equip
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias visual_update_right update_right
#--------------------------------------------------------------------------
# * Frame Update (when right window is active)
#--------------------------------------------------------------------------
def update_right
# If B button was pressed
if Input.trigger?(Input::cool.gif
# Update with the equipment
Visual_Equipment.equip_update
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(2)
return
end
# Perform the original call
visual_update_right
end
end



#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
# This class handles the player. Its functions include event starting
# determinants and map scrolling. Refer to "$game_player" for the one
# instance of this class.
#==============================================================================

class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias visual_update update
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Do not perform during equipment transfer
return if $game_temp.visual_transfer == true
# Perform the original call
visual_update
end
end



#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
# This interpreter runs event commands. This class is used within the
# Game_System class and the Game_Event class.
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias visual_command_129 command_129
alias visual_command_319 command_319
#--------------------------------------------------------------------------
# * Change Party Member
#--------------------------------------------------------------------------
def command_129
# Perform the original call
visual_command_129
# Update with the equipment
Visual_Equipment.equip_update
# Continue
return true
end
#--------------------------------------------------------------------------
# * Change Equipment
#--------------------------------------------------------------------------
def command_319
# Perform the original call
visual_command_319
# Update with the equipment
Visual_Equipment.equip_update
# Turns the transfer system on
$game_temp.visual_transfer = true
# Switch to map screen
$scene = Scene_Map.new
# Continue
return true
end
end



#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================

class Scene_Map
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias visual_update update
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Perform the original call
visual_update
# Turns equipment transfer system off
$game_temp.visual_transfer = false if $game_temp.visual_transfer == true
end
end



#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
# This class deals with characters. It's used as a superclass for the
# Game_Player and Game_Event classes.
#==============================================================================

class Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :character_hue
end



#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias visual_setup setup
#--------------------------------------------------------------------------
# * Setup
# actor_id : actor ID
#--------------------------------------------------------------------------
def setup(actor_id)
# Perform the original call
visual_setup(actor_id)
@character_hue = (@character_hue+1)%256
end
end



#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
# This class performs load screen processing.
#==============================================================================

class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias visual_read_save_data read_save_data
alias visual_on_cancel on_cancel
#--------------------------------------------------------------------------
# * Cancel Processing
#--------------------------------------------------------------------------
def on_cancel
# Update with the equipment
Visual_Equipment.equip_update
# Perform the original call
visual_on_cancel
end
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
def read_save_data(file)
# Perform the original call
visual_read_save_data(file)
# Update with the equipment
Visual_Equipment.equip_update
end
end



#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
# This class performs save screen processing.
#==============================================================================

class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias visual_on_decision on_decision
alias visual_on_cancel on_cancel
#--------------------------------------------------------------------------
# * Cancel Processing
#--------------------------------------------------------------------------
def on_cancel
# Update with the equipment
Visual_Equipment.equip_update
# Perform the original call
visual_on_cancel
end
#--------------------------------------------------------------------------
# * Decision Processing
#--------------------------------------------------------------------------
def on_decision(file)
# Update with the equipment
Visual_Equipment.equip_update
# Perform the original call
visual_on_decision(file)
end
end



#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs title screen processing.
#==============================================================================

class Scene_Title
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias visual_command_new_game command_new_game
#--------------------------------------------------------------------------
# * Command: New Game
#--------------------------------------------------------------------------
def command_new_game
# Perform the original call
visual_command_new_game
# Update with the equipment
Visual_Equipment.equip_update
end
end


Just change the order to change layer priority.
1 Layer --> # ARMOR LISTINGS
2 Layer --> # CABEZA/HEAD
3 Layer --> # WEAPON LISTINGS
4 Layer --># Anillos/COMPLEMENTO2/RINGS
5 Layer --> # ESCUDO/COMPLEMENTO1/SHIELD

(5 Layer is the "top" layer)
rebilacx
I get this error:

Script 'Visual Equipment' Line 121: NoMethodError occurred.
undefined method 'weapon_id' for nil:NilClass

any idea what I'm doing wrong?
nbrase
Cool it's a good script

i tryi't and i lik't

thanks man
Redjet30
dude, if people arent stupid its not hard, just make a parallel common event with conditional branches of what the player is equipped with
Tsukihime
QUOTE (Redjet30 @ Sep 23 2011, 02:30 PM) *
dude, if people arent stupid its not hard, just make a parallel common event with conditional branches of what the player is equipped with


When does the common event get called?
supercow
put: $game_temp.common_event_id = X #X ( being the id common event)
in scene_map
or scene_equip
or manualy use common event trigger switch ( i think )
Tsukihime
map and equip scenes are logical places to put it, but there are several other cases to consider

The simplest case is where the player goes to the equip menu and then changes an equip. You could call the common event when the player leaves the equip scene to make any visual updates if necessary.

Then there are cases where the equips are forcefully removed from the player. When and where these take place I don't know, but it might happen. Putting it on the map scene might work, though it would not be very efficient to be calling it at every frame update, especially if there are many different cases.

Then there is the possibility of some really customized system where it would be hard to determine just how equips can be changed.

I can't think of a good way to handle this. I definitely don't want to be calling it forever if I don't have to (ie: parallel process anywhere on the map)
supercow
sorry i dont use this so i cant really tell what to do, it worked in my mind but if it doesnt work then im stumped .
Night_Runner
QUOTE (Redjet30 @ Sep 24 2011, 08:30 AM) *
dude, if people arent stupid its not hard, just make a parallel common event with conditional branches of what the player is equipped with


Redjet30 was just trying to say that instead of using this script, you could make a common event that runs parallel with the map, and the common event shows the sword/armor on top of the character.

I can't remember what it would look like with evented commands, but something like:
CODE
Conditional Branch: Actor001 has Weapon1 (Bronze Sword) equipped
  Variable001[PlayerScreenX] = Player.screen_x
  Variable002[PlayerScreenY] = Player.screen_y
  Show Picture1 (Bronze Sword.png) at x = Variable001, y = Variable002
end

would accomplish the same thing as this script.

Well, that is a very simple model, but if you had conditional branches for what direction the player is facing, and how far into their step they are, it might work the same as the script. By that point though, the script would be much easier....
Tsukihime
Hmm, I wonder how that would affect gameplay on slower computers.
What kind of ways do people use to test how much of an impact a parallel event has on the rest of the game?
Night_Runner
There was an interesting article about the overhead of parallel processing.... here!.
But that's getting off topic from the perfectly good visual equipment script posted here.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.