LOGIN
SEARCH
PROFILE
keys: ↑ ↓
LOGOUT
INDEX
MEMBERS
keys: ↑ ↓
HOME
PORTAL
PLAY ALONG
PLAY with WORDS
PLAY with GRAPHICS
PLAY with SOUNDS
PLAY with CODES
PLAY with PROJECTS
keys: ← →
Guest Access
Register:
Members:



Go to page : 1, 2, 3, 4, 5, 6  Next

View previous topic View next topic Go down Message [Page 1 of 6]

EVENTALIST
EVENTALIST
#1 XAS - Blood Effects Empty XAS - Blood Effects
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
XAS - Blood Effects
Version: 2.3
Author: Mr Wiggles
Date: April 28, 2011

Version History



  • Version 2.3 4/28/11 - Added new feature, more random effects.
  • Version 2.0 2/8/11 - Changed how effects where created.
  • Version 1.6 6/27/10 - Fixed hue colors that where wrong. Cleaned the code up. Fixed bleeding when healing.
  • Version 1.5 6/26/10 - Added more features
  • Version 1.0 6/25/10 - Original Release


Planned Future Versions

  • More features and such, idk what...


Description


This will make Enemies and the player bleed when hurt, cause every one likes a little gore in their games.
New in 1.5 Blood screen effects. this will show blood splats on the game screen when the player is hurt.

Features

  • ID filter, only enemies that are not trap nor item will bleed.
  • Random blood selection makes the splatters looks some what unique.
  • V1.5 - Blood hues so that different enemy's can have different colored blood.
  • V1.5 - Blood screen splatters, puts a randomly selected blood picture on the game screen that will fade away after a set time.
  • V2.3 - Different blood sets for each enemy.
  • V2.3 - Selective blood effects based on attack id.


Screen shots
if you bug me about it i will post a screen snap for you.

Instructions
Paste this script bellow XAS scripts and above main then make sure you have "Blood" character set in your Graphics/Characters folder in your project directory and put the "Blood_Sheet" in your Graphics/Pictures folder.

script


"Blood" character set: (feel free to make edits)
XAS - Blood Effects Blood10
"Blood_Sheet":

Code:

#===============================================================================
# XAS - Blood Effects
#===============================================================================
# by Mr_Wiggles
# Version 2.3
# 4/28/11
#===============================================================================
module Blood
#-------------------------------------------------------------------------------
# Blood splatter effects
#-------------------------------------------------------------------------------
# Number of seconds blood is shown for
BLOOD_EARASE_TIME = 10
# Make the blood slightly see through? (0 - 255)
BLOOD_OPACITY = 180
#-------------------------------------------------------------------------------
# Monster blood colors. when A; return B ("A" monster ID, "B" hue [0 - 350] )
# Hue colors: 0 = red; 40 = yellow; 120 = green; 190 = sky blue;
# 220 = navy blue; 260 = purple; 310 = pink; 350 = red
# (same for actors but id's are negative, so actor 4 is id -4)
  def blood_hues(id)
    case id
    # when (enemy id) then return (Hue value)
    when 2 then return 180
    when 5 then return 40
    else # this will return the default blood color
      return 0
    end
  end
#-------------------------------------------------------------------------------
# Monster blood character set.
  def blood_name(id)
    case id
    # when (enemy id) then return (IMG name)
    when 1 then return "Ciructs"
    else # Default IMG name
      return "Blood"
    end
  end
end
#-------------------------------------------------------------------------------
# Tool id's that dont cause bleeding.
NO_BLOOD_TOOL  = [1,2,3]
# Enemies that dont cause bleeding. (actor id's are negative)
NO_BLOOD_ENEMY = [1,2,2]
#-------------------------------------------------------------------------------
# Blood screen effects
#-------------------------------------------------------------------------------
# Use screen blood effects
USE_BLOODY_SCREEN = true
# Number of seconds before blood fades off of screen
BLOOD_DURATION = 10
# Opacity of blood splatters on screen
BLOOD_SCREEN_OPACITY = 200
# Name of picture used for blood splaters
BLOOD_SHEET = "Blood_Sheet"

#===============================================================================
# XRXS Battler Attachment
#===============================================================================
module XRXS_BattlerAttachment
  alias :be_action_effect :action_effect
  def action_effect(bullet, action_id)
    eff = be_action_effect(bullet, action_id)
    user    = bullet.action.user
    skill    = $data_skills[action_id]
    return if user.nil? or skill.nil?
    make_be  = true
    if self.battler.is_a?(Game_Enemy) and
        (XAS_BA_ENEMY::ENEMY_OBJECT.include?(self.id) or
        XAS_BA_ENEMY::ITEM_ENEMY.include?(self.id))
      make_be = false
    end
    if make_be and !NO_BLOOD_TOOL.include?(skill.id)
      be_make_effect(user, skill)
    end
    return eff
  end

  alias :be_attack_effect :attack_effect
  def attack_effect(attacker)
    eff = be_attack_effect(attacker)
    make_be = true
    if self.battler.is_a?(Game_Enemy) and
        (XAS_BA_ENEMY::ENEMY_OBJECT.include?(self.id) or
        XAS_BA_ENEMY::ITEM_ENEMY.include?(self.id))
      make_be = false
    end
    if make_be and !NO_BLOOD_ENEMY.include?(attacker.id)
      be_make_effect(attacker)
    end
    return eff
  end
end
 
#===============================================================================
# Game Character
#===============================================================================
class Game_Character
  def be_make_effect(user, skill = nil)
    @be_old_hp = self.battler.hp if @be_old_hp.nil?
    self_id = self.battler.id
    self_id *= -1 if self.battler.is_a?(Game_Actor)
    user_id = user.battler.id
    user_id *= -1 if user.battler.is_a?(Game_Actor)
    if @be_old_hp != self.battler.hp and (@be_old_hp - self.battler.hp > 0)
      $scene.make_blood_effect(@real_x, @real_y, self_id)
    end
    @be_old_hp = self.battler.hp
  end
end

#===============================================================================
# Blood Screen
#===============================================================================
class Bloody_Window < Window_Base
  def initialize
    super(-20, -20, 700, 600)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    self.z = 900
    @blood_graphics = []
    @blood_sheet = RPG::Cache.picture(BLOOD_SHEET)
    @wt = @blood_sheet.width / 4
    @ht = @blood_sheet.height / 4
    update
  end

  def refresh
    self.contents.clear
    for blood in @blood_graphics
      rect = Rect.new(@wt * blood[2][0], blood[2][1] * @ht, @wt, @ht)
      self.contents.blt(blood[0], blood[1], @blood_sheet, rect, blood[4])
    end
  end
 
  def make_random_blood
    loop do
      stop_loop = true
      x = (rand(50) * 10) + 20
      y = (rand(40) * 10) + 20
      n = [rand(2)+rand(2), rand(2)+rand(2)]
      @blood_graphics.each {|b| stop_loop = false if b[2] == n}
      if stop_loop
        @blood_graphics.push([x, y, n, BLOOD_DURATION * 8, BLOOD_SCREEN_OPACITY])
        break
      end
    end
  end

  def update
    @actor = $game_party.actors[0]
    @old_player_hp = @actor.hp if @old_player_hp.nil?
    if @old_player_hp != @actor.hp
      make_random_blood if (@old_player_hp - @actor.hp > 0)
      @old_player_hp = @actor.hp
    end
    return if @blood_graphics.empty?
    @blood_graphics.each {|blood| update_blood(blood)}
    refresh
  end

  def update_blood(blood)
    if blood[4] == 0
      @blood_graphics.delete(blood)
      return
    end
    blood[3] -= 5 if blood[3] > 0
    blood[4] -= 5 if blood[4] > 0 and blood[3] <= BLOOD_SCREEN_OPACITY
  end
end

#==============================================================================
# Scene Map
#==============================================================================
class Scene_Map
  alias blood_window_main main
  def main
    if USE_BLOODY_SCREEN
      @blood_window = Bloody_Window.new
      @blood_update_pause = 5
    end
    blood_window_main
    @blood_window.dispose if USE_BLOODY_SCREEN
  end

  alias blood_window_update update
  def update
    blood_window_update
    return if @blood_update_pause.nil?
    @blood_update_pause -= 1 if @blood_update_pause > 0
    return if @blood_update_pause > 0
    @blood_window.update; @blood_update_pause = 5
  end
 
  def make_blood_effect(*args)
    @spriteset.make_blood_effect(*args)
  end
end

#==============================================================================
# Spriteset Map
#==============================================================================
class Spriteset_Map 
  alias :blood_effects_init :initialize
  def initialize
    @blood = []
    blood_effects_init
  end
 
  def make_blood_effect(x, y, id)
    @blood.push(Sprite_Blood.new(@viewport1, x, y, id))
  end
 
  alias :blood_effects_up :update
  def update
    blood_effects_up
    @blood.each{|blood| blood.update if !blood.disposed?}
  end
 
  alias :blood_effects_dis :dispose
  def dispose
    blood_effects_dis
    @blood.each{|blood| blood.dispose if !blood.disposed?}
  end
end

