Advertisement
Black_Mage

Picture Z Changer Script

Apr 18th, 2019 (edited)
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.21 KB | None | 0 0
  1. #==============================================================================
  2. # Don't remove this header!
  3. #==============================================================================
  4. # Picture Z Changer script By Black Mage (Credit required to use)
  5. # Current Version : 1.1
  6. # https://burningwizard.wordpress.com/2019/04/18/picture-z-changer-script/
  7. #
  8. # This script can change z value of choosen picture called via command event.
  9. #
  10. # This script is licensed under CC BY 3.0
  11. # https://creativecommons.org/licenses/by/3.0/
  12. #==============================================================================
  13.  
  14. #==============================================================================
  15. # Changelog
  16. #==============================================================================
  17. # Version 1.1
  18. #   - Rewrite some codes.
  19. #
  20. # Version 1.0
  21. #   - Initial version.
  22. #==============================================================================
  23.  
  24. #==============================================================================
  25. # How to use the script
  26. #==============================================================================
  27. # Put this script on your project.
  28. #
  29. # Use these command on script call from event command to change the z value of
  30. # a picture:
  31. #
  32. # change_picture_z(picture_id, value)
  33. #
  34. #==============================================================================
  35.  
  36. #------------------------------------------------------------------------------
  37. # * Beyond this is the sacred land of code. You need programming qualification
  38. #   to dwelve deeper, or it'll cause many unnecessary problems. Proceed on your
  39. #   own risk.
  40. #------------------------------------------------------------------------------
  41. class Game_Picture; attr_accessor :z_value; end
  42.  
  43. class Game_Interpreter
  44.   def change_picture_z(id, value)
  45.     if SceneManager.scene_is?(Scene_Battle)
  46.       a = $game_troop.screen.pictures
  47.     elsif SceneManager.scene_is?(Scene_Map)
  48.       a = $game_map.screen.pictures
  49.     end
  50.     return if a.nil?
  51.     a[id].z_value = value
  52.   end
  53. end
  54.  
  55. class Sprite_Picture < Sprite  
  56.   alias black_u_p update_position
  57.   def update_position
  58.     black_u_p; self.z = @picture.z_value if @picture.z_value != nil
  59.   end
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement