Yanfly Absorption Barrier

Hello Friends. Does anyone use this plug in and can tell me how to add a barrier with something other than flat numbers? That's all I got so far but its ridiculous for balance. I've googled about and looked through the plug in a few times and tried a few different things but to no avail.

To be exact I am just trying to adjust the barrier the same way I calculate damage and healing, which is by using my main stats.

Ty in advance.

(if you know of a different, possibly better, plugin for creating shields/barriers that could also be cool.)
Hello 🙂
Yep it's possible. You just need to put this in skill/item note field:

Code:
<Custom Target Barrier>
   value = FORMULA;
</Custom Target Barrier>

or if there's turns involved:

Code:
<Custom Target Barrier x Turns>
   value = FORMULA;
</Custom Target Barrier x Turns>


However the syntax for the fomula is slightly different.

This is your typical formula syntax:
a.atk → users's attack
b.def → target's defense

and so on...

Instead this is what you'll have:
user.atk
target.def

and so on for each stat you typically use.

So for instance, to create a barrier worth 3 times the caster's defense you'd write:

Code:
<Custom Target Barrier>
   value = user.def * 3;
</Custom Target Barrier>

A problem I can see with this is if you're using decimal multipliers, the end result might not be an integer. Let's say you have 29 DEF and the formula is user.def * 1.5 you might end up with 43.5 barrier points, which isn't great. To prevent this, you can write Math.ceil(FORMULA), to round up the result or Math.floor(FORMULA) to round it down:

Code:
<Custom Target Barrier>
   value = Math.ceil(user.def * 1.5);
</Custom Target Barrier>

The normal skill formula does it by default (although I don't know if it's rounded up or down), so it's not usually needed, but you need it here.

Hope this helped, feel free to ask further questions! 🙂
To prevent this, you can write Math.ceil(FORMULA), to round up the result or Math.floor(FORMULA) to round it down:
Just for thoroughness' sake, you can also use Math.round() to follow typical rounding rules without you having to specify.
Oh, I am ashamed to admit I didn't know that one, it totally makes sense haha... thank you!
Hope this helped, feel free to ask further questions!
Your response is amazing! This is exactly what I was looking for! I had been looking at lunatic mode but could not figure out how to get the value I wanted. Ty so much! 🙂
Just wanted to mention it wouldn't work when I used round but I think that is fine. lol
It's impossible to tell you why without seeing your code.
=
It's impossible to tell you why without seeing your code.
So, I seemed to have fixed it by removing a the capital on round? I'm not fluent so that is mind boggling. Also, the spaces behind the term 'value' seemed to matter. I wish I knew when capitals and spaces mattered. Very confusing. lol
So, I seemed to have fixed it by removing a the capital on round?
My post did not have a capital on round.

Also, the spaces behind the term 'value' seemed to matter.
That doesn't sound like it should, but again, you're still talking about code that no one else can see so it's impossible to tell you if you're right or wrong.

I wish I knew when capitals and spaces mattered.
Capitalization always matters. Spaces never do unless you're inserting them inside of something. e.g. turning it into Math . round () would fail. But spaces around objects and operators don't do anything.
<Custom Target Barrier>
value = Math.ceil(user.def * 1.5);
</Custom Target Barrier>
That doesn't sound like it should, but again, you're still talking about code that no one else can see so it's impossible to tell you if you're right or wrong.
In the original post the second line seems indented to me. I thought this was purposeful. Its also written with a space in the plug in examples.
<Custom Target Barrier>
value = Math.ceil(user.def * 1.5);
</Custom Target Barrier>
That's perfectly fine. Spaces before or after the word value wouldn't make any difference.

I also don't see any reason it would make a difference whether you use Math.ceil() or Math.round() there. The only potential pitfall with round is if you're dividing so you'd have the possibility to erroneously round down to 0.

In the original post the second line seems indented to me. I thought this was purposeful.
It probably was intentional, but it serves no functional purpose, syntactically.

Its also written with a space in the plug in examples.
As I said above, that doesn't matter.
Code:
value=Math.ceil(user.def*1.5);
    value = Math.ceil( user.def * 1.5 );
Both of those lines of code would function identically.
TY Turan! You're the best!

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-absorption-barrier.160154/