No, like I said, different contexts. It will not work. You need a hack into this. You will use the same formula, but on the end of the formula, you will need to identify if the action is being performed by an enemy attacking an actor. If yes, you have to use a script call to give the actor the negative tp and also set the tpValue to 0, so the enemy does not gain any tp. Unless you want the enemy to gain tp. Then you can just not use the line "tpValue = 0". Here is an example with the previous formulas we worked here:
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
}
const isForActor = this.subject().isEnemy() && target.isActor()
if(isForActor){
target.gainSilentTp(-tpValue)
tpValue = 0
}
return tpValueBasically add this into your formula, before the "return tpValue":
const isForActor = this.subject().isEnemy() && target.isActor()
if(isForActor){
target.gainSilentTp(-tpValue)
tpValue = 0
}
Also, you will have to attach your notetag "<ChargeTpByActionFormula: ID/index>" into the enemies too.
Give it some test. If it not work:
- Paste here the exactly formula you are using
- Check if both actors and enemies has the same ChargeTpByActionFormula on their note fields.
- Tell me what is happening

