Advertisement
OMGCrash

CrashSteps

Jul 2nd, 2014
923
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 15.63 KB | None | 0 0
  1. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
  2. #                                                                              #
  3. #      ########    ######          ######        ########    ##      ##        #
  4. #    ##            ##    ##      ##      ##    ##            ##      ##        #
  5. #    ##            ######        ##########      ######      ##########        #
  6. #    ##            ##  ##        ##      ##            ##    ##      ##        #
  7. #      ########    ##    ##      ##      ##    ########      ##      ##        #
  8. #                                                                      V 1.2.0 #
  9. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
  10. # SCRIPT NAME: CrashSteps                                                      #
  11. #                                                               made by Crash  #
  12. # Date Created: 16/June/2014            Last Update date: 20/June/2014         #
  13. #                                                                              #
  14. #==============================================================================#
  15. #  REQUIREMENTS                                                                #
  16. #------------------------------------------------------------------------------#
  17. #     none                                                                     #
  18. #==============================================================================#
  19. #  KNOWN COMPATIBILITY ISSUES                                                  #
  20. #------------------------------------------------------------------------------#
  21. #     No known compatability issues                                            #
  22. #             alias list..:                                                    #
  23. #                 Game_Player :: initialize                                    #
  24. #                             :: update                                        #
  25. #                             :: passable                                      #
  26. #==============================================================================#
  27. #  INTRODUCTION                                                                #
  28. #------------------------------------------------------------------------------#
  29. #     This Script gives you the choice to:                                     #
  30. #    -  plays a collision sound when your character collides with something    #
  31. #    -  plays a sound when you are walking                                     #
  32. #                                                                              #
  33. #==============================================================================#
  34. #  INSTRUCTIONS                                                                #
  35. #------------------------------------------------------------------------------#
  36. #     Edit the config section to determine which sound effect to play,         #
  37. #       how loud to play it, the pitch, and the duration of time between       #
  38. #       repetitions of the sound effect.                                       #
  39. #                                                                              #
  40. #     Please note, sound effects MUST be in the resource folder                #
  41. #                                                                              #
  42. #     More is explained in the config section itself. For help and support     #
  43. #       see line 291                                                           #
  44. #                                                                              #
  45. #==============================================================================#
  46. #  COMMANDS                                                                    #
  47. #------------------------------------------------------------------------------#
  48. #     In game you can use the following commands to control crashsteps         #
  49. #         Crashsteps.on                = turns footsteps & collisions on       #
  50. #         Crashsteps.off               = turns footsteps & collisions off      #
  51. #         Crashsteps.toggle            = toggles footsteps & collisions on/off #
  52. #         Crashsteps_Footsteps.on      = turns footsteps ON                    #
  53. #         Crashsteps_Footsteps.off     = turns footsteps OFF                   #
  54. #         Crashsteps_Footsteps.toggle  = toggles footsteps on/off              #
  55. #         Crashsteps_Collision.on      = turns collisions sounds ON            #
  56. #         Crashsteps_Collision.off     = turns collision sounds OFF            #
  57. #         Crashsteps_Collision.toggle  = toggles collision sounds on/off       #
  58. #                                                                              #
  59. #==============================================================================#
  60. #  UPDATE LOG                                                                  #
  61. #------------------------------------------------------------------------------#
  62. # Update |    date    | Description of update                                  #    
  63. #  1.0.1 |18/Jun/2014 | added print on initialization for debugging purposes   #
  64. #  1.1.0 |19/Jun/2014 | added ability to turn and toggle script on/off in-game #
  65. #                          using script commands.                              #
  66. #  1.2.0 |20/Jun/2014 | added changeable steps on terrain.                     #
  67. #                                                                              #
  68. #                                                                              #
  69. # #  #   #    #     #      #       #        #       #      #     #    #   #  # #
  70.  # ## # # #  # #   # #    # #     # #      # #     # #    # #   # #  # # # ## #
  71.    #   #   ##   # #   #  #   #   #   #    #   #   #   #  #   # #   ##   #   #
  72.            #     #     ##     # #     #  #     # #     ##     #     #
  73.                        #       #       ##       #       #
  74.  
  75.                      
  76. #***reminder:: Please only edit config section.
  77.  
  78. class Game_Player < Game_Character
  79.  
  80. #==============================================================================
  81. #  CONFIG
  82. #------------------------------------------------------------------------------
  83. # Please edit these to suite your needs.
  84. #==============================================================================
  85.  
  86. #                          SCRIPT BEHAVIOUR
  87.  
  88. Crashsteps_uses_region_id = true # should the script change sound effects
  89.                                  #      based on what region you are walking in?
  90.                                  
  91. Play_Footsteps_SE = true         # should script play footsteps sound effect?  (can be changed in game)                              
  92. Footsteps_Wait = 15              # number of frames to wait before repeating se
  93. Play_Collision_SE = true         # should script play Collisions sound effect? (can be changed in game)
  94. Collision_Wait = 15              # number of frames to wait before repeating se
  95. Collision_SE = ["collision", 30, 100 ]
  96.              # [ name       ,vol,pitch] of sound effect for collisions
  97.              
  98.              
  99. #                WHEN CRASHSTEPS IS NOT USING REGION_ID
  100.  
  101. Footsteps_SE = ["foostep" , 50, 100 ]
  102.              # [ name       ,vol,pitch] of sound effect for footsteps
  103.              
  104.  
  105. #                  WHEN CRASHSTEPS IS USING REGION_ID
  106.  
  107. Footsteps_Region_SE = [  #<< ignore this.. edit below.
  108.  
  109. # name        ,vol ,pitch] of sound effect for region::
  110. [ "dirt_steps"     , 70 , 100 ],                            #default (no region)
  111. [ "ice_steps"      , 100, 100 ],                            # 1
  112. [ "grass_steps"    , 100, 100 ],                            # 2
  113. [ "stone_steps"    , 100, 100 ],                            # 3
  114. [ "wood_steps"     , 100, 100 ],                            # 4
  115.  
  116. #to add more just copy and paste the following line changing footstep se name
  117. #and deleting the # at the start..:
  118. #["footstep se name", 50 , 100 ],                           # next region id.
  119. #region IDs are numeric in ascending order (meaning the first entry will ALWAYS
  120. #be the default, the second entry will ALWAYS be region 1, the third will ALWAYS
  121. #be region 2, etc. this CANNOT change.
  122.  
  123. #==============================================================================
  124. #  Script
  125. #------------------------------------------------------------------------------
  126. # Do not edit anything below this comment.
  127. #==============================================================================
  128. [ nil ]]
  129.   #----------------------------------------------------------------------------
  130.   #  Initialize
  131.   #----------------------------------------------------------------------------
  132.    alias Crash_Crashsteps_gameplayer_initialize_crash                 initialize
  133.   def initialize
  134.     Crash_Crashsteps_gameplayer_initialize_crash()
  135.  $crashsteps_footsteps  = Play_Footsteps_SE #changing to soft variable
  136.  $crashsteps_collisions = Play_Collision_SE #changing to soft variable
  137.   end
  138.   #----------------------------------------------------------------------------
  139.   #  Frame Update
  140.   #----------------------------------------------------------------------------
  141.   alias Crash_Collsound_gameplayer_update_crash                       update
  142.   def update
  143.     Crash_Collsound_gameplayer_update_crash()
  144.     @cstimer = 0 unless @cstimer != nil
  145.     @fstimer = 0 unless @fstimer != nil
  146.     @cstimer -= 1 unless @cstimer == 0
  147.     @fstimer -= 1 unless @fstimer == 0
  148.   end
  149.  
  150.   #----------------------------------------------------------------------------
  151.   # checks for passability and runs modules
  152.   #----------------------------------------------------------------------------
  153.   alias Crash_Collsound_gameplayer_passable_crash                    passable?
  154.   def passable?( *args )
  155.     passable = Crash_Collsound_gameplayer_passable_crash( *args )
  156. #--------------------------------FOOTSTEPS--------------------------------------
  157.     unless $crashsteps_footsteps == false
  158.     if passable == true && @fstimer == 0
  159.       if Crashsteps_uses_region_id == true
  160.         unless Footsteps_Region_SE[$game_map.region_id(x, y)][0] == nil
  161.       RPG::SE.new(*Footsteps_Region_SE[$game_map.region_id(x, y)]).play rescue print "invalid footsteps file name.
  162. "
  163.       @fstimer = Footsteps_Wait
  164.     end
  165.     else
  166.       RPG::SE.new(*Footsteps_SE).play rescue print "invalid footsteps file name
  167. "
  168.     end
  169.   end
  170. end
  171. #-------------------------------COLLISIONS--------------------------------------
  172.     unless $crashsteps_collisions == false
  173.     if passable == false && @cstimer == 0
  174.       RPG::SE.new(*Collision_SE).play rescue print "invalid Collision file name
  175. "
  176.       @cstimer = Collision_Wait
  177.     end
  178.     end
  179.     return passable
  180.   end
  181. end
  182. #--------------------------------debug------------------------------------------
  183.  print "Crashsteps Script Initialized...
  184. "
  185. #------------------------------------------------------------------------------#
  186. #=====================IN GAME SCRIPT CALL COMMANDS=============================#
  187. #------------------------------------------------------------------------------#
  188. #====================================#
  189. #==Crashsteps General================#
  190. #====================================#
  191. module Crashsteps                    #
  192.   def self.off                       #
  193.     $crashsteps_footsteps  = false   #
  194.     $crashsteps_collisions = false   #
  195.     print "collisions and foosteps turned off...
  196. "                                    #
  197.   end                                #
  198. #------------------------------------#
  199.   def self.on                        #
  200.     $crashsteps_footsteps  = true    #
  201.     $crashsteps_collisions = true    #
  202.     print "collisions and footsteps turned on...
  203. "                                    #
  204. end                                  #
  205. #------------------------------------#
  206.   def self.toggle                    #
  207.     if $crashsteps_footsteps = true  #
  208.       $crashsteps_footsteps = false  #
  209.     else                             #
  210.       $crashsteps_footsteps = true   #
  211.     end                              #
  212.     if $crashsteps_collisions = true #
  213.       $crashsteps_collisions = false #
  214.     else                             #
  215.       $crashsteps_collisions = true  #
  216.     end                              #
  217.   end                                #
  218. end                                  #
  219. #====================================#
  220. #==FOOTSTEPS=========================#
  221. #====================================#
  222. module Crashsteps_footsteps          #
  223.   def self.off                       #
  224.     $crashsteps_footsteps = false    #
  225.     print "footsteps turned off...      
  226. "                                   #
  227.   end                                #
  228. #------------------------------------#
  229.   def self.on                        #
  230.     $crashsteps_footsteps = true     #
  231.     print "footsteps turned on...
  232. "                                    #
  233.     end                              #
  234. #------------------------------------#
  235.   def self.toggle                    #
  236.     if $crashsteps_footsteps = true  #
  237.       $crashsteps_footsteps = false  #
  238.       print "footsteps toggled off...  
  239. "                                    #
  240.     else                             #
  241.       $crashsteps_footsteps = true   #
  242.       print "footsteps toggled on...    
  243. "                                    #
  244.     end                              #
  245.   end                                #
  246. end                                  #
  247. #====================================#
  248. #==COLLISIONS========================#
  249. #====================================#
  250. module Crashsteps_collisions         #
  251.   def self.off                       #
  252.     $crashsteps_collisions = false   #
  253.     print "collisions turned off...  
  254. "                                    #
  255.   end                                #
  256. #------------------------------------#
  257.   def self.on                        #
  258.     $crashsteps_collisions = true    #
  259.     print "collisions turned on...  
  260. "                                    #
  261. end                                  #
  262. #------------------------------------#
  263.   def self.toggle                    #
  264.     if $crashsteps_collisions =true  #
  265.       $crashsteps_collisions = false #
  266.       print "collisions toggled off...
  267. "                                    #
  268.     else                             #
  269.       $crashsteps_collisions = true  #
  270.       print "collisions toggled on...
  271. "                                    #
  272.     end                              #
  273.   end                                #
  274. end                                  #
  275. #====================================#
  276. #===============================================================================
  277. #  END OF SCRIPT
  278. #===============================================================================
  279. #  Potential List of future updates
  280. # v 1.1.0 = Add ability to turn footsteps on or off via script call. **DONE**
  281. # v 1.1.1 = Bug Fixes (if any)
  282. # v 1.2.0 = Terrain Tagging  **DONE**
  283. # v 1.2.1 = Bug Fixes (if any)
  284. #===============================================================================
  285. # If you were charged for this script you were scammed. Please contact me
  286. #   immmediately.
  287. #===============================================================================
  288. # For help and support comment on the forum you found this script, OR,
  289. #   email me using my email.
  290. #===============================================================================
  291. # My email: crashes2ashes@gmail.com   ::use it wisely.
  292. #===============================================================================
  293. #  LARGELY influenced by DiamondandPlatinum 3's script/tutorial
  294. #     If you're interested in scripting, please be sure to check out his channel
  295. #     at https://www.youtube.com/channel/UCz_JkwtwpQaKAiJiIRakDLw
  296. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement