Skip to main content

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


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.