Advertisement
Guest User

custom scriptlet

a guest
Jun 6th, 2015
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.21 KB | None | 0 0
  1. # _ __ ____ ___ _ _
  2. # | | / / (_) \/ | | | ( )
  3. # | |/ / __ _ _| . . | ___ _ __ | | _____ _ _|/ ___
  4. # | \ / _` | | |\/| |/ _ \| '_ \| |/ / _ \ | | | / __|
  5. # | |\ \ (_| | | | | | (_) | | | | < __/ |_| | \__ \
  6. # \_| \_/\__,_|_\_| |_/\___/|_| |_|_|\_\___|\__, | |___/
  7. # _____ _ _ __/ |
  8. # / __ (_) | | |___/
  9. # | / \/_ _ __ ___ _ _| | __ _ _ __
  10. # | | | | '__/ __| | | | |/ _` | '__|
  11. # | \__/\ | | | (__| |_| | | (_| | |
  12. # \____/_|_| \___|\__,_|_|\__,_|_|
  13. # _____
  14. # | ___|
  15. # | |__ _ __ ___ _ __ ___ _ _
  16. # | __| '_ \ / _ \ '_ ` _ \| | | |
  17. # | |__| | | | __/ | | | | | |_| |
  18. # \____/_| |_|\___|_| |_| |_|\__, |
  19. # _____ _ _ __/ |
  20. # / ___| | | | | |___/
  21. # \ `--. ___| | ___ ___| |_ ___ _ __
  22. # `--. \/ _ \ |/ _ \/ __| __/ _ \| '__|
  23. # /\__/ / __/ | __/ (__| || (_) | |
  24. # \____/ \___|_|\___|\___|\__\___/|_|
  25. #
  26. #
  27. ##############Setup##############
  28. =begin
  29. Any enemy you want a special icon for put the tag
  30. <icon #> in their note box, where # is replaced with the index
  31. of the icon
  32.  
  33. Any enemy you want to be placed in a particular position arround
  34. the circle (Such as because each enemy reperesents part of a monster) put
  35. <icon_angle #> in their note box, where the angle is an angle from 0 to 360
  36.  
  37. Otherwise the icons will be placed arround the circle at intivals. (Good for
  38. if there are lots of unrelated enemies)
  39. =end
  40. ##########Config###########
  41.  
  42. #default icon if none is define in the note box for the enemy
  43. $kaimonkey_circle_default_icon = 128;
  44.  
  45. #==============================================================================
  46. # ** Window_BattleEnemy
  47. #------------------------------------------------------------------------------
  48. # Window for selecting the enemy who is the action target on the battle
  49. # screen.
  50. #==============================================================================
  51. class Game_Enemy < Game_Battler
  52. def get_tag(tag,default)
  53. notes = $data_enemies[@enemy_id].note
  54. if notes.include?("<"+tag+" ")
  55. return (notes.split("<"+tag)[1].split(">")[0]).to_i
  56. else
  57. return default
  58. end
  59. end
  60. end
  61. class Window_BattleEnemy < Window_Selectable
  62. def initialize(info_viewport)
  63. super(0, info_viewport.rect.y, window_width, Graphics.height-info_viewport.rect.y)
  64. refresh
  65. self.visible = false
  66. @info_viewport = info_viewport
  67. end
  68. #--------------------------------------------------------------------------
  69. # * Get Window Width
  70. #--------------------------------------------------------------------------
  71. def window_width
  72. 128
  73. end
  74. #--------------------------------------------------------------------------
  75. # * Get Digit Count
  76. #--------------------------------------------------------------------------
  77. def col_max
  78. return $game_troop.alive_members.size
  79. end
  80. #--------------------------------------------------------------------------
  81. # * Get Number of Items
  82. #--------------------------------------------------------------------------
  83. def item_max
  84. $game_troop.alive_members.size
  85. end
  86. #--------------------------------------------------------------------------
  87. # * Get Enemy Object
  88. #--------------------------------------------------------------------------
  89. def enemy
  90. $game_troop.alive_members[@index]
  91. end
  92. #--------------------------------------------------------------------------
  93. # * Draw Item
  94. #--------------------------------------------------------------------------
  95. def draw_item(index)
  96. icon = $game_troop.alive_members[index].get_tag("icon",$kaimonkey_circle_default_icon)
  97. r = item_rect(index)
  98. draw_icon(icon,r.x,r.y)
  99. end
  100.  
  101. #Def itemrect
  102. def item_rect(index)
  103. theta = 360/item_max*index
  104. theta = $game_troop.alive_members[index].get_tag("icon_angle",theta)
  105. theta *= Math::PI
  106. theta /= 180
  107. mid_y = (contents_height - 20)/2.to_f
  108. mid_x = contents_width/2.to_f
  109. r = [mid_x,mid_y].min - 14
  110. rect = Rect.new
  111. rect.width = 24
  112. rect.height = 24
  113. rect.x = mid_x+Math.sin(theta)*r-12
  114. rect.y = mid_y-Math.cos(theta)*r-12 + 15
  115. rect
  116. end
  117.  
  118. def update
  119. super
  120. if $game_troop.alive_members[index]
  121. name = $game_troop.alive_members[index].name
  122. mid_x = contents_width/2.to_f - text_size(name).width/2
  123. draw_text_ex(mid_x,0,name)
  124. end
  125. end
  126.  
  127. def standard_padding
  128. return 0
  129. end
  130.  
  131. #--------------------------------------------------------------------------
  132. # * Show Window
  133. #--------------------------------------------------------------------------
  134. def show
  135. if @info_viewport
  136. width_remain = Graphics.width - width
  137. self.x = width_remain
  138. @info_viewport.rect.width = width_remain
  139. select(0)
  140. end
  141. super
  142. end
  143. #--------------------------------------------------------------------------
  144. # * Hide Window
  145. #--------------------------------------------------------------------------
  146. def hide
  147. @info_viewport.rect.width = Graphics.width if @info_viewport
  148. super
  149. end
  150. #--------------------------------------------------------------------------
  151. # * Move Cursor Right
  152. #--------------------------------------------------------------------------
  153. def cursor_right(wrap = false)
  154. select((index + 1) % item_max)
  155. refresh
  156. end
  157. #--------------------------------------------------------------------------
  158. # * Move Cursor Left
  159. #--------------------------------------------------------------------------
  160. def cursor_left(wrap = false)
  161. select((index - 1 + item_max) % item_max)
  162. refresh
  163. end
  164. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement