Making items or skills refill more than 100 TP

Sednaiur

Veteran
Veteran
Joined
Jul 7, 2018
Messages
33
Reaction score
9
First Language
German
Primarily Uses
RMMV
Hello.

I like to know how I could let items and skills refill more than 100TP.
This is very important to me, as I like to use a TP-system that requires a lot of TP and they should be refillable by other means than the TP-modes.

I already looked all over my plugins help files (just about every YanFly-plugin there is) but I got nothing out of that, unfortunately.

Help is very appreciated!
 

MrKiwi

No Flying Bird
Veteran
Joined
Feb 24, 2019
Messages
167
Reaction score
1,169
First Language
Spanish
Primarily Uses
RMMV
You relay too much in plugins dude, you can just need to double the item/skill refill effect.

Here's an example of a refilling 200 TP potion (My RPG Maker is in spanish ~.~ but I hope you understand the point)
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,269
Reaction score
1,675
First Language
EN
Primarily Uses
RMMZ
^ That's probably the easiest approach! :kaojoy:

Otherwise, you can probably do this with the gainTp function (script), either in a damage formula:
Code:
b.gainTp(500); 0
...or in another context like, for example, one of the Lunatic Mode notetags from Yanfly's Skill Core plugin:
Code:
<After Eval>
target.gainTp(500);
</After Eval>
 

Sednaiur

Veteran
Veteran
Joined
Jul 7, 2018
Messages
33
Reaction score
9
First Language
German
Primarily Uses
RMMV
@MrKiwi
I may use a lot of plugins, and while I think I understand your opinion in a way, I do not think that the amount of utilized plugins indicates good or bad design. It solely depends on what I do with it and what you have in mind overall. Once I get far enough in development to actually post a project, you may see what I am all about with those plugins. :)

Also, thank you for your suggestion. It honestly suprises me that someting this simple works. I would have thought that it would give still only 100TP this way.
Unfortunately I forgot to mention that I need to utilize the notebox or damage formula for the refill, as I like to use variables for many things and the effects box prohibits me from doing so. But thanks none the less for the information.

@caethyril
Thank you very much for the answer.

I do not quite understand your first suggestion, but maybe you like to explain that further? This one really sounds interesting.
I tried your second suggestion, which works fine. I previously had the idea of using
Code:
<Pre-Damage Eval>
  target.gainTp(500);
</Pre-Damage Eval>
but, well, I used the wrong eval again. :p
 

MrKiwi

No Flying Bird
Veteran
Joined
Feb 24, 2019
Messages
167
Reaction score
1,169
First Language
Spanish
Primarily Uses
RMMV
@Sednaiur
I'm sorry I didn't mean to offend you, I use tons of plugins too, but your question seemed quite simple to solve... now if you needed some formula then its a whole different story and you should stick to caethryl's suggestion on this.

I'll be looking for seeing your project someday :) Good luck.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,269
Reaction score
1,675
First Language
EN
Primarily Uses
RMMZ
@caethyril
Thank you very much for the answer.

I do not quite understand your first suggestion, but maybe you like to explain that further? This one really sounds interesting.
The damage formula can have multiple "lines" of code, separated by semi-colons; the entire formula goes through an eval and only the final line/expression is used for the skill's damage/healing value. It means that if you're using the damage formula at all, you can simply insert an extra "line" in front to add (in this case) some TP to the target! Also, the damage formula is only evaluated when the item hits, but healing items are typically set to Certain Hit anyway~

For example, you could set the item's damage type to Recover HP and put this in the formula box:
Code:
b.gainTp(b.luk); 50
The item should restore TP equal to the target's luck, and also 50 HP because that's the final value of the formula and it's set to Recover HP. :kaopride:

However, there is a downside! When an item is selected for use from the inventory (pause menu), the game runs a "testApply" function to check if it will be used. Unfortunately the default test doesn't check the damage formula at all. :kaoback: In case you're interested, I've quoted the testApply function and a couple it depends upon in the spoiler below.
From rpg_objects.js:
Code:
Game_Action.prototype.testApply = function(target) {
    return (this.isForDeadFriend() === target.isDead() &&
            ($gameParty.inBattle() || this.isForOpponent() ||
            (this.isHpRecover() && target.hp < target.mhp) ||
            (this.isMpRecover() && target.mp < target.mmp) ||
            (this.hasItemAnyValidEffects(target))));
};

Game_Action.prototype.hasItemAnyValidEffects = function(target) {
    return this.item().effects.some(function(effect) {
        return this.testItemEffect(target, effect);
    }, this);
};

Game_Action.prototype.testItemEffect = function(target, effect) {
    switch (effect.code) {
    case Game_Action.EFFECT_RECOVER_HP:
        return target.hp < target.mhp || effect.value1 < 0 || effect.value2 < 0;
    case Game_Action.EFFECT_RECOVER_MP:
        return target.mp < target.mmp || effect.value1 < 0 || effect.value2 < 0;
    case Game_Action.EFFECT_ADD_STATE:
        return !target.isStateAffected(effect.dataId);
    case Game_Action.EFFECT_REMOVE_STATE:
        return target.isStateAffected(effect.dataId);
    case Game_Action.EFFECT_ADD_BUFF:
        return !target.isMaxBuffAffected(effect.dataId);
    case Game_Action.EFFECT_ADD_DEBUFF:
        return !target.isMaxDebuffAffected(effect.dataId);
    case Game_Action.EFFECT_REMOVE_BUFF:
        return target.isBuffAffected(effect.dataId);
    case Game_Action.EFFECT_REMOVE_DEBUFF:
        return target.isDebuffAffected(effect.dataId);
    case Game_Action.EFFECT_LEARN_SKILL:
        return target.isActor() && !target.isLearnedSkill(effect.dataId);
    default:
        return true;
    }
};
You can probably work around this, e.g. by adding & removing a blank state, but I personally prefer the plugin/notetag approach. :kaoswt:

Happy RPG Making! :kaothx:
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
@caethyril - you can also use a TP gain of 0 or run a blank common event to ensure it passes the test :)
 

Sednaiur

Veteran
Veteran
Joined
Jul 7, 2018
Messages
33
Reaction score
9
First Language
German
Primarily Uses
RMMV
@MrKiwi
Do not worry. I have no reason to be offended by your words. Please excuse me if I sounded like that.
I am just inexperienced and still learning much, so I may look rather dumb at times, but I promise that I will improve over time. :p

Also, thank you. I may use this and that kind of luck at times, but I am determined to finish my project, even though, it will take a whole while for me.

@caethyril
What you just eplained to me is indeed some very interesting and useful information. I would never have guessed that one is able to use linebreaks in that damage formula. I just knew that I have to use semicolons to refer to the next line in notetags and the like.
So, if I understand you correctly, I could do something like this:
Code:
b.gainHp(b.mat); b.gainMp(b.atk); b.gainTp(b.luk); b.gainState(13); 100 * a.level
and it would recover HP, MP, TP, cause a state and then heal/deal damage in the end, is it? Edit: In fact, it works, except for the "gainState" part, as it seems to be wrong and I do not know what the right call for it is.
Thank you so much for giving me this insight. You are quite helpful and I like to thank you a lot for this. I shall put this information to good use in the future. ^^

Also, the items I use to charge TP are only meant to be usable inside battle anyways, so this will be no problem.


@Engr. Adiktuzmiko
Thanks for that information. Since I am still at my early stages of experience, I cannot make much out of it now, but it may help me in the future.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,269
Reaction score
1,675
First Language
EN
Primarily Uses
RMMZ
@Sednaiur yes, use b.addState(13) to add a state to the target. ^_^
 

Latest Threads

Latest Posts

Latest Profile Posts

Hi everyone! I've relased a demo about my new game in "Games in Development". Someone interested? :3
Going live at 2pm EST
Today is the day! I will be productive in game dev work! I will - *gets distracted by cat playing with her toy mouse* Awww <3
Whelp. I tried to be productive.
Decided to work on Fandom Scouts today. I've decided that instead of using the generic "scrolling text" event that MV has (I'm using MV for FS, not MZ) I'll use the movie option. I'm still trying to find a way to get Premiere Pro to output the compatible format though. If anyone can give me some help, it would be greatly appreciated!
Barthdry wrote on tln143's profile.
Hello tln143 Welcome to the RPG Maker Forum. We wish you enjoy and make good rpg games

Forum statistics

Threads
109,040
Messages
1,041,557
Members
141,528
Latest member
Munchacha
Top