Moin Agura,
hab mal schnell zwei Dinge eingebaut:
1. Wenn der Charakter breiter als 32 Pixel ist, werden nun auch die benachbarten Felder geprüft
2. Wenn der Charakter über einer Grafik angezeigt wird (z.B. Zaun) und sich bewegt, bleibt er solange im Vordergrund, bis er das nächste Feld erreicht hat
Code:
#==============================================================================
#
# ▼ Moby's Script System - Correct Sprite Display V1.0
# -- Last Updated: 2013.01.26
#
# -- Update: LDT0319
# -- Date: 2019.03.30
# -- User: D.T. Linkey
# -- Change: If character is wider than 1 tile, check neighbour fields to
# the correct Z-Value
#
#==============================================================================
$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
#LDT0319 flag to check if character was in front of something before moving
@chinfr = false
#--------------------------------------------------------------------------
# * 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)
#========LDT0319 Start
#get character width
width = get_width(curr_sprite)
#if character is moving and was already in front, keep z = 300
if(curr_sprite.character.class.name == "Game_Player")
if(curr_sprite.character.moving? && @chinfr)
curr_sprite.z = 300
return
end
end
#========LDT0319 End
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
#========LDT0319 Start
#check if width is greater than one tile
if(width > 1)
# for each additional tile, check the field
for ti in 2..width
# check the field on the left first...
tx = curr_sprite.character.x - (ti - 1)
if(!$game_map.data[tx, y, 2].nil?)
flag = $game_map.tileset.flags[$game_map.data[tx, y, 2]]
if flag & 0x10 != 0 && # [☆]: No effect on passage
$game_map.data[tx, y, 2] != 0
curr_sprite.z = 300
break
else
curr_sprite.z = 100
end
end
# ... check the field on the right
tx = curr_sprite.character.x + (ti - 1)
if(!$game_map.data[tx, y, 2].nil?)
flag = $game_map.tileset.flags[$game_map.data[tx, y, 2]]
if flag & 0x10 != 0 && # [☆]: No effect on passage
$game_map.data[tx, y, 2] != 0
curr_sprite.z = 300
break
else
curr_sprite.z = 100
end
end
end
else
curr_sprite.z = 100
end
#========LDT0319 End
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
#========LDT0319 if character is in front, set chinfr to true
@chinfr = true if(curr_sprite.z == 300 && curr_sprite.character.class.name == "Game_Player")
@chinfr = false if(curr_sprite.z == 100 && curr_sprite.character.class.name == "Game_Player")
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
#========LDT Start
def get_width(curr_sprite)
width = 0
if curr_sprite.character.character_name.scan(/$/)
width = (curr_sprite.bitmap.width / 3) / 32
width += 1 if (curr_sprite.bitmap.width / 3) % 32 > 0
else
width = (curr_sprite.bitmap.width / 12) / 32
width += 1 if (curr_sprite.bitmap.width / 12) % 32 > 0
end
return width
end
#========LDT 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
Allerdings gibt es auch mit dieser Lösung ein Problem: Der Charakter steht entweder vor oder hinter den Grafiken. Wenn auf deinem Bild nun ein Turm über die Füße deines Charakters ragen würde, würden die Füße über dem Turm angezeigt werden.
Darauf musst du dann beim Mappen achten