I am using a Visual Equipment script, with Netplay+. I am not requesting a new system from scratch, rather an add-on to the system.
I've tried to make this myself, and failed. I can't work out how to do this, from reading through the scripts. I thought someone else might be able to help, as it seems a really easy thing to do if you know how to do it.
What I've got:
Network Script - sends and recieves data
These methods, I editted logically. I figured they send and recieve data, through variables. So I editted them adding variables for player armour and weapons.
So, the variables are now sent and recieved through the system.
Netcharacter Script
Somehow, these variables are used by the Netcharacter script, to show the graphics of the other players.
Right. So, we have a script that sends and recieves data, and a script that uses this data to draw a character graphic. So we have the methods we need to do this, but how to apply this to a Visual Equipment script...
The VE script I have is by Rataime, and is here:
Permission for commercial use has been applied for, through presumably it is the same methods for any other Visual Equipment script.
This script works in my game, which is why I chose it specifically.
So, anyone feel like helping me with this?
Details
I have no money at the moment, so I cannot offer anything like that. I will give due credit, and lots of thanks.
This is a commercial and online game (obviously).
If there is anything vital I am missing from here please let me know. Thanks!
~Wyatt
I've tried to make this myself, and failed. I can't work out how to do this, from reading through the scripts. I thought someone else might be able to help, as it seems a really easy thing to do if you know how to do it.
What I've got:
Network Script - sends and recieves data
These methods, I editted logically. I figured they send and recieve data, through variables. So I editted them adding variables for player armour and weapons.
Code:
#--------------------------------------------------------------------------
# * Send Requested Data
#--------------------------------------------------------------------------
def self.send_start_request(id)
send = ""
# Send Username And character's Graphic Name
send += "@username = '#{self.name}'; @character_name = '#{$game_player.character_name}'; "
# Sends Map ID, X and Y positions
send += "@map_id = #{$game_map.map_id}; @x = #{$game_player.x}; @y = #{$game_player.y}; "
# Sends Name
send += "@name = '#{$game_party.actors[0].name}'; " if User_Edit::Bandwith >= 1
# Sends Direction
send += "@direction = #{$game_player.direction}; " if User_Edit::Bandwith >= 2
# Sends Move Speed
send += "@move_speed = #{$game_player.move_speed};" if User_Edit::Bandwith >= 3
#@socket.send("<6a>#{id.to_i}</6a>\n")
#====================================
# * GVE addition
#
# By Wyatt
#
send += "@weapon='#{$game_party.actors[0].weapon_id}';@armour1='#{$game_party.actors[0].armor1_id}';@armour2='#{$game_party.actors[0].armor2_id}';@armour3='#{$game_party.actors[0].armor3_id}';@armour4='#{$game_party.actors[0].armor4_id}';"
#
#====================================
@socket.send("<5>#{send}</5>\n")
#self.send_map
#self.send_actor_start
end
Code:
def self.send_start_request(id)
send = ""
# Send Username And character's Graphic Name
send += "@username = '#{self.name}'; @character_name = '#{$game_player.character_name}'; "
# Sends Map ID, X and Y positions
send += "@map_id = #{$game_map.map_id}; @x = #{$game_player.x}; @y = #{$game_player.y}; "
# Sends Name
send += "@name = '#{$game_party.actors[0].name}'; " if User_Edit::Bandwith >= 1
# Sends Direction
send += "@direction = #{$game_player.direction}; " if User_Edit::Bandwith >= 2
# Sends Move Speed
send += "@move_speed = #{$game_player.move_speed};" if User_Edit::Bandwith >= 3
#@socket.send("<6a>#{id.to_i}</6a>\n")
#====================================
# * GVE addition
#
# By Wyatt
#
send += "@weapon='#{$game_party.actors[0].weapon_id}';@armour1='#{$game_party.actors[0].armor1_id}';@armour2='#{$game_party.actors[0].armor2_id}';@armour3='#{$game_party.actors[0].armor3_id}';@armour4='#{$game_party.actors[0].armor4_id}';"
#
#====================================
@socket.send("<5>#{send}</5>\n")
#self.send_map
#self.send_actor_start
end
So, the variables are now sent and recieved through the system.
Netcharacter Script
Somehow, these variables are used by the Netcharacter script, to show the graphics of the other players.
Code:
#==============================================================================
# ** Sprite_Character - This sprite is used to display the character. It
# observes the Game_Character class and automatically
# changes sprite conditions.
#------------------------------------------------------------------------------
# Author Meâ„¢ and Shark_Tooth
# Idea Destined
#==============================================================================
class Sprite_NetCharacter < RPG::Sprite
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :character # character
attr_accessor :netid
#--------------------------------------------------------------------------
# * Object Initialization
# viewport : viewport
# character : character (Game_Character)
#--------------------------------------------------------------------------
def initialize(viewport, id, character = nil)
super(viewport)
@character = character
@netid = id
# Creates Display Bitmap
bitmap = Bitmap.new(160, 24)
# Draws Text Shadow
bitmap.font.draw_shadow = false if bitmap.font.respond_to?(:draw_shadow)
bitmap.font.color = Color.new(0, 0, 0)
bitmap.draw_text(1, 1, 160, 24, @character.username, 1)
bitmap.font.color = Color.new(0, 0, 0)
bitmap.draw_text(1, 1, 160, 24, @character.username, 1)
# Changes Font Color
bitmap.font.color = Color.new(255, 255, 255)
# Draws Text
bitmap.draw_text(0, 0, 160, 24, @character.username, 1)
# Creates Display Text Sprite
@_text_display = Sprite.new(self.viewport)
@_text_display.bitmap = bitmap
@_text_display.ox = 80
@_text_display.oy = 24
@_text_display.x = self.x
@_text_display.y = self.y - self.oy / 2 - 24
@_text_display.z = 30000
@_text_display.visible = self.visible #true
self.opacity = 0
update
end
#--------------------------------------------------------------------------
# * Disposes Text
#--------------------------------------------------------------------------
def dispose
@_text_display.dispose
super
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# If tile ID, file name, or hue are different from current ones
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
#Updates tile info
update_tile
end
# Set visible situation
self.visible = (not @character.transparent)
# If graphic is character
animate_player if @tile_id == 0
# Set sprite coordinates
self.x = @character.screen_x
self.y = @character.screen_y
self.z = @character.screen_z(@ch)
# Set opacity level, blend method, and bush depth
self.opacity = @character.opacity
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
# Animation
update_ani if @character.animation_id != 0
# Name Sprite
@_text_display.x = self.x
@_text_display.y = self.y - self.oy / 2 - 24
end
#--------------------------------------------------------------------------
# * Update Tile
#--------------------------------------------------------------------------
def update_tile
# Remember tile ID, file name, and hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
# If tile ID value is valid
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
# If tile ID value is invalid
else
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
end
end
#--------------------------------------------------------------------------
# * Update Player movement
#--------------------------------------------------------------------------
def animate_player
# Set rectangular transfer
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
#--------------------------------------------------------------------------
# * Update Animation
#--------------------------------------------------------------------------
def update_ani
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
end
Right. So, we have a script that sends and recieves data, and a script that uses this data to draw a character graphic. So we have the methods we need to do this, but how to apply this to a Visual Equipment script...
The VE script I have is by Rataime, and is here:
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.
# WEAPON LISTINGS
add_weapon_sprite(1, "001-Fighter01") # <-didn't make a weapon image :P
# ARMOR LISTINGS
add_armor_sprite( 6, "tpl_helmet_1")
add_armor_sprite( 7, "tpl_helmet_2")
add_armor_sprite(20, "tpl_armor_white")
add_armor_sprite(15, "tpl_armor_blue")
add_armor_sprite(21, "tpl_armor_cape")
#========================================================================
# **** 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::B)
# 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
Permission for commercial use has been applied for, through presumably it is the same methods for any other Visual Equipment script.
This script works in my game, which is why I chose it specifically.
So, anyone feel like helping me with this?
Details
I have no money at the moment, so I cannot offer anything like that. I will give due credit, and lots of thanks.
This is a commercial and online game (obviously).
If there is anything vital I am missing from here please let me know. Thanks!
~Wyatt