Advertisement
CompanionWulf

Change Parallax Scriptlet - RGSS2/RMVX

Jan 17th, 2015
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.04 KB | None | 0 0
  1. #==============================================================================
  2. # ** Change Parallax Scriptlet
  3. #   Version      : 2.6
  4. #   Platforms    : RMVX
  5. #   Author       : Companion Wulf
  6. #   Release Date : 10 September 2012
  7. #   Last Update  : 22 May 2014
  8. #   Websites
  9. #     * RPG Maker Times           - http://rpgmakertimes.blogspot.com
  10. #     * RMT Companion Blog        - http://blog.rpgmakertimes.info
  11. #     * RPG Maker Times Facebook  - http://facebook.com/RPGMakerTimes
  12. #
  13. #------------------------------------------------------------------------------
  14. # This simple scriptlet enables you to change the parallax on the map using a
  15. # Script Command call. Parallaxes can be called directly or randomized. Looping
  16. # and scroll speed are predetermined via the Map Properties.
  17. #
  18. #------------------------------------------------------------------------------
  19. # INSTALLATION
  20. #   Place the scriptlet between Materials and Main.
  21. #
  22. #------------------------------------------------------------------------------
  23. # INSTRUCTIONS
  24. #   Place (import) all parallax graphics in the Graphics/Parallaxes folder.
  25. #
  26. #   If the randomized parallax (RANDOM_PARALLAX) is "true", the parallaxes will
  27. #   be chosen randomly from the list (PARALLAX_NAMES). If RANDOM_PARALLAX is
  28. #   "false", the default parallax (PARALLAX_DEFAULT) will be used instead,
  29. #   corresponding to its position in the array.
  30. #
  31. #   To call the script, put #   the following in a script command event:
  32. #
  33. #       $game_map.change_parallax
  34. #
  35. #   To change the parallax to a specific one in the list, place the corresponding
  36. #   number (starting with 0) in brackets after the event command:
  37. #
  38. #       $game_map.change_parallax(2)
  39. #
  40. #   will show the "Mountains" (or whatever is third in the array) parallax from
  41. #   PARALLAX_NAMES.
  42. #
  43. #------------------------------------------------------------------------------
  44. # FUTURE UPDATES
  45. #   * XY scroll coordinates
  46. #   * Terrain specific parallaxes
  47. #
  48. #------------------------------------------------------------------------------
  49. # VERSION HISTORY
  50. #   v2.6 (22-May-2014)
  51. #     * Tweak: Set default parallax if random parallaxes turned off
  52. #   v2.5 (19-Oct-2013)
  53. #     * Tweak: Cleaned/compressed code
  54. #   v2.0 (10-Oct-2013)
  55. #     * Tweak: Condensed parallax names into a single array
  56. #   v1.5 (25-Oct-2012)
  57. #     * Add: Randomized parallaxes
  58. #   v1.0 (19-Oct-2012)
  59. #     * Began scriptlet
  60. #
  61. #==============================================================================
  62.  
  63. $imported = {} if $imported == nil; $imported["CW-ChgPlx"] = true
  64.  
  65. module CW_CHGPLX
  66.   RANDOM_PARALLAX = false # Toggle random parallax on/off
  67.   PARALLAX_NAMES = [
  68.     # Parallax filenames (Graphics/Parallaxes)
  69.     "BlueSky", "CloudySky", "Mountains",
  70.     "Ocean", "StarlitSky", "Sunset"
  71.   ]
  72.   PARALLAX_DEFAULT = 0    # Set default parallax if random parallax is off
  73. end
  74.  
  75. #==============================================================================
  76. # ** Game_Map
  77. #==============================================================================
  78. class Game_Map
  79.   include CW_CHGPLX
  80.   #----------------------------------------------------------------------------
  81.   # * Parallax Presetup - Change Parallax
  82.   #----------------------------------------------------------------------------
  83.   def change_parallax(parallax = -1)
  84.     parallax = PARALLAX_DEFAULT if RANDOM_PARALLAX == false
  85.     parallax = rand(PARALLAX_NAMES.size) if RANDOM_PARALLAX && parallax == -1
  86.     @parallax_name = PARALLAX_NAMES[parallax]
  87.   end
  88. end
  89.  
  90. #==============================================================================
  91. # COPYRIGHT NOTICE
  92. #==============================================================================
  93. # This script is copyrighted to Companion Wulf under the provisions of the
  94. # Digital Millennium Copyright Act (DMCA).
  95. #
  96. # However, permission is granted to use the script in non-commercial projects
  97. # only, provided that credit (to Companion Wulf) is given somewhere in the game.
  98. # Beginning or end credits are fine (or even in the game itself!).
  99. #
  100. # The script cannot be distributed without my express written permission. It is
  101. # only allowed for distribution (at present) on the following websites:
  102. #
  103. #   RPG Maker Times               - http://rpgmakertimes.blogspot.com
  104. #   RPG Maker Times Companion   - http://blog.rpgmakertimes.info
  105. #  
  106. #  If you would like to share the script on a website or other forum, write to me
  107. #  for permission via RPG Maker Times Companion and the likelihood is I'll grant
  108. #  it and add to the list of approved distribution sites.
  109. #  
  110. #  Not understanding the above conditions, or not understanding English, will not
  111. #  exempt you in any way, shape or form.
  112. #  
  113. #  *For use in commercial projects*, I ask that a nominal fee of $3 for non-
  114. #  exclusive rights be paid. This will then go towards domain costs and
  115. #  additional scripts.
  116. #  
  117. #  Please do NOT use that email address for anything other than asking permission
  118. #  or, of course, letting me know about your project. ~Wulf
  119. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement