Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Correct Character Sprite Display
#1
Correct Character Sprite Display

Version: 1.1



Introduction

VXAce thinks you only want to use baby-chibi sprites, and does not properly handle cases when character sprites are taller than a tile.


Script

Code:
#==============================================================================
#
# ▼ Moby's Script System - Correct Sprite Display V1.0
# -- Last Updated: 2013.01.26
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["MSS-Correct_Sprite_Display"] = 1.0

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# (by brushfe) Tall events interact better with other tall events
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script corrects how sprites will be displayed, to prevent errors
# happening when the sprite is higher than 32px and the tile above it is set
# to star passability.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
#
# If you have any questions, bugs you want to report or anything else,
# please contact me at mobychan@gmx.de or via my profile on
# http://forums.rpgmakerweb.com (mobychan).
#
#
# This script is Plug and Play.
# It automatically checks if the Sprite is bigger then 32px and adjust the
# tiles around that sprite accordingly.
# If you're using Anaryu's Particle Engine (ported by Yami)
# there won't be any issues.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================
#
#==============================================================================
# ▼ Known Issues
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Really wide character sprites still are sometimes drawn behind tiles they
# should be in front of.
#==============================================================================



#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
# This class brings together map screen sprites, tilemaps, etc. It's used
# within the Scene_Map class.
#==============================================================================

class Spriteset_Map
#--------------------------------------------------------------------------
# * Update Character Sprite
#--------------------------------------------------------------------------
alias msscsd_update_characters update_characters unless $@
def update_characters
msscsd_update_characters

@character_sprites.each do |curr_sprite|
if curr_sprite.character.class.name == "Game_Event" ||
curr_sprite.character.class.name == "Game_Player" ||
curr_sprite.character.class.name == "Game_Follower"
height = get_height(curr_sprite)

if height > 1
x = curr_sprite.character.x
curr_sprite.z = 100

id = $game_map.data[x, curr_sprite.character.y, 2]
flag_pos = $game_map.tileset.flags[id]

if (!(flag_pos & 0x10 != 0) || id == 0)
for i in 2..height
y = curr_sprite.character.y - (i - 1)

if !$game_map.data[x, y, 2].nil?
flag = $game_map.tileset.flags[$game_map.data[x, y, 2]]

if flag & 0x10 != 0 && # [☆]: No effect on passage
$game_map.data[x, y, 2] != 0
curr_sprite.z = 300
break
else
curr_sprite.z = 100
end
loc = [curr_sprite.character.x, curr_sprite.character.y - 1]
$game_map.events_xy(*loc).each do |event|
if curr_sprite.character.class.name == "Game_Player" ||
curr_sprite.character.class.name == "Game_Follower" ||
curr_sprite.character.class.name == "Game_Event"
curr_sprite.z = 300
break
end
end
end
end
end
end
end
end
end
#--------------------------------------------------------------------------
# * Gets the given Sprites height
#--------------------------------------------------------------------------
def get_height(curr_sprite)
height = 0

if curr_sprite.character.character_name.scan(/$/)
height = (curr_sprite.bitmap.height / 4) / 32
height += 1 if (curr_sprite.bitmap.height / 4) % 32 > 0
else
height = (curr_sprite.bitmap.height / 8) / 32
height += 1 if (curr_sprite.bitmap.height / 8) % 32 > 0
end
return height
end
#--------------------------------------------------------------------------
# * Add Particle
#--------------------------------------------------------------------------
def add_particle(target, name, blend, setting, offset, v = nil, a = nil)
particle = Particle.new(@viewport2, target, name, blend, setting, offset, v, a)
@particles.push(particle)
end
end


Instructions

Paste in Materials section. Weep at how 138 lines of code were needed to fix something Enterbrain could have done in 1.


Credits and Thanks

Script is by Moby, with changes made by brushfe to make character sprites overlap with other character sprites correctly


Author's Notes

Overly wide character sprites still have issues. If I ever try to make something with VXAce I'll see what I can do about fixing it.
TODO:
  • Check left and right of over-wide characters, and adjust those tiles/characters too.
  • Use multiple Z levels (not just 100 and 300) to make tall characters stack more correctly.

Terms and Conditions

Not my script, found on pastebin and http://www.rpgmakervxace.net using google. I just mixed the two edits together. Don't credit me credit these nice smart people instead,
Reply }


Messages In This Thread
Correct Character Sprite Display - by MechanicalPen - 02-04-2014, 03:50 AM
RE: Correct Character Sprite Display - by Taylor - 02-05-2014, 05:53 AM
RE: Correct Character Sprite Display - by Taylor - 02-05-2014, 10:17 PM
RE: Correct Character Sprite Display - by Taylor - 02-10-2014, 09:11 AM
RE: Correct Character Sprite Display - by Taylor - 02-10-2014, 11:20 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Character's Dash Animation kyonides 0 148 04-08-2024, 03:50 AM
Last Post: kyonides
   Aleworks Input Mouse Sprite Add-On DerVVulfman 2 866 09-21-2023, 02:56 PM
Last Post: DerVVulfman
   Set Map's Display Name ACE kyonides 0 746 12-16-2022, 09:44 PM
Last Post: kyonides
   Character Select Script Selwyn 3 9,567 03-07-2017, 04:14 AM
Last Post: JayRay
   ProjectMeLT XRXS - 5-6 Character Menu JackMonty 0 5,126 04-16-2013, 02:41 PM
Last Post: JackMonty
   Victor Engine - Character Control Victor Sant 0 4,680 01-04-2012, 09:54 AM
Last Post: Victor Sant
   Victor Engine - Character Effects Victor Sant 0 4,232 01-01-2012, 02:08 PM
Last Post: Victor Sant
   Main Character Select Screen Raziel 4 10,734 05-27-2010, 04:48 PM
Last Post: sakhawat21
   Change Name / Graphic or Zoom Character Graphic XP VX kyonides 4 7,691 03-04-2010, 11:23 AM
Last Post: Villain
   Battler Sprite Addons Kain Nobel 0 4,895 09-17-2009, 12:42 PM
Last Post: Kain Nobel



Users browsing this thread: