[XP] Blood Mage 1.80

Started by fugibo, March 08, 2008, 09:56:19 am

Previous topic - Next topic

omegapirate2000

Not to sound like a giant prick, but has WcW finished his stuff yet? I either need the previous version of this script (if anyone has it), a newer version that works for me, or a way of modifying it so that it works correctly for me.
Spoiler: ShowHide

FenrisHalo

*Ahem*It's a month since some1 last posted something... But anyway, I got version 1.7.1 right here:
I'm not putting it in a spoiler, it minimizes the box :P
=begin
Bloodmage Script v 1.7.1
by WcW

Introduction:
I made this script for Akkein (a.k.a. Akkrin) at
http://forum.chaos-project.com/ at his request. If you use
this script in your game, please make sure that you give him,
as well as myself, credits. For instructions on how to use this
script, refer to the "Instructiions" section further below.

Features:
- Allows for some actors/spells to consume HP rather than SP
- Can set bloodmages either by selecting specific actors
or by declaring "Bloodmage" classes
- Can define some spells to be used as blood spells regardless
of class/actor, and set others to be used as regular spells,
even by Bloodmages
- Can optionally set a minimum percent of HP an actor must
have left to use a Blood spell
- Small, light code with high chance of compatibility with
most scripts that are compatibility with the default
battle system, and _possibly_ BlizzABS

Version History:
1.0.0: Initial release; supported only basic HP consumption
1.0.2: Small Bug Fixes
1.1.2: Removed bug where skill checked for SP as well as HP
1.2.2: Add option for whether or not actors should be able
to kill themselves with Blood spells
1.3.2: Added Blizzard's optimized code.
1.3.3: Fixed a small bug left by Blizzard (:P)
1.4.3: Rewrote some of Blizzard's code for more Blood Mage
goodness :)
1.4.4: Fixed status window bug (wouldn't refresh)
1.4.5: Fixed bug where Blood Mages were unaffected
by things such as Half SP Cost.
1.4.6: Fixed another bug where it didn't consume
any HP at all if the blood mage had 0 SP
thanks to the last two bug fixes.
1.5.6: Added a new function that allows you to disable
the bloodmage effect for certain skills, and optimized
the code some more.
1.5.7: Fixed errors wtih RTAB
1.5.8: Fixed bugs
1.5.9: Fixed error with $game_system.bloodmage_not
1.7.0: Cleaned up code tremendously, added several new options,
improved compatibility, changed configuration. Testing
version; may not work. Please report all errors at
http://forum.chaos-project.com/.
1.7.1: Fixed error

Instructions:
This script should ideally be placed below all default RMXP
scripts and above all of Blizzard's scripts, as well as RMXP's
"Main" script.

To set up the default configuration:
---
To add actors that will be Bloodmages regardless of class:
- Add the actors ID between the brackets on line 153,
separating all ID's with commas.
---
To add classes that will be Bloodmages, regardless of actor:
- Add the class ID between the brackets on line 156,
similarly to setting up actors.
---
To add skills that will consume HP regardless of actor/class:
- Add the ID between the brackets on line 160,
same as the last two configuration options.
---
To add skills that will never sonsume HP:
- Add the ID between the brackets on line 163, same as
the last three.
---
To set actors to die/not die when they use too much HP:
- Replace 'false/true' with 'true/false' on line 170
to invert the current setting.
---
To set the minimum percent of HP a Bloodmage must have
to use a skill while the last option is set to 'false':
- Simply change the number on line 175
---

To edit configuration in an event/script:
( note: in each of these, <v> will represent the ID
  of the actor, class, or skill being spoken of, or
  value for the config option being spoken of )
  ---
To add an actor to the Bloodmages list:
- $game_system.wcw_bloodusers.push <v>
To remove an actor from the Bloodmages list:
- $game_system.wcw_bloodusers.delete <v>
---
To add a class to the Bloodmages list:
- $game_system.wcw_bloodmages.push <v>
To remove a class from the Bloodmages list:
- $game_system.wcw_bloodusers.delete <v>
---
To add an HP-consuming skill to the Bloodmages list:
- $game_system.wcw_bloodskills.push <v>
To remove an HP-consuming skill from the Bloodmages list:
- $game_system.wcw_bloodskills.delete <v>
---
To add a non-HP-consuming skill to the Bloodmages list:
- $game_system.wcw_dryskills.push <v>
To remove a non-HP-consuming skill from the Bloodmages list:
- $game_system.wcw_dryskills.delete <v>
---
To set Bloodmages to die when they use too much HP:
- $game_system.wcw_blood_die = true
To set Bloodmages to live when they use too much HP:
- $game_system.wcw_blood_die = false
---
To set the minimum percent of health a bloodmage must
have to use a skill when the last setting is 'false':
- $game_system.wcw_blood_limit = <v>
---

Compatibility:
If you find any issues, post them at http://forum.chaos-project.com/.

Credits:
Blizzard, for helping me learn to script, pointing out a bug, and optimizing
code
Fantasist, for getting me to come back to RMXP
Akkrin, for giving me the Blood Mage idea
Myself, for scripting it
Cid, for reporting an error ;)

