Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(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.


I'm not sure if I understood you properly. But on the charge tp by damage formula, you can use "this" without qoutes to refer to the current battler receiving the damage.

Otherwise you will need to explain better what are yountrulying to do and on what moment of the battle.

I may take a while to answer you, because my I'm away from my computer 

const isActor = this.isActor()
if(isActor){
// Do your thing
}

My goal is basically the inverse of the player action formula. Basically, if the player receives a critical hit or has their weaknesses exploited they will lose Tp. As well as if the player dodges an attack or resists an elemental attack, they will gain Tp.  (I'm trying to do an SMT style press turn thing were playing well rewards the player but poor performance punishes them).

Not sure if the code below is correct but I thought it be something like this...

const isActor = this.isActor()

if(results.critical){

tpValue += -15

}

return tpValue

No, you can just throw code like this. Javascript need something called "context". So not all codes will work everywhere. Charge Tp By Action and Charge Tp By Damage have different contexts. And because of that I don't think you can use .results the same way. 

If you want to do the inverse, then you can still use the same formula, but identify if the target is an actor or enemy. I will work out something for you, but before that, just clarify me this, to see if I understood you right:

If I'm not wrong, your formula was to let the player/party gain some tp values according to some conditions right? And now, you want for, when the player is being attacked, it loses tp according to the same conditions?

Copy and paste your final formula here, so I can work on it.

Yeah, basically the inverse. If you inflict a critical you gain tp but if you receive a critical you will lose tp. If I use the same formula would it apply to the player if it place it in the Charge Tp By Damage section?

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 tpValue

Basically 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

I'm still working with the code you gave me, but I thought I let you know something I noticed while working with the plugin. When Skill Does not consume Tp is set to true its supposed to only allow skills to be used when a Tp threshold is met but not consume it like it would normally. But whenever I use a skill it consumes Tp like normal. (The Tp is consumed Immediately as the skill is being used, and not as a result of anything so I don't think its the formula doing that, I even removed the note tag when making the gif to make sure it wasn't that.) (Here's the gif of it and an image of my settings.) Don't know if I set something wrong or not.


Thanks for the feedback! I think I fixed that on the new version 1.5.0!

(1 edit)

Its still consuming Tp when I perform skills, though. 

Can you just leave enabled my Eli Book and the Tp System on your plugin manager and see if the problem persists?