Hi, I'm using Lecode's Tactical Battle System and just successfully implemented an Action XP Gain system in my project. It works wonderfully (e.g. gaining XP after an attack). However, I'm having trouble getting a popup to show above the actor to show how much XP was gained from that action. The plugin command "LeTBS ShowPopup" doesn't work because apparently it was a WIP plugin and so that feature was never fully imlpemented. Luckily, I think I've found an alternate solution. I noticed that when a unit counterattacks, a popup shows up that says "Counter". So I looked into the code and found this:
Basically, the
I get the following error:
It's probably because the 1st half of
So I tried
JavaScript:
BattleManagerTBS.processCounterAttack = function (targets, subject, action) {
if (!action) return;
this.setCursorCell(subject.getCell());
targets.forEach(function (entity) {
if (entity) {
var dist = LeUtilities.distanceBetweenCells(subject.getCell(), entity.getCell());
if (dist <= 1 && Math.random() < action.itemCnt(entity.battler()) && action.isPhysical()) {
var skill = $dataSkills[entity.battler().attackSkillId()];
entity.battler().clearResult();
entity.lookAt(subject.getCell());
entity.addTextPopup("Counter");
entity.startSequence("counter");
this.forceAction(skill, entity);
}
}
}.bind(this));
};
.addTextPopup() function is what I'm looking for. However, when I try to use it in the <Custom Establish Effect> notetag in my Action XP Gain state, nothing happens. I'm sure it's because my syntax is incorrect. This is what my code looks like:
JavaScript:
<Custom Establish Effect>
if (user.isActor() && target.result()) {
if (target.isEnemy() && target.result().hpDamage > 0) {
var XP = (Math.min(target.result().hpDamage, target.oldHp) / target.mhp) * target.exp();
user.gainExp(XP);
BattleManagerTBS.entity.addTextPopup(XP);
}
}
</Custom Establish Effect>
TypeError: Cannot read property 'addTextPopup' of undefinedIt's probably because the 1st half of
BattleManagerTBS.entity.addTextPopup(XP); is incorrect. I just can't figure out what it's supposed to be. I also looked into LeTBS_DamagePopupEX.js for the .addTextPopup() function, which is the following:
JavaScript:
TBSEntity.prototype.addTextPopup = function (text) {
this._sprite.addTextPopup(arguments);
};
TBSEntity.addTextPopup(XP); as well and got a different error: TypeError: TBSEntity.addTextPopup is not a function