Advertisement
Guest User

Untitled

a guest
Nov 15th, 2013
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.49 KB | None | 0 0
  1. #===============================================================================
  2. # CAHML Sprite (Walking) in Window Status
  3. #===============================================================================
  4. # Author : Cahml
  5. # Version : V.1.0
  6. # Engine : RMVX Ace
  7. #===============================================================================
  8. # Cara Pemakaian
  9. #-------------------------------------------------------------------------------
  10. # Taruh script ini di atas Main Process dan di bawah script apapun pada
  11. # Script Editor.
  12. # jangan lupa harus pkek Srpite 1 set...
  13. # jangan yang 8 set
  14. #===============================================================================
  15. # Credits Me CAHML :)
  16. #===============================================================================
  17. # Script ini Adalah Script untuk ada Sprite Character yang berjalan Di Face klo buka di Window Status
  18. #-------------------------------------------------------------------------------
  19. # mungkin bisa sedikit membantu bwt yg newbie dan Diatas Newbie :3
  20. #===============================================================================
  21.  
  22. module CAHML
  23. #===============================================================================
  24. #ini adalah Jika kamu Mau Nge Set atau Nge - Custom Srptite dari karakter kamu
  25. # misal sprite kamu Kaduki.... kamu bisa nge set "_1" , "_2" , "_3" DLL
  26. # klo gamau nge set kosongin aja :)
  27. #===============================================================================
  28. SPRITE_ADJUST = ""
  29. #===============================================================================
  30. #berapa Frame dngan Sprite berjalannya??? Step baru itu 1 Detik yang setara 60 Frame.
  31. #===============================================================================
  32. SPRITE_WALK = 15
  33. #===============================================================================
  34. # Mau Sprite nya Random????
  35. #===============================================================================
  36. SPRITE_RANDOM_DIR = true
  37. #===============================================================================
  38. #berapa jumlah step klo mau ganti direction???
  39. #===============================================================================
  40. SPRITE_RANDOM_DIR_COUNT = 5
  41. #===============================================================================
  42. #memulai direction dari arah mana???
  43. #0 = Bawah
  44. #1 = kiri
  45. #2 = kanan
  46. #3 = atas
  47. #===============================================================================
  48. SPRITE_DIR_START = 0
  49. #===============================================================================
  50. # Set Sprite nya di Face Window Status
  51. #===============================================================================
  52. SPRITE_X = 90
  53. SPRITE_Y = 112
  54. SHOW_AT_STATUS = true
  55. end
  56. include CAHML
  57. def update
  58. super
  59. @counter += 1
  60. if @counter == SPRITE_WALK
  61. @counter = 0
  62. refresh2
  63. end
  64. end
  65.  
  66. def refresh2
  67. if @anim_index == 0
  68. @anim_index = 1
  69. @flip = false
  70. elsif @anim_index == 1
  71. if @flip == false
  72. @anim_index = 2
  73. else
  74. @anim_index = 0
  75. end
  76. elsif @anim_index == 2
  77. @anim_index = 1
  78. @flip = true
  79. end
  80. if SPRITE_RANDOM_DIR
  81. @count += 1
  82. if @count == SPRITE_RANDOM_DIR_COUNT
  83. @count = 0
  84. for i in $game_party.members
  85. @step[i.id] = rand(4)
  86. end
  87. end
  88. end
  89. refresh
  90. for actor in $game_party.members
  91. draw_actor_graphic_extreme(actor, SPRITE_X, actor.index * 96 + SPRITE_Y, @anim_index, @step[actor.id])
  92. end
  93. end
  94. class Window_Status < Window_Selectable
  95. alias define initialize
  96. def initialize(actor)
  97. @refreshed = false
  98. @anim_index = 0 if @anim_index == nil
  99. @flip = false
  100. @count = 1
  101. @counter = 0
  102. @step = SPRITE_DIR_START
  103. define(actor)
  104. end
  105.  
  106. def update
  107. super
  108. @counter += 1
  109. if @counter == SPRITE_WALK
  110. @counter = 0
  111. refresh2
  112. end
  113. end
  114.  
  115. alias sprite_draw refresh
  116. def refresh
  117. sprite_draw
  118. draw_actor_graphic_extreme(@actor, 8 + SPRITE_X, 32 + SPRITE_Y, @anim_index, @step) unless @refreshed or !SHOW_AT_STATUS
  119. @refreshed = true
  120. end
  121.  
  122. def refresh2
  123. if @anim_index == 0
  124. @anim_index = 1
  125. @flip = false
  126. elsif @anim_index == 1
  127. if @flip == false
  128. @anim_index = 2
  129. else
  130. @anim_index = 0
  131. end
  132. elsif @anim_index == 2
  133. @anim_index = 1
  134. @flip = true
  135. end
  136. if SPRITE_RANDOM_DIR
  137. @count += 1
  138. if @count == SPRITE_RANDOM_DIR_COUNT
  139. @count = 0
  140. @step = rand(4)
  141. end
  142. end
  143. refresh if SHOW_AT_STATUS
  144. draw_actor_graphic_extreme(@actor, 6 + SPRITE_X, 32 + SPRITE_Y, @anim_index, @step) if SHOW_AT_STATUS
  145. end
  146. end
  147.  
  148. class Window_Base < Window
  149. def draw_actor_graphic_extreme(actor, x, y, anim, step)
  150. draw_character_extreme(actor.character_name, actor.character_index, x, y, anim,step)
  151. end
  152. def draw_character_extreme(character_name, character_index, x, y,anim,step)
  153. return if character_name == nil
  154. bitmap = Cache.character(character_name+SPRITE_ADJUST)
  155. sign = character_name[/^[\!\$]./]
  156. if sign != nil and sign.include?('$')
  157. cw = bitmap.width / 3
  158. ch = bitmap.height / 4
  159. else
  160. cw = bitmap.width / 12
  161. ch = bitmap.height / 8
  162. end
  163. n = character_index
  164. a = anim
  165. b = step
  166. src_rect = Rect.new((n%4*3+a)*cw, (n/4*4+b)*ch, cw, ch) unless b == nil
  167. self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect) unless b == nil
  168. end
  169. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement