Skills costs 1 TP, but want to reset TP to 0 after use

D_Ray

Villager
Member
Joined
Aug 25, 2014
Messages
20
Reaction score
2
First Language
English
Primarily Uses
It's probably something simple that I am missing as always...but I am looking to let the actor use a skill for 1 TP, but it will then reset their TP to 0 after it executes. The idea is to convert all TP to Health. I do have it working except it is only dropping their TP by 1(of course). I saw an option where I could gain a specific amount of TP, but not an option to lower it(preferably by a percentage of 100%). Anyone know of a way to achieve this? Thanks in advance.
 

Fernyfer775

Veteran
Veteran
Joined
Oct 6, 2013
Messages
1,317
Reaction score
818
First Language
English
Try this:

a.gainTp(-100); damage/healing formula here

or:

a.gainTp(-a.tp*100); damage/healing formula here
 

D_Ray

Villager
Member
Joined
Aug 25, 2014
Messages
20
Reaction score
2
First Language
English
Primarily Uses
Try this:

a.gainTp(-100); damage/healing formula here

or:

a.gainTp(-a.tp*100); damage/healing formula here

So, neither of those worked, but I modified what you gave me after I saw what I should/could be putting in there. I have it working 99% of the time. The only issue I have is that it shows 0 during the heal animation, but I am getting restored by exactly what I expect(TP built up). This is using the Battle Test using the Troop section. Could that be it? I included a screenshot of what the skill looks like.
 

Attachments

  • SelfHeal.PNG
    SelfHeal.PNG
    99 KB · Views: 8

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
811
Reaction score
353
First Language
English
Primarily Uses
N/A
try:
a.tp += amount; rest of formula;

or:
a.tp -= amount; rest of formula;
 

D_Ray

Villager
Member
Joined
Aug 25, 2014
Messages
20
Reaction score
2
First Language
English
Primarily Uses
try:
a.tp += amount; rest of formula;

or:
a.tp -= amount; rest of formula;

a.gainHp(a.tp); a.gainTp(-100); is the current working formula minus the fact that it says I gained 0 health. I tried putting both versions you suggested and they both give me a webkit thing saying amount is not defined. So I swapped amount with 10 and it still gives the same result. My character gets healed, but does not show by how much.

Edit: Ok, so I figured out that the reason 0 is showing is because of the last statement in the formula a.gainTP(-100); returns 0(tp - 100 is zero). If I put '10;' after that statement, that is the value that is shown during the heal. Is there a way to create a temp variable in the formula, assign it to current tp, then put that variable at the end of the formula so it correctly shows how much tp->hp the character gained? I am probably overthinking this by a lot. I thought I could just do a var Gained, variable, but it didn't like that.
 
Last edited:

SwiftSign

Veteran
Veteran
Joined
Aug 5, 2015
Messages
184
Reaction score
45
First Language
English
Primarily Uses
RMMV
It says zero because the last part of the formula is the damage control. I don't have time to test this, and can't say I'm any expert, but try...

var = user.tp; a.gainTP(-100); var
 

D_Ray

Villager
Member
Joined
Aug 25, 2014
Messages
20
Reaction score
2
First Language
English
Primarily Uses
It says zero because the last part of the formula is the damage control. I don't have time to test this, and can't say I'm any expert, but try...

var = user.tp; a.gainTP(-100); var

Nah, no luck with that either. It is looking for an '=' according to the syntax error. This is frustrating because I feel like the answer is going to be so simple.
 

Riff

Eorzean
Veteran
Joined
Oct 25, 2015
Messages
267
Reaction score
86
First Language
English
Primarily Uses
RMMZ
It says zero because the last part of the formula is the damage control. I don't have time to test this, and can't say I'm any expert, but try...

var = user.tp; a.gainTP(-100); var

Hello!

Do be careful though with capitalisations. It's a.gainTp(x), not a.gainTP(x). If I recall correctly, you can also use a.setTp(0) to empty user's TP.

Alternatively, if you are using Yanfly's Skill Core (Link here: http://yanfly.moe/plugins/en/YEP_SkillCore.js), you can try using this Lunatic Code for your skill:

<After Eval>
user.setTp(0)
</After Eval>

Just set your damage/healing formula to a.tp for the healing part.

I think you can also set your skill TP Gain to 0. If you still gain TP, it might be caused by some plugins, such as Yanfly's Enchanced TP.

Hope that helps!

- Riff
 

D_Ray

Villager
Member
Joined
Aug 25, 2014
Messages
20
Reaction score
2
First Language
English
Primarily Uses
Hello!

Do be careful though with capitalisations. It's a.gainTp(x), not a.gainTP(x). If I recall correctly, you can also use a.setTp(0) to empty user's TP.

Alternatively, if you are using Yanfly's Skill Core (Link here: http://yanfly.moe/plugins/en/YEP_SkillCore.js), you can try using this Lunatic Code for your skill:

<After Eval>
user.setTp(0)
</After Eval>

Just set your damage/healing formula to a.tp for the healing part.

I think you can also set your skill TP Gain to 0. If you still gain TP, it might be caused by some plugins, such as Yanfly's Enchanced TP.

Hope that helps!

- Riff


I do have the Skill Core. I tried doing the After Eval and it didn't work. Tried it with a semi colon as well just in case. The damage/healing formula to a.tp worked at least. Appreciate the help from everyone thus far.
 

D_Ray

Villager
Member
Joined
Aug 25, 2014
Messages
20
Reaction score
2
First Language
English
Primarily Uses
Hello!

Do be careful though with capitalisations. It's a.gainTp(x), not a.gainTP(x). If I recall correctly, you can also use a.setTp(0) to empty user's TP.

Alternatively, if you are using Yanfly's Skill Core (Link here: http://yanfly.moe/plugins/en/YEP_SkillCore.js), you can try using this Lunatic Code for your skill:

<After Eval>
user.setTp(0)
</After Eval>

Just set your damage/healing formula to a.tp for the healing part.

I think you can also set your skill TP Gain to 0. If you still gain TP, it might be caused by some plugins, such as Yanfly's Enchanced TP.

Hope that helps!

- Riff


Never mind, it did work using Yanfly Skill Core. Apparently it doesn't when using Troops, but it worked in the main game. Ugh. Thanks to everyone who helped me out!
 

Latest Threads

Latest Profile Posts

Snarkyfork wrote on Trihan's profile.
Hey man, I saw you mention that you do MV javascript work? Just wanted to confirm it before I put you on speed dial. =)
"Man is made by his belief. As he believes, so he is."-Krishna
FastFood in my country is neither fast nor cheap like it's expected to be, but people still buy a lot of it. I don't want to imagine how much of it people would eat if it was.
Started finishing up my bosses and characters...I don't know how long...but its going to take long...

I ended up needing to do a chapter one world map remake. It's still WIP but coming along nicely. =D

Forum statistics

Threads
107,757
Messages
1,031,930
Members
139,900
Latest member
CGI_ERICYT
Top