Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # Blizz ABS Damage Sprite
- # Version: 2.00
- # Author : LiTTleDRAgo
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- #
- # Explanation :
- #
- # This script will change your character graphic while get damaged / healed
- #
- # Graphic required :
- # {Actor.name}_hit (ex : Aluxes_hit)
- # {Actor.name}_heal (ex : Aluxes_heal)
- #
- # Set any to nil if you don't want it
- #
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Map_Battler
- ANIDamage = 14 # ID of the animation when character damaged
- ANIHeal = 22 # ID of the animation when character healed
- SPRDamage = '_hit' # Sprite when character damaged
- SPRHeal = '_heal' # Sprite when character healed
- alias sprite_animation_setup_hit_sprite sprite_animation_setup
- def sprite_animation_setup(*args)
- if @battler && (dif = @battler.hp - (@old_hp_ny ||= @battler.hp)) != 0
- ani = dif > 0 ? ANIHeal : dif < 0 ? ANIDamage : nil
- spr = dif > 0 ? SPRHeal : dif < 0 ? SPRDamage : nil
- ani && @animation_id = ani
- spr && setup_sprites_ex(spr, [6,6,6,6])
- return @old_hp_ny = @battler.hp
- elsif @character_name_org != '' &&
- (@current_sprite == SPRHeal || @current_sprite == SPRDamage)
- @sframes[@sindex] -= 1
- @sindex += 1 if @sframes[@sindex] <= 0
- if @sindex >= @sframes.size
- (@sindex = 0) && reset_sprites
- else
- @character_name = @character_name_org + @current_sprite
- end
- return
- end
- sprite_animation_setup_hit_sprite(*args)
- end
- def setup_sprites_ex(type, frames = BlizzABS::Cache::FramesDefault)
- return if check_char_exist(@character_name_org + type) == 'false'
- @character_name = @character_name_org + (@current_sprite = type)
- setup_frames(frames.clone)
- end
- def check_char_exist(n)
- return (@sprexist||={})[n] ||= RPG::Cache.character(n,0).to_s rescue 'false'
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement