Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================
- # thiagodd.blogspot.com.br
- #
- # [TSDA] Bleeding System
- # --> Version 1.1
- # by thiago_d_d
- #
- #--------------------------------------------------------------
- # * Features
- #--------------------------------------------------------------
- # + THis script adds an basic bleeding system. When you activate
- # the bleeding, the hero will lose hp and movement speed,
- # until it heals the bledding.
- #
- #--------------------------------------------------------------
- # * Install
- #--------------------------------------------------------------
- # Put this script above Main
- # You need two pictures, that will show the bood:
- # Sangue1 - empty bar
- # Sangue2 - full bar
- # To start the bleeding, execute an code with this
- # sangrar
- # To stop the bleeding, exeute this:
- # parar_sangramento
- #--------------------------------------------------------------
- # * Configuration
- #--------------------------------------------------------------
- # CHnage below lines.
- #==============================================================
- module TSDA
- #Name of char when bleeding
- CHAR_NAME = "001-Fighter01"
- #ID of database states of the bleeding
- #Dont remove these states when in game, instead use an code with:
- #parar_sangramento
- STATE1 = 13
- STATE2 = 14
- #Bleeding Bars dimension
- SANG_WIDTH = 100
- SANG_HEIGHT = 24
- end
- class Game_Player
- attr_accessor :sangrando
- attr_accessor :sangue
- attr_accessor :character_name
- attr_accessor :move_speed
- attr_accessor :state
- alias old_initialize initialize
- def initialize
- old_initialize
- @sangrando = false
- @sangue = 3600
- end
- end
- class Scene_Map
- attr_accessor :window_sangue
- alias old_main main
- def main
- @window_sangue = Window_Sangue.new
- @window_sangue.visible = false
- old_main
- @window_sangue.dispose
- end
- alias old_update update
- def update
- if $game_player.sangrando
- $game_player.sangue -= 1
- end
- @window_sangue.update
- old_update
- end
- end
- class Window_Sangue < Window_Base
- include TSDA
- def initialize
- super(508, 0, SANG_WIDTH + 32, SANG_HEIGHT + 32)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = $fontface
- self.contents.font.size = $fontsize
- self.opacity = 0
- self.back_opacity = 0
- @sangue = $game_player.sangue
- refresh
- end
- def update
- super
- if $game_player.sangue != @sangue
- if $game_player.sangue <= 0
- parar_sangramento
- $scene = Scene_Gameover.new
- return
- elsif $game_player.sangue <= 600
- $game_player.move_speed = 2.5
- if $game_player.state
- $game_party.actors[0].add_state(TSDA::STATE2)
- $game_party.actors[0].remove_state(TSDA::STATE1)
- $game_player.state = false
- end
- elsif $game_player.sangue <= 1200
- $game_player.move_speed = 3
- if $game_player.state == nil
- $game_party.actors[0].add_state(TSDA::STATE1)
- $game_player.state = true
- end
- end
- @sangue = $game_player.sangue
- refresh
- end
- if $game_player.sangrando
- self.visible = true
- else
- self.visible = false
- end
- end
- def refresh
- self.contents.clear
- bitmap = RPG::Cache.picture("Sangue1")
- bitmap2 = RPG::Cache.picture("Sangue2")
- src_rect = Rect.new(0, 0, @sangue * bitmap.width / 3600, bitmap.height)
- src_rect2 = Rect.new(0, 0, bitmap.width, bitmap.height)
- self.contents.blt(0, 0, bitmap2, src_rect)
- self.contents.blt(0, 0, bitmap, src_rect2)
- end
- end
- def sangrar
- $game_player.sangrando = true
- $game_player.character_name = TSDA::CHAR_NAME
- $game_player.move_speed = 4
- end
- def parar_sangramento
- $game_player.sangrando = false
- $game_player.sangue = 3600
- $game_party.actors[0].remove_state(TSDA::STATE1)
- $game_party.actors[0].remove_state(TSDA::STATE2)
- $game_player.state = nil
- $game_player.character_name =
- $game_party.actors[0].character_name
- $game_player.move_speed = 4
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement