HP Barrier Script, Version 1.1 (Updated 10/23/2014)

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Barrier Script, Version 1.1
by bgillisp
Introduction

This script allows you to create a state that will add a barrier to a character. All attacks to the character will hit the barrier instead of their HP, until the barrier falls. Also, barriers can fall due to time running out and will be auto-removed at that point.

Features
Adds a barrier which can be used to protect characters until the barrier falls.

How to Use
-Add the script in the materials section, but below main


-Start a new game to use! If you don't, some of the variables will not exist, and it WILL crash when you add the barrier.


-If you have any battle engines, you may wish to add this below the battle engine script. The script currently works with the default battle engine and Yanfly's, use with other battle engines at your own risk.

-To add a barrier, first add a skill which creates a barrier. Then, in the damage field, set it to HP Restore, and enter in the formula to create the barrier. Then, add the notetag <HP Barrier: Create> in the notebox of the skill or item which creates the barrier. Once you do this, the barrier will last until it runs out of HP.


If you wish the barrier to only last x turns or until the end of battle, you can link the barrier to a state which when the state leaves, the barrier is removed. Directions for that are in the script header.


You can heal your barriers with skills or items too! To do this, set the item or skill to be hp restore, and use the damage formula box to set it up. Then, add the notetag <HP Barrier: Restore> in the notes box to tell it to apply this to a barrier, and not an actor or enemy.


Do not ever use <HP Barrier: Restore> and <HP Barrier: Create> in the same note box. I have no idea what will happen if you do that, as the script is not meant to handle that.


Also, you can set a barrier's max HP to block with the notetag: <HP Barrier MAX: x>, where x is the highest HP you ever want that barrier to have.


Finally, you can make it so that equipment enhances or weakens your barriers, and actors and enemies can have stronger or weaker barriers than the norm. To do this, add the notetag <HP Barrier Modify: x>, where x is the number you want multiplied to the barrier (use 2 to double all barriers, 0.5 to half all barriers, 0 to make no barriers work cast by that person, etc).


Demo
None yet, soon.

Script


Version 1.1, released 10.23.2014:

FAQ

Q: I add the notetag and it didn't work!
A: Spacing is important. Did you remember the space between the : and the number? Also I think it is case-sensitive, so make sure to use caps for HP.


Q: I added an equip tag and now they are casting really huge barriers!


A: I have the script set up to where you post the number that is being multiplied, not the percent. So if you want that new sword to make it so that barriers cast by them are 2.5 times as strong as before, enter in 2.5, not 250.


Q: Why do I keep hearing the canceling sound effect when the barrier is hit? I set it up to use sound effect x instead!


A: I put in a rescue command to call the cancel effect if your sound effect is not found or loaded properly, which will load Cancel2 from the RTP if your file fails to load (this is to avoid it crashing and killing the game if your file ever gets corrupted). Check and make sure you entered in your file name correctly and that the sound effect is in the proper format.


Q: Will you convert this to MV?


A: No. Yanfly beat me to the punch with their excellent absorption barrier script, which has the added advantage of being compatible with all Yanfly scripts. So for that reason I have put the MV conversion of this script on hold, and recommend any MV users use Yanfly's absorption barrier script instead.


Author's Notes
This is now version 1.0! I would like to thank spaceman5 for the idea (and testing), and Zevia, Supernurse, and Ryidamist for the bug catches and posts on the board under Scripts under Development, and anyone else who tested it and didn't post suggestions.


Edit: Version 1.1 is out now. This adds the ability to have the barrier only block part of the damage taken, and also adds the ability to play an animation when the barrier falls. The animation will attempt to play while the battle still goes on, so it works best with ATB systems.


Terms of Use


-Free for use in commercial and non-commercial games with credit given.



Known Bugs:


In Yanfly's engine the bar for the HP of the shield is in an odd place after battles. This is due to how Yanfly rearranged the HP/MP bars. At the moment unsure how to fix and make it still work with the default engine too, so if you use Yanfly you may want to purge all barriers after battles end by linking them to a state which is removed at battle end.


Version 1.1 requires starting a new game, else the game will crash the first time anyone takes damage in a battle.
 
Last edited:

Baddibu

[This Space for Sale]
Veteran
Joined
Sep 24, 2014
Messages
58
Reaction score
7
First Language
German
Primarily Uses
Thats awesome  ;)

Might use it, not sure  :)
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
yeah you put this script : D! 
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
Interesting script.


I might use it for some boss battles. :)


Thanks for the script!
 

Kuro Neko

Veteran
Veteran
Joined
Sep 26, 2013
Messages
173
Reaction score
15
First Language
English
Primarily Uses
I wonder if there's a way to make this:

- X received a Barrier.

- A white bar cover X'x HP Bar, white bar is barrier's HP.

- If X received a hit, white bar decrease.

- If white bar lost all, show a break animation and start decrease HP.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
You can have the barrier over the HP bar with a few edits if you wish. To do that, change line 630, which reads:

draw_gauge(x, y-32, width, barrier_rate, text_color(BGHP_Barrier::Color_bar), text_color(BGHP_Barrier::Color_bar))

To:

draw_gauge(x, y, width, barrier_rate, text_color(BGHP_Barrier::Color_bar), text_color(BGHP_Barrier::Color_bar))

then edit the variable Color_bar to the color for white. However, be advised that due to the way RPGMaker draws HP bars it will overwrite the entire HP bar if you do this, as I could find no way to have it show the HP bar through the white bar (or whatever color you use), without a total re-write of the code to draw HP bars.

If you have Yanfly's, go to line 675 instead, and follow the directions above that line.

All line numbers refer to an unedited version of version 1.01 as well. If you have 1.0, go up 4 lines from what I referred you to. (so 675 becomes 671, etc).

A break animation might be too dependent on people having said animation (though a rescue line might fix that), but if you add an line after line 507 (between the remove_barrier call and the end) and tell it to play the animation you want, it would work. I may try to implement the animation for version 1.1, would be interesting to see if it will work that way.

On another note: Version 1.01 is out! This fixes a bug with creating a barrier and healing at the same time, as well as a bug with equipment which modifies how strong barriers are. Now, you can actually use 0.5, before it was chopping the numbers to the nearest integer (so 0.5 was becoming 0).
 

Sato1999

Yangfly Master(Previously)
Veteran
Joined
Sep 9, 2014
Messages
338
Reaction score
84
First Language
Portuguese
Primarily Uses
RMVXA
Pretty cool!

I will use it.
 

Kuro Neko

Veteran
Veteran
Joined
Sep 26, 2013
Messages
173
Reaction score
15
First Language
English
Primarily Uses
You can have the barrier over the HP bar with a few edits if you wish. To do that, change line 630, which reads:

draw_gauge(x, y-32, width, barrier_rate, text_color(BGHP_Barrier::Color_bar), text_color(BGHP_Barrier::Color_bar))

To:

draw_gauge(x, y, width, barrier_rate, text_color(BGHP_Barrier::Color_bar), text_color(BGHP_Barrier::Color_bar))

then edit the variable Color_bar to the color for white. However, be advised that due to the way RPGMaker draws HP bars it will overwrite the entire HP bar if you do this, as I could find no way to have it show the HP bar through the white bar (or whatever color you use), without a total re-write of the code to draw HP bars.

If you have Yanfly's, go to line 675 instead, and follow the directions above that line.

All line numbers refer to an unedited version of version 1.01 as well. If you have 1.0, go up 4 lines from what I referred you to. (so 675 becomes 671, etc).

A break animation might be too dependent on people having said animation (though a rescue line might fix that), but if you add an line after line 507 (between the remove_barrier call and the end) and tell it to play the animation you want, it would work. I may try to implement the animation for version 1.1, would be interesting to see if it will work that way.

On another note: Version 1.01 is out! This fixes a bug with creating a barrier and healing at the same time, as well as a bug with equipment which modifies how strong barriers are. Now, you can actually use 0.5, before it was chopping the numbers to the nearest integer (so 0.5 was becoming 0).
Huhm... It's really redraw the whole HP bar... And i want HP bar to show under barrier's bar...

Anyway, tested with a new project, the barrier bar really work. But, when i test it with MOG's battle hud EX and ATB, the barrier's bar doesn't show up. A compability problem, maybe?
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
MOg is incompatable with about everything I've noticed, so that's probably it. I unfortunately don't speak the same language as MOG does, so I can't read his directions well enough to write a patch. Does it show if you put my script under MOG's?

And yes, to get the HP bar to show under the barrier that requires a total rewrite of how RPGMaker draws things, as by default it clears the space for the barrier HP bar as it draws it, and it clears everything under it at the same time (same thing with the barrier bar). Maybe someone could write it so that it only clears the space it needs, but that is beyond what I can do at the moment (maybe in a couple months...I'm still learning).
 
Last edited by a moderator:

Kuro Neko

Veteran
Veteran
Joined
Sep 26, 2013
Messages
173
Reaction score
15
First Language
English
Primarily Uses
MOg is incompatable with about everything I've noticed, so that's probably it. I unfortunately don't speak the same language as MOG does, so I can't read his directions well enough to write a patch. Does it show if you put my script under MOG's?

And yes, to get the HP bar to show under the barrier that requires a total rewrite of how RPGMaker draws things, as by default it clears the space for the barrier HP bar as it draws it, and it clears everything under it at the same time (same thing with the barrier bar). Maybe someone could write it so that it only clears the space it needs, but that is beyond what I can do at the moment (maybe in a couple months...I'm still learning).
Nope. Of course i tested it above and below MOG, too.

AFAIK, the MOG's battle hud EX use an image for hp bar instead of RPG Maker's default draw. Because of that, i tried your script in hope the hp bar's not the default so it won't be cleared, but the barrier's bar cleared lol :D
 

OM3GA-Z3RO

Wounded Seraphim
Veteran
Joined
Nov 19, 2013
Messages
826
Reaction score
181
Primarily Uses
Nope. Of course i tested it above and below MOG, too.

AFAIK, the MOG's battle hud EX use an image for hp bar instead of RPG Maker's default draw. Because of that, i tried your script in hope the hp bar's not the default so it won't be cleared, but the barrier's bar cleared lol :D
MOG's battle hud uses a custom HP bar that should be located under pictures or whatever, I am actually interested myself about this script and I wish to use it for my game for a type of tank role, guess I will be doing some experimenting to try and get this to work on MOG, I don't need the Barrier HP bar to display I just need the mechanic to work. XD

Definitely gonna try this cool script     BD   :thumbsup-right:

Interesting question here: IF I manage to get this to work on MOG Battle HUD Script, is there a way to configure the Barrier to block out only a certain percent of the damage?

Example: Barrier receives 75% of the damage while the user only receives 25% of the damage

Is that possible?
 
Last edited by a moderator:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
The mechanics should work on any system as long as they didn't overwrite the battle engine (I aliased it), and even if they do, if you put it below their script it should still work. The only problem with MOG is having it display the HP of the barrier that I know of.

As for percentages, I don't have it that way, though it might be doable in a future version. Right now you could use Yanfly's lunatic states to achieve that, though it would have no barrier to block, it would just block that percentage until the state ended, regardless of damage taken. Hmmmm....I'll see what can be done, though it will be a week or two before I can attempt this most likely.
 
Last edited by a moderator:

Kuro Neko

Veteran
Veteran
Joined
Sep 26, 2013
Messages
173
Reaction score
15
First Language
English
Primarily Uses
MOG's battle hud uses a custom HP bar that should be located under pictures or whatever, I am actually interested myself about this script and I wish to use it for my game for a type of tank role, guess I will be doing some experimenting to try and get this to work on MOG, I don't need the Barrier HP bar to display I just need the mechanic to work. XD

Definitely gonna try this cool script     BD   :thumbsup-right:

Interesting question here: IF I manage to get this to work on MOG Battle HUD Script, is there a way to configure the Barrier to block out only a certain percent of the damage?

Example: Barrier receives 75% of the damage while the user only receives 25% of the damage

Is that possible?
As i said earlier, this script work on MOG, as long as it below the MOG's. The only problem i've encountered is, i want to show the barrier bar to let the player know when will the barrier break.
 

JoePro

None Newb
Veteran
Joined
May 29, 2014
Messages
78
Reaction score
17
First Language
English
Primarily Uses
Great script! :D
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Thanks everyone. I was sick last week so progress halted for a week, got a script request to do first but will try to add features after the request is taken care of.

In the meantime, has anyone tested this with Luna Engine? I can't imagine any issues as I aliased 99% of my methods, the only forseeable is if you use Yanfly due to how the HP barrier bar is drawn, and I also did overwrite how Yanfly did damage pop-ups to add in the pop-up for the barrier damage. Otherwise, it *should* work, but would like it confirmed if anyone has tried it yet.
 

SpacemanFive

Meteor Mage
Veteran
Joined
Jun 25, 2013
Messages
207
Reaction score
24
First Language
English
Primarily Uses
RMMZ
I hope you're feeling much better, and that the request goes well! (And isn't too stressful.)

I'll be testing the current version of the script the next chance I get, although I don't know if I'll be able to test it with the Luna Engine. I'll let you know if I can.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Interesting question here: IF I manage to get this to work on MOG Battle HUD Script, is there a way to configure the Barrier to block out only a certain percent of the damage?

Example: Barrier receives 75% of the damage while the user only receives 25% of the damage

Is that possible?
Now doable with version 1.1 Add a notetag to the skill which tells it to block 0.75 of the damage taken.

I wonder if there's a way to make this:

- If white bar lost all, show a break animation and start decrease HP.
Animation added with version 1.1. Default is powerdown 4, but any in the database can be used. By default the animation feature is turned off as it works best with ATB systems the way it is implemented, but you can turn it on in the editable region.
 

OM3GA-Z3RO

Wounded Seraphim
Veteran
Joined
Nov 19, 2013
Messages
826
Reaction score
181
Primarily Uses
OMG you actually did it, this is so awesome, now my 2nd tank character can have a unique tank style.

Good job!
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Thanks! Work just got a little busy and will be until the semester ends (I'm a college teacher, so sometimes grading slows down scripting), but I'm still keeping an eye on this and trying to add ideas as they flow in.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
It's kind of giving the wrong info on the top. This script is using a "skill" to create the HP Barrier, not a "state".
It will be more useful and flexible if it were a state, eg, have an equipment that applies a state whenever it's worn.
This will allow the creation of armours/shields which acts as extra HP for the user. eg, sci-fi robot armour, the user can not be harmed until the robot's HP reaches 0, the robot remains after its HP reaches 0, and can be repaired by item/skill.
Your script has everything for that to works except it requires a skill instead of a state to work.

Can you please release a version that uses states instead of skill to create the barrier? Or, if possible, direct apply barrier when certain armour/shield is being equipped?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,863
Messages
1,017,053
Members
137,571
Latest member
grr
Top