#==============================================================================
# Sprite Blood
#==============================================================================
class Sprite_Blood < RPG::Sprite
  include Blood

  def initialize(viewport, x, y, id)
    super(viewport)
    @x, @y, @id = x, y, id
    @duration = (BLOOD_EARASE_TIME * 40) + BLOOD_OPACITY
    set = blood_name(@id)
    bit = RPG::Cache.character(set, blood_hues(@id)) rescue nil
    if bit.nil?
      $blood_fails = [] if $blood_fails.nil?
      unless $blood_fails.include?(set)
        $blood_fails.push(set)
        print("Blood effect character set \"#{set}\" was not found!")
      end
      self.dispose
      return
    end
    self.bitmap = bit
    @cw, @ch = bitmap.width  / 4, bitmap.height / 4
    sx, sy = rand(4) * @cw, rand(4) * @ch
    self.src_rect.set(sx, sy, @cw, @ch)
    self.opacity = BLOOD_OPACITY
    self.x = screen_x
    self.y = screen_y
    self.z = 1
    update
  end
 
  def screen_x
    return (@x - $game_map.display_x) / 4
  end

  def screen_y
    return (@y - $game_map.display_y) / 4
  end

  def update
    self.x = screen_x
    self.y = screen_y
    @duration -= 1
    self.opacity -= 1 if BLOOD_OPACITY <= @duration
    self.dispose if @duration == 0
  end
end

Support


Post any suggestions for future updates or any errors you may encounter here.

Known Compatibility Issues
none that i know of.

Restrictions
DO NOT post this on any other forum with out my permission, you are free to edit this in any way you see fit but you must still credit me some where.
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#2 XAS - Blood Effects Empty Re: XAS - Blood Effects
Loading

Legault123

Legault123
Active Member
Active Member
Active Member
profile
Another great script, thanks Mr. Wiggles!
Active Member
Show Signature
Active Member
Administrator
Administrator
#3 XAS - Blood Effects Empty Re: XAS - Blood Effects
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile
time to BLEED!

@wiggles - ever since your code has bursted into flames you have been burning down the house!

maybe I can edit this blood splatter animation sheet into a character one...

Spoiler:

thanks for sharing! "killer idea"
Administrator
Show Signature
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
EVENTALIST
EVENTALIST
#4 XAS - Blood Effects Empty Re: XAS - Blood Effects
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
you shouldn't have a problem with doing that (i like that animation).
i have been trying to think up some ideas for an update. (right now i fixed it so that the blood fades away instead of shrinking. but im waiting to update until i have a few more additions to the script.
EVENTALIST
Show Signature
EVENTALIST
Administrator
Administrator
#5 XAS - Blood Effects Empty Re: XAS - Blood Effects
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile
ooh how about including a picture that takes up the whole screen and fades away
to give that bloody screen affect ^,^ "?"
Administrator
Show Signature
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
Active Member
Active Member
#6 XAS - Blood Effects Empty Re: XAS - Blood Effects
Loading

Legault123

Legault123
Active Member
Active Member
Active Member
profile
Maybe after a Killer Overdrive realease the screen just covers with blood just like gameface said, or what about, the stronger the attack, more blood on the floor! Can't wait to see your next script
Active Member
Show Signature
Active Member
EVENTALIST
EVENTALIST
#7 XAS - Blood Effects Empty Re: XAS - Blood Effects
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
cool sounds like some great updates, i think i might start work on the new version.
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#8 XAS - Blood Effects Empty Re: XAS - Blood Effects
Loading

unrivaledneo

unrivaledneo
Active Member
Active Member
Active Member
profile
Like i suggested on the other Thread. Maybe have it so u can define what monsters done give off blood, and maybe have it defineable so different monsters give off different types of blood. (Trying to think simple) ALso Blood projection instead of dropping at the feet ...

All I got...

OFFTOPIC: WOuld ya mind if I posted this on the new XAS Wiki im making for the XAS Tutorial site?
Active Member
Show Signature
Active Member
EVENTALIST
EVENTALIST
#9 XAS - Blood Effects Empty Re: XAS - Blood Effects
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
thanks for the update suggestions i put a lot of them in the new update.
*script was updated*

@neo - im gonna see what i can do about the blood spraying instead of falling in the next update cause i want the blood to be thrown realistically away from the point of impact, so i need to see how i can do that.
EVENTALIST
Show Signature
EVENTALIST
Administrator
Administrator
#10 XAS - Blood Effects Empty Re: XAS - Blood Effects
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile
ha! this is "bloody smashin!" the update rocks! ^,^
Administrator
Show Signature
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch

Sponsored content

profile

View previous topic View next topic Back to top Message [Page 1 of 6]

Go to page : 1, 2, 3, 4, 5, 6  Next

 

Chatbox system disabled
Personal messaging disabled