Advertisement
Dekita

$D13x WSAD Move v1.1

Apr 8th, 2013
1,954
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.87 KB | None | 0 0
  1. if true # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - WSAD Movement
  5. # -- Author : Dekita
  6. # -- Version : 1.1
  7. # -- Level : Easy
  8. # -- Requires : N/A
  9. # -- Engine : RPG Maker VX Ace.
  10. #
  11. #===============================================================================
  12. # ☆ Import
  13. #-------------------------------------------------------------------------------
  14. $D13x={}if$D13x==nil
  15. $D13x[:WSAD_Move]=true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # o4/o4/2o13 - Added Basic Directional Movement,
  21. # 27/o3/2o13 - Started, Finished,
  22. #
  23. #===============================================================================
  24. # ☆ Introduction
  25. #-------------------------------------------------------------------------------
  26. # A simple script to allow for WSAD movement rather than the VX Ace default.
  27. #
  28. # If Paired with my $D13x Core Script, then it also allows most keyboard
  29. # keys to control the movement(rather then WSAD).
  30. #
  31. # Also allows for a very simple directional movement.
  32. #
  33. # NOTE : In Order for the customization options to work, you MUST
  34. # have the $D13x Core script.
  35. # The script will function fine without the core but it will be limited to
  36. # WSAD Controls.
  37. #
  38. #===============================================================================
  39. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  40. #===============================================================================
  41. # 1. You MUST give credit to "Dekita" !!
  42. # 2. You are NOT allowed to repost this script.(or modified versions)
  43. # 3. You are NOT allowed to convert this script.
  44. # 4. You are NOT allowed to use this script for Commercial games.
  45. # 5. ENJOY!
  46. #
  47. # "FINE PRINT"
  48. # By using this script you hereby agree to the above terms and conditions,
  49. # if any violation of the above terms occurs "legal action" may be taken.
  50. # Not understanding the above terms and conditions does NOT mean that
  51. # they do not apply to you.
  52. # If you wish to discuss the terms and conditions in further detail you can
  53. # contact me at http://dekitarpg.wordpress.com/
  54. #
  55. #===============================================================================
  56. # ☆ Instructions
  57. #-------------------------------------------------------------------------------
  58. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  59. #
  60. #===============================================================================
  61. # ☆ HELP
  62. #-------------------------------------------------------------------------------
  63. # For a list of possible key symbols check the help section of the
  64. # $D13x core script.
  65. #
  66. #===============================================================================
  67. module WSAD_Move
  68. #===============================================================================
  69.  
  70. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  71. # ☆ Basic Settings
  72. #--------------------------------------------------------------------------
  73. # Make false to disable diagonal movement
  74. Allow_Diagonal_Move = true
  75.  
  76. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  77. # ☆ Advanced Settings
  78. #--------------------------------------------------------------------------
  79. # ALL settings below Require my $D13x - Core to take effect !!
  80. Up = :W
  81. Down = :S
  82. Left = :A
  83. Right = :D
  84.  
  85. # Make false to disable new sprint key overwrite
  86. OverWrite_Sprint_Key = true
  87. Sprint = :RSHIFT
  88. #####################
  89. # CUSTOMISATION END #
  90. end #####################
  91. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  92. # #
  93. # http://dekitarpg.wordpress.com/ #
  94. # #
  95. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  96. #===============================================================================#
  97. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  98. # YES?\.\. #
  99. # OMG, REALLY? \| #
  100. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  101. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  102. #===============================================================================#
  103. module Input
  104. #===============================================================================
  105. #---------------------------------------------------------------------------
  106. # Dir4 Using $D13x Key Input
  107. #---------------------------------------------------------------------------
  108. def self.dir4
  109. return old_key_WSAD_dir4 unless $D13x[:CORE]
  110. return 2 if Keys.press?(Keys::Key[WSAD_Move::Down])
  111. return 4 if Keys.press?(Keys::Key[WSAD_Move::Left])
  112. return 6 if Keys.press?(Keys::Key[WSAD_Move::Right])
  113. return 8 if Keys.press?(Keys::Key[WSAD_Move::Up])
  114. return 0
  115. end
  116. #---------------------------------------------------------------------------
  117. # Dir4 using default Vx Ace Key Input
  118. #---------------------------------------------------------------------------
  119. def self.old_key_WSAD_dir4
  120. return 2 if Input.press?(:Y)
  121. return 4 if Input.press?(:X)
  122. return 6 if Input.press?(:Z)
  123. return 8 if Input.press?(:R)
  124. return 0
  125. end
  126. #---------------------------------------------------------------------------
  127. # Dir8 using $D13x Key Input
  128. #---------------------------------------------------------------------------
  129. def self.dir8
  130. return old_key_WSAD_dir8 unless $D13x[:CORE]
  131. d = Keys.press?(Keys::Key[WSAD_Move::Down])
  132. l = Keys.press?(Keys::Key[WSAD_Move::Left])
  133. r = Keys.press?(Keys::Key[WSAD_Move::Right])
  134. u = Keys.press?(Keys::Key[WSAD_Move::Up])
  135. return 1 if d && l
  136. return 3 if d && r
  137. return 7 if u && l
  138. return 9 if u && r
  139. return 2 if d
  140. return 4 if l
  141. return 6 if r
  142. return 8 if u
  143. return 0
  144. end
  145. #---------------------------------------------------------------------------
  146. # Dir8 using default Vx Ace Key Input
  147. #---------------------------------------------------------------------------
  148. def self.old_key_WSAD_dir8
  149. d = Input.press?(:Y)
  150. l = Input.press?(:X)
  151. r = Input.press?(:Z)
  152. u = Input.press?(:R)
  153. return 1 if d && l
  154. return 3 if d && r
  155. return 7 if u && l
  156. return 9 if u && r
  157. return 2 if d
  158. return 4 if l
  159. return 6 if r
  160. return 8 if u
  161. return 0
  162. end
  163.  
  164. end
  165.  
  166. #===============================================================================
  167. class Game_Player < Game_Character
  168. #===============================================================================
  169. if WSAD_Move::OverWrite_Sprint_Key
  170. #---------------------------------------------------------------------------
  171. # Alias List
  172. #---------------------------------------------------------------------------
  173. alias :new_dash? :dash?
  174. #--------------------------------------------------------------------------
  175. # Determine if Dashing (overwrite)
  176. #--------------------------------------------------------------------------
  177. def dash?
  178. return new_dash? unless $D13x[:CORE]
  179. return false if @move_route_forcing
  180. return false if $game_map.disable_dash?
  181. return false if vehicle
  182. return Keys.press?(Keys::Key[WSAD_Move::Sprint])
  183. end
  184. end # << WSAD_Move::OverWrite_Sprint_Key
  185. #--------------------------------------------------------------------------
  186. # Processing of Movement via Input from Directional Buttons
  187. #--------------------------------------------------------------------------
  188. if WSAD_Move::Allow_Diagonal_Move
  189. def move_by_input
  190. return if !movable? || $game_map.interpreter.running?
  191. case Input.dir8
  192. when 2, 4, 6, 8 then move_straight(Input.dir4)
  193. when 1 then move_diagonal(4, 2)
  194. when 3 then move_diagonal(6, 2)
  195. when 7 then move_diagonal(4, 8)
  196. when 9 then move_diagonal(6, 8)
  197. end
  198. end
  199. end
  200.  
  201. end
  202.  
  203. #==============================================================================#
  204. # http://dekitarpg.wordpress.com/ #
  205. #==============================================================================#
  206. end # if false // true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement