Guest User

Untitled

a guest
Jan 22nd, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.99 KB | None | 0 0
  1. #===============================================================================
  2. # * Falcao Pearl ABS script shelf # 8
  3. #
  4. # Item and gold pop up v 1.0
  5. # This is just an add on for the Pearl ABS system, it run as standalone mode too
  6. #
  7. # Website: http://falcaorgss.wordpress.com/
  8. # Foro: www.makerpalace.com
  9. #===============================================================================
  10. #
  11. # * Installation
  12. # This work as plug and play, copy and paste the script above main
  13. #
  14. # * Usage
  15. # There is no special references, when you earn an item or gold, then pop appear
  16. # Edit the module below for convenience
  17. #-------------------------------------------------------------------------------
  18.  
  19. module PearlItemPop
  20.  
  21. # Position X of the pop up object
  22. Pos_X = 10
  23.  
  24. # Position Y of the pop up object
  25. Pos_Y = 320
  26.  
  27. # Icon displayed when earnig gold
  28. GoldIcon = 245
  29.  
  30. # Se sound played when gaining items (set nil if you dont want to play sound)
  31. ItemSe = "Item3"
  32.  
  33. # Se sound played when gainig gold (set nil if you dont want to play sound)
  34. GoldSe = "Shop"
  35.  
  36. end
  37.  
  38. class Game_Party < Game_Unit
  39. alias falcaopearl_itempop_gain gain_item
  40. def gain_item(item, amount, include_equip = false)
  41. if !item_container(item.class).nil? && SceneManager.scene_is?(Scene_Map)
  42. if amount > 0
  43. $game_system.item_object = [item, amount]
  44. RPG::SE.new(PearlItemPop::ItemSe, 80).play rescue nil
  45. end
  46. end
  47. falcaopearl_itempop_gain(item, amount, include_equip = false)
  48. end
  49.  
  50. alias falcaopearl_itempop_gold gain_gold
  51. def gain_gold(amount)
  52. if SceneManager.scene_is?(Scene_Map)
  53. $game_system.item_object = [nil, amount]
  54. RPG::SE.new(PearlItemPop::GoldSe, 80).play rescue nil
  55. end
  56. falcaopearl_itempop_gold(amount)
  57. end
  58. end
  59.  
  60. class Game_System
  61. attr_accessor :item_object
  62. end
  63.  
  64. class Spriteset_Map
  65.  
  66. alias falcaopearl_itempop_create create_pictures
  67. def create_pictures
  68. create_itempop_sprites
  69. falcaopearl_itempop_create
  70. end
  71.  
  72. def create_itempop_sprites
  73. @item_object = $game_system.item_object
  74. @item_sprite = Sprite_PopItem.new(@viewport2, @item_object) if
  75. not @item_object.nil?
  76. end
  77.  
  78. alias falcaopearl_itempop_update update
  79. def update
  80. if !@item_sprite.nil?
  81. unless @item_sprite.disposed?
  82. @item_sprite.update
  83. else
  84. @item_sprite.dispose
  85. @item_object = nil
  86. $game_system.item_object = nil
  87. @item_sprite = nil
  88. end
  89. end
  90. if @item_object != $game_system.item_object
  91. @item_sprite.dispose if !@item_sprite.nil?
  92. @item_sprite = nil
  93. @item_sprite = Sprite_PopItem.new(@viewport2, $game_system.item_object)
  94. @item_object = $game_system.item_object
  95. end
  96. falcaopearl_itempop_update
  97. end
  98.  
  99. alias falcaopearl_itempop_dispose dispose
  100. def dispose
  101. @item_sprite.dispose unless @item_sprite.nil?
  102. falcaopearl_itempop_dispose
  103. end
  104. end
  105.  
  106.  
  107. class Sprite_PopItem < Sprite
  108. def initialize(viewport, item)
  109. super(viewport)
  110. @item = item[0]
  111. @num = item[1]
  112. set_bitmap
  113. self.x = PearlItemPop::Pos_X
  114. self.y = PearlItemPop::Pos_Y
  115. @erasetimer = 120
  116. update
  117. end
  118.  
  119. def update
  120. super
  121. if @erasetimer > 0
  122. @erasetimer -= 1
  123. self.opacity -= 10 if @erasetimer <= 25
  124. dispose if @erasetimer == 0
  125. end
  126. end
  127.  
  128. def dispose
  129. self.bitmap.dispose
  130. super
  131. end
  132.  
  133. def set_bitmap
  134. @item.nil? ? operand = Vocab::currency_unit : operand = @item.name
  135. string = operand + ' X' + @num.to_s
  136. self.bitmap = Bitmap.new(26 + string.length * 9, 28)
  137. self.bitmap.fill_rect(0, 0, self.bitmap.width, 28, Color.new(0, 0, 0, 100))
  138. self.bitmap.font.size = 20
  139. bitmap = Cache.system("Iconset")
  140. icon = @item.nil? ? PearlItemPop::GoldIcon : @item.icon_index
  141. rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
  142. self.bitmap.blt(4, 0, bitmap, rect)
  143. self.bitmap.draw_text(28, 0, 250, 32, string)
  144. end
  145. end
Add Comment
Please, Sign In to add comment