Visual_Equipment with different sprite sizes

hi i am making a game with xp.
Please understand that English is not my first language and I used a translator.

Here's the problem.
After a fairly persistent search, I found a script that changes the appearance depending on the equipment worn.
This was almost exactly what I wanted
But there is one problem.
As you equip the equipment, the size of the overlaid sprite is limited by the size of the overlaid sprite.
As a result, I couldn't implement the huge wings or huge weapons I wanted to implement.

Spoiler
#==============================================================================
# ** 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( 1, "HAIR")

# HEAD
#add_armor_sprite( 6, "CascoOro")

# Rings
# add_armor_sprite( 25, "Colgante1")


# WEAPON LISTINGS
#add_weapon_sprite(33, "tpl_helmet_1") # <-didn't make a weapon image 😛
#SHIELD
#add_armor_sprite( 1, "EscudoBronce")


#========================================================================
# **** 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.character_name,
$game_party.actors.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+50
y = sprite.height
if @visual_equipment[0]
x = x/4
y = y/4
end
for i in 0..y
for j in 0..x
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.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.armor1_id == id or
$game_party.actors.armor2_id == id or
$game_party.actors.armor3_id == id or
$game_party.actors.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::😎
# 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

Before I found this script, I tried to create an event for the equipment to follow the character, but it didn't feel like one body due to the delay in movement.
So, I received the xy coordinates of the character as an event and variable and moved it.
As the character moved, the interpolated part was not applied, so the result was that the character moved first and then teleported when the movement was completed.
In the end, I think the event should be updated with the screen location of a specific actor, but I don't know of a script that changes the location of the event.

I know C# at a very basic level, so I can do basic things like assigning values, but Ruby is very unfamiliar to me, so I have a lot of difficulty.

Is there anyone who can revamp that script or point me to a new one?

To summarize:

1. When using this script, whenever the equipment is worn, the appearance of the equipment added above the actor's sprite layer appears, and this is the effect I want perfectly.

2. However, there is a problem with not displaying a sprite that is larger than the actor's sprite (to be precise, it has a different size than the actor's sprite).

3. If it is impossible to solve with the script above, I would like to make the screen location of the event updated the same as the screen location of the actor.
i'm sorry
I guess I wrote too carelessly
What I want is exactly the first one
Since the moving position of the event is not the real coordinates of the character on the screen, but the logical coordinates, a disconnection occurs as shown in the following figure.
I'd like to do this with a script every frame by parallel processing inside an event.
Is there a way to receive the character's position on the screen and input the coordinates to the corresponding event?


*blue one - character
*red one - event
*black solid line-grid

1.gif

2.gif
Have you tried Save-point.org? @DerVVulfman has a huge script listing there with topics for help and I've also pinged him here, it is a very old script so I wish you luck with that.
as far i know it from rpg mv ,every sprite has an "anchor" which is used to know the x y and z position..
i guess want you need is to figure out, how to fix the anchor of the weapon sprite on the position of the anchor of the char sprite..
(so that both anchors are always the same)
-> and of course to know in which scene that should happen, map or battle?
=> for battle you need the screen positions
=> for map you could aswell use map positions
.. also in rpg mv its possible to calculate with script, from map to screen position & the other way.. this should also be possible in xp somehow

edit
sry i cant give any script advice on rpg maker xp

edit2
in rpg mv i solved this by editing the char imgs directly and put the weapon on it..
but that requires a lot of editing if the event can use lot of different weapons
(in my case this was for usage on map so that events can carry and use weapons in map-scene)
Forget what dopan said, unless you truly want to edit all of your image files...

What happens is that the picture might not be getting the sprite's X and Y coordinates in real time. You don't need the real_x and real_y for it at all. The way to solve it is to readjust the coordinates every time you move in any direction or simply let Sprite_Character do it every time it gets updated (like always while on the map).

I don't have the time to look at the code right now and see how it can be improved. Yet, you can still wait for the other scripter's response and see if you both can work it out.
Thanks everyone for trying to help.
I knew the save point for the first time and it was very interesting to look around.
I think I can find some fun features later.
However, the scripts I found all day today unfortunately did not solve the problem.
There have been several versions, but all of them limit the size of the layered sprite to the size of the sprite below it.

For now, I'll keep looking for a solution.
Thanks everyone for trying to help.
I knew the save point for the first time and it was very interesting to look around.
I think I can find some fun features later.
However, the scripts I found all day today unfortunately did not solve the problem.
There have been several versions, but all of them limit the size of the layered sprite to the size of the sprite below it.

For now, I'll keep looking for a solution.
If they limit the size of the layered sprite to the size of the sprite below then possibly try what I've done and make both the layers the same sizes?
Here's an example of my sheets with a visual weapon:
Spoiler
Squire - Mercenary Female Base 1A[anim].png
1H Sword Level 1A.png
I wanted to make a sprite that follows a character like a visual equipment script without size restrictions, so I made the script below while studying and putting together several scripts for the past few days.
And the results were generally very satisfactory.

But one more problem arose.
If you adjust the z of the sprite created in this way, it will either go above everything on the screen, or below everything, and become invisible.
I honestly don't know what to do.
self.z I thought was the z value of the character's sprite.
It is not simply on top of the character sprite, but on top of the entire screen.
self.viewport.z also doesn't work
I also put it in viewport.z
I tried putting it in @_HEAD_sprite.z as well, but it doesn't work as I want.
What should I do?
.
current situation what i want
Sprite-0004.gif
Sprite-0003.gif



Spoiler
class Game_Character
attr_accessor :sprite_HEAD
end



class Sprite_Character < Sprite_Character
def create_HEAD_sprite(text)

$game_variables[195]="Graphics/Characters/197-Support05"

bitmap = Bitmap.new($game_variables[195])

viewport = Viewport.new(self.x,self.y,bitmap.width/4,bitmap.height/4)
viewport.z = self.z
@_HEAD_sprite = Sprite.new(viewport)
@_HEAD_sprite.bitmap = bitmap
@_HEAD_sprite.ox = 0
@_HEAD_sprite.oy = 0
@_HEAD_sprite.x = self.x - bitmap.width/8
@_HEAD_sprite.y = self.y - bitmap.height/8
@_HEAD_sprite.z = self.z
@_HEAD_sprite_visible = true

end



def dispose_HEAD_sprite
@_HEAD_sprite.dispose
@_HEAD_sprite_visible = false
end

def update_HEAD_sprite
if @character.sprite_HEAD != nil

if not @_HEAD_sprite_visible
create_HEAD_sprite(@character.sprite_HEAD)
end

@_HEAD_sprite.viewport.rect.set(
self.x-@_HEAD_sprite.bitmap.width/8,
self.y-@_HEAD_sprite.bitmap.height/4,
@_HEAD_sprite.bitmap.width/4,
@_HEAD_sprite.bitmap.height/4)
if @_HEAD_sprite.bitmap != $game_variables[195]
@_HEAD_sprite.bitmap = Bitmap.new($game_variables[195])
end


@_HEAD_sprite.x = self.character.pattern * -@_HEAD_sprite.bitmap.width/4
@_HEAD_sprite.y = (@character.direction - 2) / 2 * -@_HEAD_sprite.bitmap.height/4
@_HEAD_sprite.viewport.z = self.viewport.z
else
if @_HEAD_sprite_visible
dispose_HEAD_sprite
end
end
end

def update
super
update_HEAD_sprite
end
end

Original thread: https://forums.rpgmakerweb.com/threads/visual_equipment-with-different-sprite-sizes.154879/