SHARE
TWEET

MSS Correct Sprite Display

mobychan Jun 26th, 2012 1,423 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #==============================================================================
  2. #
  3. # ▼ Moby's Script System - Correct Sprite Display V1.0
  4. # -- Last Updated: 2012.06.26
  5. #
  6. #==============================================================================
  7.  
  8. $imported = {} if $imported.nil?
  9. $imported["MSS-Correct_Sprite_Display"] = 1.0
  10.  
  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # N/A
  15. #
  16. #==============================================================================
  17. # ▼ Introduction
  18. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  19. # This script corrects how sprites will be displayed, to prevent errors
  20. # happening when the sprite is higher than 32px and the tile above it is set
  21. # to star passability.
  22. #
  23. #==============================================================================
  24. # ▼ Instructions
  25. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  26. # To install this script, open up your script editor and copy/paste this script
  27. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  28. #
  29. #
  30. # If you have any questions, bugs you want to report or anything else,
  31. # please contact me at mobychan@gmx.de or via my profile on
  32. # http://forums.rpgmakerweb.com (mobychan).
  33. #
  34. #
  35. # This script is Plug and Play.
  36. # It automatically checks if the Sprite is bigger then 32px and adjust the
  37. # tiles around that sprite accordingly.
  38. # If you're using Anaryu's Particle Engine (ported by Yami)
  39. # there won't be any issues.
  40. #
  41. #==============================================================================
  42. # ▼ Compatibility
  43. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  44. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  45. # it will run with RPG Maker VX without adjusting.
  46. #
  47. #==============================================================================
  48. #
  49. #==============================================================================
  50. # ▼ Compatibility Issues
  51. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  52. # N/A
  53. #
  54. #==============================================================================
  55.  
  56.  
  57.  
  58. #==============================================================================
  59. # ** Spriteset_Map
  60. #------------------------------------------------------------------------------
  61. #  This class brings together map screen sprites, tilemaps, etc. It's used
  62. # within the Scene_Map class.
  63. #==============================================================================
  64.  
  65. class Spriteset_Map
  66.   #--------------------------------------------------------------------------
  67.   # * Update Character Sprite
  68.   #--------------------------------------------------------------------------
  69.   alias msscsd_update_characters update_characters unless $@
  70.   def update_characters
  71.     msscsd_update_characters
  72.    
  73.     @character_sprites.each do |curr_sprite|
  74.       if curr_sprite.character.class.name == "Game_Event" ||
  75.           curr_sprite.character.class.name == "Game_Player" ||
  76.           curr_sprite.character.class.name == "Game_Follower"
  77.         height = get_height(curr_sprite)
  78.        
  79.         if height > 1
  80.           x = curr_sprite.character.x
  81.           curr_sprite.viewport = @viewport1
  82.          
  83.           id = $game_map.data[x, curr_sprite.character.y, 2]
  84.           flag_pos = $game_map.tileset.flags[id]
  85.          
  86.           if (!(flag_pos & 0x10 != 0) || id == 0)
  87.             for i in 2..height
  88.               y = curr_sprite.character.y - (i - 1)
  89.              
  90.               if !$game_map.data[x, y, 2].nil?
  91.                 flag = $game_map.tileset.flags[$game_map.data[x, y, 2]]
  92.                
  93.                 if flag & 0x10 != 0 && # [☆]: No effect on passage
  94.                     $game_map.data[x, y, 2] != 0
  95.                   curr_sprite.viewport = @viewport2
  96.                   break
  97.                 else
  98.                   curr_sprite.viewport = @viewport1
  99.                 end
  100.               end
  101.             end
  102.           end
  103.         end
  104.       end
  105.     end
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # * Gets the given Sprites height
  109.   #--------------------------------------------------------------------------
  110.   def get_height(curr_sprite)
  111.     height = 0
  112.    
  113.     if curr_sprite.character.character_name.scan(/$/)
  114.       height = (curr_sprite.bitmap.height / 4) / 32
  115.       height += 1 if (curr_sprite.bitmap.height / 4) % 32 > 0
  116.     else
  117.       height = (curr_sprite.bitmap.height / 8) / 32
  118.       height += 1 if (curr_sprite.bitmap.height / 8) % 32 > 0
  119.     end
  120.     return height
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # * Add Particle
  124.   #--------------------------------------------------------------------------
  125.   def add_particle(target, name, blend, setting, offset, v = nil, a = nil)
  126.         particle = Particle.new(@viewport2, target, name, blend, setting, offset, v, a)
  127.         @particles.push(particle)
  128.   end
  129. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top