Enjoy |:]
=end

#----------------------------------------------------------------------------
# * CONFIG (redefinition of Game_System class)
#     Configuration section :)
#----------------------------------------------------------------------------
class Game_System

# Defines getter's and setter's for configuration variables
attr_accessor :wcw_bloodusers, :wcw_bloodmages
attr_accessor :wcw_bloodskills, :wcw_dryskills
attr_accessor :wcw_blood_die, :wcw_blood_limit
# Backs up the old initialize method
alias init_wcw_bloodmage_later initialize

#------------------------------------------------------------------------
# - initialize
# First method called :P
#------------------------------------------------------------------------
def initialize

# This variable stores the ID's of all classes which should consume
# HP over MP.
@wcw_bloodusers = []
# This variable stores the ID's of all actors that act as
# bloodmages, even though their class is not a bloodmage.
@wcw_bloodmages = []

# This variable stores the ID's of all skills which will act as
# bloodmage skills, even if the actor using it isn't a bloodmage
@wcw_bloodskills = []
# This variable stores the ID's of all skills which will not cause
# a bloodmage to lose HP if they use them.
@wcw_dryskills = []

# If this variable is set to "true," bloodmages will be able to kill
# themselves if they use to much HP (it will use more HP than the
# actor has, even if it is not enough for the skill.) If it is
# set to false, they will only be able to use the skills until it
# would put them below $game_system.wcw_blood_limit.
@wcw_blood_die = false
# This number must be set from 1 to 100. It signifies the minimum
# percent of HP an actor must have to use a skill if
# $game_system.wcw_blood_die is set to "false. 0 is default,
# and means the actor can use skills until his HP is 1.
@wcw_blood_limit = 0

    return init_wcw_bloodmage_later

  end

end

#----------------------------------------------------------------------------
# * Bulk of the code (redefinition of some Game_Battler code)
#----------------------------------------------------------------------------
class Game_Battler

# Backs up skill_can_use?(skill_id)
alias skill_can_use_wcw_bloodmage_later skill_can_use? #lol, long name :P

#------------------------------------------------------------------------
# - wcw_is_bloodmage?()
# Checks to see if actor is a bloodmage.
#------------------------------------------------------------------------
def wcw_is_bloodmage?

return self.is_a?(Game_Actor) && (
$game_system.wcw_bloodusers.include?(self.class_id) ||
$game_system.wcw_bloodmages.include?(self.id) )

end

def wcw_bloodmage_applies?(skill_id)
return (wcw_is_bloodmage? && !
$game_system.wcw_dryskills.include?(skill_id)) ||
$game_system.wcw_bloodskills.include?(skill_id)
end

#------------------------------------------------------------------------
# - skill_can_use?(skill_id)
# Checks to see if a skill can be used
#------------------------------------------------------------------------
def skill_can_use?(skill_id)

# Go ahead and pass it on if the actor isn't a bloodmage or the
# skill isn't a bloodskill
unless wcw_bloodmage_applies? skill_id
return skill_can_use_wcw_bloodmage_later(skill_id)
end

# If the actor can die, let them;
if $game_system.wcw_blood_die
return skill_can_use_wcw_bloodmage_later skill_id
# Otherise, ensure that they have enough HP:
else
# Make sure that SP does not affect calculations;
# simplest way to do this an maintain compatibility
old_sp = self.sp
if self.sp < $data_skills[skill_id].sp_cost
self.sp = $data_skills[skill_id].sp_cost
end

# Test for skill the old way, always having enough SP
test = skill_can_use_wcw_bloodmage_later skill_id

# Restore SP
self.sp = old_sp

# Return the answer
return ((self.hp - $data_skills[skill_id].sp_cost) < (self.hp *
($game_system.wcw_blood_limit / 100)) && test)

end

  end
end

#----------------------------------------------------------------------------
# * Code to make sure bloodmages consume HP instead of MP
#----------------------------------------------------------------------------
class Scene_Battle

# Backs up make_skill_action_result
alias make_skill_action_result_wcw_bloodmage_later make_skill_action_result

#----------------------------------------------------------------------------
# - make_skill_action_result(battler=nil)
# Execute skill
#----------------------------------------------------------------------------
def make_skill_action_result(battler = @active_battler)
make_skill_action_result_wcw_bloodmage_later battler
# Reduce HP, and put the SP back where it should be :P
if battler.wcw_bloodmage_applies?
battler.hp -= @skill.sp_cost
battler.sp += @skill.sp_cost
end
@status_window.refresh
end

end
<a href="http://plunkit.webs.com/">I have to admit, this looks sweet xD</a>

Blizzard

Alternatively you can use G_G's HP Consuming Skill in Tons of Add-ons.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

FenrisHalo

sounds a bit like you're advertising for tons, but I guess you're right
<a href="http://plunkit.webs.com/">I have to admit, this looks sweet xD</a>

Blizzard

I'm just saying that because WcW made so many (buggy) versions of this that I kind of lost interest in adding the script to Tons. Instead I told G_G to make another script which I just revised and optimized then.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

fugibo

Meh. Half of them were made without any testing and this version is just crap. >_<

I'm also far too lazy to fix this. I might get around to that whenever I download the Windows 7 RC. X[

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

omegapirate2000

Quote from: FenrisHalo on June 26, 2009, 10:17:21 am
*Ahem*It's a month since some1 last posted something... But anyway, I got version 1.7.1 right here:
I'm not putting it in a spoiler, it minimizes the box :P
=begin
Bloodmage Script v 1.7.1
by WcW

Introduction:
I made this script for Akkein (a.k.a. Akkrin) at
http://forum.chaos-project.com/ at his request. If you use
this script in your game, please make sure that you give him,
as well as myself, credits. For instructions on how to use this
script, refer to the "Instructiions" section further below.

Features:
- Allows for some actors/spells to consume HP rather than SP
- Can set bloodmages either by selecting specific actors
or by declaring "Bloodmage" classes
- Can define some spells to be used as blood spells regardless
of class/actor, and set others to be used as regular spells,
even by Bloodmages
- Can optionally set a minimum percent of HP an actor must
have left to use a Blood spell
- Small, light code with high chance of compatibility with
most scripts that are compatibility with the default
battle system, and _possibly_ BlizzABS

Version History:
1.0.0: Initial release; supported only basic HP consumption
1.0.2: Small Bug Fixes
1.1.2: Removed bug where skill checked for SP as well as HP
1.2.2: Add option for whether or not actors should be able
to kill themselves with Blood spells
1.3.2: Added Blizzard's optimized code.
1.3.3: Fixed a small bug left by Blizzard (:P)
1.4.3: Rewrote some of Blizzard's code for more Blood Mage
goodness :)
1.4.4: Fixed status window bug (wouldn't refresh)
1.4.5: Fixed bug where Blood Mages were unaffected
by things such as Half SP Cost.
1.4.6: Fixed another bug where it didn't consume
any HP at all if the blood mage had 0 SP
thanks to the last two bug fixes.
1.5.6: Added a new function that allows you to disable
the bloodmage effect for certain skills, and optimized
the code some more.
1.5.7: Fixed errors wtih RTAB
1.5.8: Fixed bugs
1.5.9: Fixed error with $game_system.bloodmage_not
1.7.0: Cleaned up code tremendously, added several new options,
improved compatibility, changed configuration. Testing
version; may not work. Please report all errors at
http://forum.chaos-project.com/.
1.7.1: Fixed error

Instructions:
This script should ideally be placed below all default RMXP
scripts and above all of Blizzard's scripts, as well as RMXP's
"Main" script.

To set up the default configuration:
---
To add actors that will be Bloodmages regardless of class:
- Add the actors ID between the brackets on line 153,
separating all ID's with commas.
---
To add classes that will be Bloodmages, regardless of actor:
- Add the class ID between the brackets on line 156,
similarly to setting up actors.
---
To add skills that will consume HP regardless of actor/class:
- Add the ID between the brackets on line 160,
same as the last two configuration options.
---
To add skills that will never sonsume HP:
- Add the ID between the brackets on line 163, same as
the last three.
---
To set actors to die/not die when they use too much HP:
- Replace 'false/true' with 'true/false' on line 170
to invert the current setting.
---
To set the minimum percent of HP a Bloodmage must have
to use a skill while the last option is set to 'false':
- Simply change the number on line 175
---

To edit configuration in an event/script:
( note: in each of these, <v> will represent the ID
  of the actor, class, or skill being spoken of, or
  value for the config option being spoken of )
  ---
To add an actor to the Bloodmages list:
- $game_system.wcw_bloodusers.push <v>
To remove an actor from the Bloodmages list:
- $game_system.wcw_bloodusers.delete <v>
---
To add a class to the Bloodmages list:
- $game_system.wcw_bloodmages.push <v>
To remove a class from the Bloodmages list:
- $game_system.wcw_bloodusers.delete <v>
---
To add an HP-consuming skill to the Bloodmages list:
- $game_system.wcw_bloodskills.push <v>
To remove an HP-consuming skill from the Bloodmages list:
- $game_system.wcw_bloodskills.delete <v>
---
To add a non-HP-consuming skill to the Bloodmages list:
- $game_system.wcw_dryskills.push <v>
To remove a non-HP-consuming skill from the Bloodmages list:
- $game_system.wcw_dryskills.delete <v>
---
To set Bloodmages to die when they use too much HP:
- $game_system.wcw_blood_die = true
To set Bloodmages to live when they use too much HP:
- $game_system.wcw_blood_die = false
---
To set the minimum percent of health a bloodmage must
have to use a skill when the last setting is 'false':
- $game_system.wcw_blood_limit = <v>
---

Compatibility:
If you find any issues, post them at http://forum.chaos-project.com/.

Credits:
Blizzard, for helping me learn to script, pointing out a bug, and optimizing
code
Fantasist, for getting me to come back to RMXP
Akkrin, for giving me the Blood Mage idea
Myself, for scripting it
Cid, for reporting an error ;)

Enjoy |:]
=end

#----------------------------------------------------------------------------
# * CONFIG (redefinition of Game_System class)
#     Configuration section :)
#----------------------------------------------------------------------------
class Game_System

# Defines getter's and setter's for configuration variables
attr_accessor :wcw_bloodusers, :wcw_bloodmages
attr_accessor :wcw_bloodskills, :wcw_dryskills
attr_accessor :wcw_blood_die, :wcw_blood_limit
# Backs up the old initialize method
alias init_wcw_bloodmage_later initialize

#------------------------------------------------------------------------
# - initialize
# First method called :P
#------------------------------------------------------------------------
def initialize

# This variable stores the ID's of all classes which should consume
# HP over MP.
@wcw_bloodusers = []
# This variable stores the ID's of all actors that act as
# bloodmages, even though their class is not a bloodmage.
@wcw_bloodmages = []

# This variable stores the ID's of all skills which will act as
# bloodmage skills, even if the actor using it isn't a bloodmage
@wcw_bloodskills = []
# This variable stores the ID's of all skills which will not cause
# a bloodmage to lose HP if they use them.
@wcw_dryskills = []

# If this variable is set to "true," bloodmages will be able to kill
# themselves if they use to much HP (it will use more HP than the
# actor has, even if it is not enough for the skill.) If it is
# set to false, they will only be able to use the skills until it
# would put them below $game_system.wcw_blood_limit.
@wcw_blood_die = false
# This number must be set from 1 to 100. It signifies the minimum
# percent of HP an actor must have to use a skill if
# $game_system.wcw_blood_die is set to "false. 0 is default,
# and means the actor can use skills until his HP is 1.
@wcw_blood_limit = 0

    return init_wcw_bloodmage_later

  end

end

#----------------------------------------------------------------------------
# * Bulk of the code (redefinition of some Game_Battler code)
#----------------------------------------------------------------------------
class Game_Battler

# Backs up skill_can_use?(skill_id)
alias skill_can_use_wcw_bloodmage_later skill_can_use? #lol, long name :P

#------------------------------------------------------------------------
# - wcw_is_bloodmage?()
# Checks to see if actor is a bloodmage.
#------------------------------------------------------------------------
def wcw_is_bloodmage?

return self.is_a?(Game_Actor) && (
$game_system.wcw_bloodusers.include?(self.class_id) ||
$game_system.wcw_bloodmages.include?(self.id) )

end

def wcw_bloodmage_applies?(skill_id)
return (wcw_is_bloodmage? && !
$game_system.wcw_dryskills.include?(skill_id)) ||
$game_system.wcw_bloodskills.include?(skill_id)
end

#------------------------------------------------------------------------
# - skill_can_use?(skill_id)
# Checks to see if a skill can be used
#------------------------------------------------------------------------
def skill_can_use?(skill_id)

# Go ahead and pass it on if the actor isn't a bloodmage or the
# skill isn't a bloodskill
unless wcw_bloodmage_applies? skill_id
return skill_can_use_wcw_bloodmage_later(skill_id)
end

# If the actor can die, let them;
if $game_system.wcw_blood_die
return skill_can_use_wcw_bloodmage_later skill_id
# Otherise, ensure that they have enough HP:
else
# Make sure that SP does not affect calculations;
# simplest way to do this an maintain compatibility
old_sp = self.sp
if self.sp < $data_skills[skill_id].sp_cost
self.sp = $data_skills[skill_id].sp_cost
end

# Test for skill the old way, always having enough SP
test = skill_can_use_wcw_bloodmage_later skill_id

# Restore SP
self.sp = old_sp

# Return the answer
return ((self.hp - $data_skills[skill_id].sp_cost) < (self.hp *
($game_system.wcw_blood_limit / 100)) && test)

end

  end
end

#----------------------------------------------------------------------------
# * Code to make sure bloodmages consume HP instead of MP
#----------------------------------------------------------------------------
class Scene_Battle

# Backs up make_skill_action_result
alias make_skill_action_result_wcw_bloodmage_later make_skill_action_result

#----------------------------------------------------------------------------
# - make_skill_action_result(battler=nil)
# Execute skill
#----------------------------------------------------------------------------
def make_skill_action_result(battler = @active_battler)
make_skill_action_result_wcw_bloodmage_later battler
# Reduce HP, and put the SP back where it should be :P
if battler.wcw_bloodmage_applies?
battler.hp -= @skill.sp_cost
battler.sp += @skill.sp_cost
end
@status_window.refresh
end

end


I was looking for 1.73b personally, it's the only release that's worked perfectly for me :(
Spoiler: ShowHide

FenrisHalo

I'm heartbroken  :<_<:

Seriously though, I don't think I have it :(

And Imma getting the whole 7 for free, cuz thats what u GET with a new laptop!
Or will it be free anyway?
<a href="http://plunkit.webs.com/">I have to admit, this looks sweet xD</a>

fugibo

Quote from: FenrisHalo on June 26, 2009, 01:48:29 pm
I'm heartbroken  :<_<:

Seriously though, I don't think I have it :(

And Imma getting the whole 7 for free, cuz thats what u GET with a new laptop!
Or will it be free anyway?


I got a new laptop half a year ago, so I'm fine for now :P

*looks up the cost* Apparently, no, it's still exorbitantly high.

FenrisHalo

"cheaper than vista"? Who the h*ll ever liked Vista? Anyone mind if I call them stoopid? Well, from today onwards, Zepto's offering a free Windows 7 update, so I'll be the last to be :negative:.

I'm off to have no life now, cya ;)
<a href="http://plunkit.webs.com/">I have to admit, this looks sweet xD</a>

omegapirate2000

Quote from: FenrisHalo on June 26, 2009, 01:48:29 pm
I'm heartbroken  :<_<:

Seriously though, I don't think I have it :(

It's fine, thanks for trying though.
Spoiler: ShowHide

fugibo

*checks* No, I don't have that one. I think I only have 1.80 and 1.6x. :(

omegapirate2000

Can you try posting 1.6x?

Sorry, this is like, the only thing stopping me from releasing the second chapter of my game :P
Spoiler: ShowHide

Keyren

hello I have just recorded ^ ^ I have a problem with this script, I set to ID for skill, characters, etc., but when I go to use the skill gives me error on the line 293 type 'NoMethodError' undefined method [] for nil:NilClass. Maybe it's an incompatibility problem? Using the Battle System standard, the Tons of Add-ons, the Advanced Weather, the Climate and Time Complete System, the Zer0_CMS and Full View+Xcam(I'm not sure that the name is because this script is Chinese, in effect, creates a sort of dynamic framing during the battle) I thought that was the cause, but also eliminates changes nothing>__<. Thanks in advance, I hope it's understandable I'm Italian and in some parts I used a translatorxD

Blizzard

April 17, 2012, 10:16:02 am #75 Last Edit: April 23, 2012, 02:06:58 pm by Blizzard
I thought I integrated this script into Tons of Add-ons. If yes, you should use Tons of Add-ons instead.

EDIT:

Quote from: Blizzard on June 26, 2009, 12:09:44 pm
Alternatively you can use G_G's HP Consuming Skill in Tons of Add-ons.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.