Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Skills Help

CraftGeek

Knight
Xy$
0.01
I want to set up a set of skills that will recover 25, 50, and 100 percent of one ally's HP and all allies HP. I'm having trouble figuring out how to do it. Please help.
 
You can use this (taken from my Functions Add-Ons plugin):

JavaScript:
Math.toPercent = function(number, percent) {
        return Number(parseInt(number*(percent/100)));
    };
You can then set hp to 25%, 50%, etc. Calculate the number using base HP/MP, and use percent for the percentage amount, then add/subtract its result. I did this for Otherworld (it's necessary for parts of the game).
 
Last edited:

CraftGeek

Knight
Xy$
0.01
You can use this (taken from my Functions Add-Ons plugin):

JavaScript:
Math.toPercent = function(number, percent) {
        return Number(parseInt(number*(percent/100)));
    };
You can then set hp to 25%, 50%, etc. Calculate the number using base HP/MP, and use percent for the percentage amount, then add/subtract its result. I did this for Otherworld (it's necessary for parts of the game).
Does this go into a plugin? I know nothing of javascript.
 
Does this go into a plugin? I know nothing of javascript.
In which case, you could do one of two things:

1) Put the following in the formula instead:

Code:
b.hp + (b.mhp * (x/100))
x is the percentage you want to heal.

2) Copy and paste the function into a JS text file in the plugins folder, then when you add it to the Plugin Manager, you should be able to use the function in the skill's formula, like so:

Code:
b.hp + Math.toPercent(b.mhp, x)
This would be just a waste, however, as it's just one function (the current version of my Extra Functions Add-On plugin is private at the moment).

EDIT: I forgot that you can copy and paste the method in a Script event command (set to autorun) somewhere at the beginning of the game; it should then be compatible throughout.


Both methods heal a percentage of the target's maximum HP (rounded up a bit). You can also use this format for other damage types. Obviously, the first method is the simplest and most effective for your purposes.


@Mr. Trivel wrote an excellent Damage Formulas tutorial that will help you a great deal.
 
Last edited:

CraftGeek

Knight
Xy$
0.01
In which case, you could do one of two things:

1) Put the following in the formula instead:

Code:
b.hp + (b.mhp * (x/100))
x is the percentage you want to heal.

2) Copy and paste the function into a JS text file in the plugins folder, then when you add it to the Plugin Manager, you should be able to use the function in the skill's formula, like so:

Code:
b.hp + Math.toPercent(b.mhp, x)
This would be just a waste, however, as it's just one function (the current version of my Extra Functions Add-On plugin is private at the moment).

EDIT: I forgot that you can copy and paste the method in a Script event command (set to autorun) somewhere at the beginning of the game; it should then be compatible throughout.


Both methods heal a percentage of the target's maximum HP (rounded up a bit). You can also use this format for other damage types. Obviously, the first method is the simplest and most effective for your purposes.


@Mr. Trivel wrote an excellent Damage Formulas tutorial that will help you a great deal.
Thanks, this really helps. This community has been so helpful and supportive.
 
Top