Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

2 Pages V  < 1 2  
Closed TopicStart new topic
> Submission: Visual Equipment, by Prexus
BlackStatic
post Apr 16 2010, 04:11 PM
Post #21


Level 2
Group Icon

Group: Member
Posts: 19
Type: Writer
RM Skill: Skilled




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


__________________________
I'm a machine, but I'm a funny color...
Go to the top of the page
 
+Quote Post
   
dwellercoc
post May 5 2010, 07:18 AM
Post #22


Level 1
Group Icon

Group: Member
Posts: 10
Type: None
RM Skill: Beginner




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)

This post has been edited by dwellercoc: May 8 2010, 10:52 PM
Go to the top of the page
 
+Quote Post
   
rebilacx
post Jun 19 2010, 07:14 PM
Post #23



Group Icon

Group: Member
Posts: 4
Type: None
RM Skill: Undisclosed




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?
Go to the top of the page
 
+Quote Post
   
nbrase
post Mar 26 2011, 11:52 AM
Post #24


Level 2
Group Icon

Group: Member
Posts: 24
Type: None
RM Skill: Undisclosed




Cool it's a good script

i tryi't and i lik't

thanks man


__________________________
Go to the top of the page
 
+Quote Post
   
Redjet30
post Sep 23 2011, 02:30 PM
Post #25



Group Icon

Group: Member
Posts: 3
Type: None
RM Skill: Advanced




dude, if people arent stupid its not hard, just make a parallel common event with conditional branches of what the player is equipped with


__________________________

Matthew Matthew Matthew
]

title

http://www.???.com
Go to the top of the page
 
+Quote Post
   
Tsukihime
post Sep 23 2011, 03:06 PM
Post #26


Level 25
Group Icon

Group: Revolutionary
Posts: 561
Type: None
RM Skill: Undisclosed
Rev Points: 25




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?


__________________________
My Scripts
Go to the top of the page
 
+Quote Post
   
supercow
post Sep 23 2011, 04:53 PM
Post #27


Level 15
Group Icon

Group: Revolutionary
Posts: 280
Type: Artist
RM Skill: Undisclosed




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 )
Go to the top of the page
 
+Quote Post
   
Tsukihime
post Sep 23 2011, 08:12 PM
Post #28


Level 25
Group Icon

Group: Revolutionary
Posts: 561
Type: None
RM Skill: Undisclosed
Rev Points: 25




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)

This post has been edited by Tsukihime: Sep 23 2011, 08:13 PM


__________________________
My Scripts
Go to the top of the page
 
+Quote Post
   
supercow
post Sep 24 2011, 01:09 AM
Post #29


Level 15
Group Icon

Group: Revolutionary
Posts: 280
Type: Artist
RM Skill: Undisclosed




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 .
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Sep 24 2011, 05:58 AM
Post #30


Level 50
Group Icon

Group: +Gold Member
Posts: 1,525
Type: Scripter
RM Skill: Undisclosed




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....


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   
Tsukihime
post Sep 24 2011, 04:42 PM
Post #31


Level 25
Group Icon

Group: Revolutionary
Posts: 561
Type: None
RM Skill: Undisclosed
Rev Points: 25




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?

This post has been edited by Tsukihime: Sep 24 2011, 04:42 PM


__________________________
My Scripts
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Sep 25 2011, 05:33 AM
Post #32


Level 50
Group Icon

Group: +Gold Member
Posts: 1,525
Type: Scripter
RM Skill: Undisclosed




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.


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   

2 Pages V  < 1 2
Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 24th May 2013 - 01:55 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker