Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Where did you put this note tag?

 Let's make a test: Create another entry on the formulas, and just put a flat value like

return 10

Then use that formula and see if when you hit someone on battle, you will raise tp by 10. if it raises, then the problem it's not the plugin, but the formula. Can you copy and paste the entire formula for me here? Beause on your screenshot I cannot see the entire formula.

Or send me a sample project replicating the issue on discord so I can try to see what is the problem.

My discord: hakuenstudio

The return 10 formula didn't work either.  I even tried placing it in the ChargeTpByDamageFormula and the then the ChargeTpByActionFormula. Neither of them worked.

It could be a compatibility problem then. I will need a sample project replicaring the issue so I can figure this out. You can add me on discord: hakuenstudio

Upload the project somewhere and send me the link on the discord chat

Okay. Give me a moment.

(2 edits)

For some reason, Discord won't let me long in. I made it available via Itch. I put a password behind it so you can download and see the issue. the password is just password (all lower case.) I made an entirely new sample project with only the neccessary plugins for it to make sure it wasn't a compatibility issue.

Ok, I just downloaded it. You could also just put a link to a google drive or something like that on those cases ^^"'

Oh, I didn't know that. Thanks.

Hi there!

Well, I just tested with your project and everything seems to work just fine. But I think I know what the problem is. I think we both are misunderstood each other. On your answer here, your question was suppose to be set on the Charge Tp By Action, because what you want is:

When an actor inflicts damage on the enemies, the actor gains a custom amount of TP, right? I got that on the first time:

But on your recent reply you told me that:


I totally miss you saying about the Charge Tp By Action Formula note tag, And I'm trying to guide you the wrong way since then. Also, just checked the help file and indeed the note tag for the Charge Tp by Action is missing there.

So: I'm so sorry. Sorry to waste your time =/ It was my mistake :(

  • For what you want, you can use the note tag on the actor field(I updated the help file now):
  • <ChargeTpByActionFormula: test>

And then put the formula on this plugin parameter:


  • The Charge Tp By Damage works for when the actor receives the damage. 
  • The Charge Tp By Action works for when the actor inflicts the damage,

Its alright. Thanks for all the help with this. I used the new note tag and it works but the code you given me has 1 issue. The right value is given when it inflicts a critical hit and exploit a weakness (they don't stack and it appears what takes priority is what's first in the code, but after testing that, I don't think its true) That being said when an attack misses it still gives tp when targeting a weakness instead of subtracting it. I tried making a 2nd formula using that part of the code alone, and while it works. It negates the 1st formula. 



I attempted to just write in the part of the code that subtracts TP and that works just fine but it doesn't take the right value. It just subtracts 5.


Oh, if do you want to stack, then we need to change the formula:

const result = target.result()
const isTargetWeakToElement = BattleManager._action.calcElementRate(target) > 1
let tpValue = 0
if(result.critical){
    tpValue += 30
}
if(result.missed){
    tpValue += -15
}
if(isTargetWeakToElement){
    tpValue += 45
}
return tpValue

The way it was before, it has an order to check. So the first condition that matches, it would run. But now, it will run all conditions and store the amount of tp that each condition provides, and then return the sum at the end.

If you want to combine conditions, you can use something:

(This means: if missed and targe is weak, add XX value)

if(result.missed && isTargetWeakToElement){
tpValue += XX
}

If you want to negate something, like if the target not missed, just add an "!" before the statement:

if(!result.missed)

Now the reason for it to subtract only 5, I don't know... maybe is default behavior of the engine? Or your skill is using 5 tp? Well, give it a shot on the new formula I put, and let me know the results.

Sorry for the late reply but its working fine. Had an issue with the code stacking but I just put the if (result.critical) and the if (isTargetWeakToElement) in one code with an or (||) statement and that fixed it.  One last question. is coding in a resistance and/or immunity worded like if(isTargetResistantToElement) or if(isTargetImmuneToElement)? I tried it and got an error saying its undefined.

Hi there!

There is no specific script for you to check that. But you can check all of this with the calcElementRate we used before. With something like that:

const elementRate = BattleManager._action.calcElementRate(target)
const isTargetWeakToElement = elementRate > 1
const isTargetResistantToElement = elementRate > 0 && elementRate < 1
const isTargetImmuneToElement = elementRate === 0
const isTargetNormalToElement = elementRate === 1
(3 edits)

Thanks, it works perfectly. Again, thank you so much for helping me throughout all of this. The new tp system works like a dream. One last question, because I'm trying to get the penalties to work on the player/actors. Would the code be something like [const result = actor.result()]

essential replacing target (the enemy) with Actor (the player)?

I think this code would be in the charge TP by damage section as that part is about receiving from the enemy.

I tried to do it myself but keep getting the actor as not defined. Even tried using BattleManager.actor().actorid() to see if that would work.