Making items or skills refill more than 100 TP

Sednaiur

Villager
Member
Joined
Jul 7, 2018
Messages
26
Reaction score
8
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
145
Reaction score
958
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,069
Reaction score
1,488
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

Villager
Member
Joined
Jul 7, 2018
Messages
26
Reaction score
8
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
145
Reaction score
958
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,069
Reaction score
1,488
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,003
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

Villager
Member
Joined
Jul 7, 2018
Messages
26
Reaction score
8
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,069
Reaction score
1,488
First Language
EN
Primarily Uses
RMMZ
@Sednaiur yes, use b.addState(13) to add a state to the target. ^_^
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Haired slime? Trying some different styles of art. Maybe I can make some resources with this new kind of painting.......
i love my game very much
Uh, I'm probably overthinking this, but I think that some of my music sounds kinda...bad?
The melodies are just sort of awkward, and don't flow.
I'm really not sure what to do. Why am I even worrying about this? I don't even have a battle system yet!
And the Lord said, let there be lighting effects! And there were lighting effects! And it was good...ish? Might tweak this some more.
Today was a day of good things! Thank you fate! I pray to the darkness that those that read this will enjoy a good day as well! Power to the gam mak.

Forum statistics

Threads
105,724
Messages
1,015,913
Members
137,402
Latest member
Lopilon
Top