Lecode Tactical Battle System 0.77.2B

I got an error, when entering a battle. Here it is:
error.png

I'll also provide my note tags:
Spoiler: Actor Notetag
<letbs_sprite>

pose(idle): use_chara

pose(dead): use_chara

turn_order: auto

status_sprite: auto

</letbs_sprite>



<letbs>

move_points: 6

</letbs>
Spoiler: Enemy notetag
<letbs_sprite>
pose(idle): use_chara, $Goblin01, 0
pose(dead): use_chara, $Goblin01, 0
turn_order: auto
status_sprite: auto
</letbs_sprite>
Also, the console log.
Spoiler: Console Log
Code:
rpg_managers.js:1949 TypeError: Cannot read property 'pose' of undefined
    at TBSEntity_Sprite.getConfig (LeTBS.js:10038)
    at TBSEntity_Sprite.createBitmaps (LeTBS.js:9797)
    at TBSEntity_Sprite.initialize (LeTBS.js:9729)
    at TBSEntity_Sprite.initialize (LeTBS_DamagePopupEX.js:101)
    at TBSEntity_Sprite.initialize (LeTBS_RTPUse.js:105)
    at new TBSEntity_Sprite (LeTBS.js:9715)
    at TBSEntity.createSprite (LeTBS.js:8629)
    at TBSEntity.initialize (LeTBS.js:8621)
    at new TBSEntity (LeTBS.js:8581)
    at Function.BattleManagerTBS.placeNextEnemy (LeTBS.js:2432)
SceneManager.catchException @ rpg_managers.js:1949
How do i fix that?😢
Does anyone happen to have a copy of Pharonix Le_PHX mod that has to do with terrain costs or height? I was unable to find any working links for this, nor any real leads as to how to associate region ids with movement cost.
Does anyone happen to have a copy of Pharonix Le_PHX mod that has to do with terrain costs or height?
Do you where it would have been located?
Is it this one
I don't know if it was ever linked. It appears that it may have been, but the attachment just leads to a broken image.


Right now I am looking through LeTBS.js to see if there is anything already there I can work with, but I am not really sure where to even get started. I did find this when going through the easystar.js file which seems to be exactly what I am looking for, but I do not know how to implement it.

Code:
        this.setAdditionalPointCost = function (x, y, cost) {
            pointsToCost[x + '_' + y] = cost;
        };

        this.setTileCost = function (tileType, cost) {
            costMap[tileType] = cost;
        };
i get this error when i try to start a battle, no clue what i'm doing wrong

edit: turns out the problem was that i wrote the plugin command as "LeTBS On" rather than "LeTBS ON" WHICH IS A VERY ANNOYING ERROR.
tho now i've got a different issue where it says "cannot read property apply of undefined".
i get this error when i try to start a battle, no clue what i'm doing wrong

edit: turns out the problem was that i wrote the plugin command as "LeTBS On" rather than "LeTBS ON" WHICH IS A VERY ANNOYING ERROR.
tho now i've got a different issue where it says "cannot read property apply of undefined".
If you are getting undefined errors, it means there is something wrong with your settings. Start a project from the demo, and when making new characters, classes, etc., copy the pre-built options and look to see what everything referenced inside refers to.

For example, this is the code inside one of the skills in my game. The sequence MatchlockShoot needs to be defined in LeTBSConfig.js

In skill "Matchlock Shoot" notetags:
<letbs>
scope: circle(1)
scope_select: enemies
sequence: MatchlockShoot
</letbs>

In LeTBSConfig.js:

"MatchlockShoot": [
"play_pose: user, idle768, idle768",
"wait: 5",
"play_pose: user, MatchlockShoot, idle768",
"wait: 15",
"directional_anim: user, user, 450, 451, 452, 453",
"effects: {aoe}_battlers, current_obj, obj_anim",
"wait: 25",
"play_pose: user, idle, idle",
"wait: 5"
],

Every sequence needs a match. The same is true for poses, sprites, etc.
Since idle768, MatchlockShoot, and idle are all referenced, you need a matching spritesheet for each, as well as how many frames each animation has inside the actor notebox.

In the actor notebox:
<letbs_sprite>
pose(idle): _idle768, 1
pose(idle768): _idle768, 1
pose(MatchlockShoot): _MatchlockShoot, 19
</letbs_sprite>

Spoiler: full LeTBS actor notebox for one of my actors
<letbs_sprite>

frame_delay: 10

pose(block): _block, 1

pose(downed): _crit, 1

pose(dead): _dead, 1

pose(evaded): _idle, 1

pose(hit): _idle, 1

pose(block): _block, 1

pose(cast): _cast, 14



pose(idle): _idle768, 1

pose(idle768): _idle768, 1

pose(move): _move, 32



pose(MatchlockShoot): _MatchlockShoot, 19
pose(BambooStaffSlash): _BambooSlash, 12
pose(LampLighterSlash): _LampLightSlash, 12



pose(CaladbolgSlash): _CaladbolgSlash, 12
pose(FlambergeSlash): _FlambergeSlash, 12
pose(AncientSwordSlash): _AncSwordSlash, 12
pose(ZweihanderSlash): _ZweihanderSlash, 12
pose(ClaymoreSlash): _ClaymoreSlash, 12



pose(DragonslayerAxeSlash): _DragonAxeSlash, 12
pose(ExecutionerAxeSlash): _ExecutAxeSlash, 12
pose(DoubleAxeSlash): _DoubleAxeSlash, 12
pose(BattleAxeSlash): _BattleAxeSlash, 12

</letbs_sprite>

<letbs>
move_points: 5
</letbs>

<letbs_commands>
move 82, skills 64, scan 75, pass 74
</letbs_commands>


<Letbs_Scan_Text>
Assassin
</Letbs_Scan_Text>

<Letbs_Scan_Options>
show_stats: true
</Letbs_Scan_Options>

the 19 associated with MatchlockShoot refers to how many frames are in the animation. I also need a matching spritesheet found inside LeTBS_0772B\img\leTBS\Battlers for every actor that will use this skill and has the pose defined in the actor notebox. Same with every other pose that is defined in the actor notebox.

Skills call sequences, sequences call poses, poses are defined in actor notebox, and are .png files inside the leTBS\Battlers folder.

For my character named AssassinM2, the file is called: AssassinM2_MatchlockShoot.png See image to see how it is set up for 19 frames:
1710370059618.png



Use the guide here to help understand how everything works, and only change things from the demo one at a time so you can see what is wrong if anything: https://lecodemv.github.io/leTBS/old/home.html

If you forget to put the required info in, you will get a crash like this. But the plugin does work as long as user error is avoided. There are a few things that could be better optimized, but crashes result in 99.9% of cases from not following the instructions to the letter.


-----

One thing I also wanted to add for those still working with this plugin, there is a bug where if you have multiple skill types, and exit from the 2nd or 3rd on your command list while in battle, it returns you to the first skill type rather than the active one. This is because the function Window_TBSCommand.prototype.selectLast = function found within LeTBS_Commands.js calls this.selectSymbol(last);, but does not differentiate between multiple skilltypes. It simply resets to the first.

I was able to fix this error by changing the code to the following:

JavaScript:
Window_TBSCommand.prototype.selectLast = function () {
 
if (this._lastBattler !== null && this._battler !== this._lastBattler) {
this.select(0);
}
 if (this._battler) {
        this._lastBattler = this._battler
}
    /*      // old code commented out
    this.select(0);
    if (this._battler) {
        var last = this._battler.lastCommandSymbol();
        if (last !== "pass")  //lastCommandSymbol never = pass, so this is always called
            this.selectSymbol(last);  //calls first skill type instead of active skill type
    }
    */

 };

This removes the selectSymbol(last) function and instead relies on the default MV cursor memory instead. I originally just commented out this whole section, but encountered crashes when changing turns while actor 1 had more command options than the next actor in the turn order, due to wanting to reset to a non-available command # in the list of available commands.

This script instead resets the cursor to the first slot for the next actor when a new turn begins, and keeps the cursor memory until that point.

Happy coding
Found another bug that really should be fixed for anyone hoping to make a game using this plugin. Essentially, when canceling out of the move command, the path you preview is saved and referenced by the enemy AI during their next turn. This allows the AI to walk through obstacles and bypass the move limit they are restricted to. The AI will also send this unit along the same path that the player previewed. Fortunately, this was an easy enough fix.

In LeTBS.js find the following function:

JavaScript:
BattleManagerTBS.onMoveCancel = function () {
    this._subPhase = "";
    this.getLayer("scopes").clear();
    this.clearMoveSelection();
    this._moveScope = {};
    var cell = this.activeEntity().getCell();
    this.setCursorCell(cell);
    Input.clear();

    SoundManager.playCancel();
};

Replace this._moveScope = {}; with

JavaScript:
//    this._moveScope = {};
    this._movePath = null;
How do you make it so an attack repeats 2 times?
How do you make it so an attack repeats 2 times?
In LeTBSConfig.js, find the sequence that is called by your skill. Make sure this line is entered in twice:
"effects: {aoe}_battlers, current_obj, obj_anim",

Example:

Code:
"doublehit": [
"play_pose: user, atk",
"wait: 10",
"effects: {aoe}_battlers, current_obj, obj_anim",
"wait: 3",
"effects: {aoe}_battlers, current_obj, obj_anim",
"wait: 3",
"wait: 60"
],
Hello, I don't know if you can help me, but here it is:

I wanted to implement an action point system using magic points that are restored to 100% each turn. However, the AI would only attack once per turn despite their action points. So I changed:

json
Copier le code
"after_offense": [
"if: canUseOffense()",
"call_behavior: use_offense",
"else",
"if: canUseEscape()",
"call_behavior: escape",
"else",
"if: pattern('ranged_fighter')",
"call_behavior: smart_move_away_enemies",
"else",
"if: !isInMeleeWith('defined_target')",
"move: toward_enemies, 100%",
"endif",
"endif",
"endif"
]

To ensure that if they can still use an offensive attack, they do so. However, when I use an invocation like the fire chicken or a dog with the same effects, it bugs and explodes in a loop. I removed the AI control to see what would happen. I moved it, made it explode, and I could still play its turn. I can skip the turn, but if I make the mistake of moving with its remaining movement points, the game freezes.

Do you have any idea how to fix this? A way to force it to end its turn after the attack, or remove its movement points? I tried but I don't know how to code and my attempts have failed.

Thank you!

Do you know if it is possible to show ennemis move point in battle ?
up
Still working on my project if someone know how to help me
Hey there. I was wondering how to use sprite sizes of 96x96 instead of the default. When I try to use sprites in this resolution, it glitches out the sprite. Is there anywhere in the code I can edit what resolution it accepts?
如果有人想取消三角策略的「後續攻擊」機制,那就別再恐慌了!
If anyone wants to recreate Triangle Strategy's "Follow-up Attack" mechanic, look no further! I just finished debugging it and can safely say it's fully working now! 😀

First, we'll need to put Lecode.S_TBS.OpportunityActive = false; right after line 750 or so (where you see all the "//Divider:" stuff. Next, we add some stuff to onPrimarySequenceEnd() but the line w/ processCounterAttack() can be ignored unless you'd also like to use my Counter mechanics.
JavaScript:
BattleManagerTBS.onPrimarySequenceEnd = function (seqMng) {
    var entities = LeUtilities.uniqArray(seqMng._affectedTargets);
    this.processCounterAttack(entities, seqMng.getUser(), seqMng._action);
    if (Lecode.S_TBS.OpportunityActive == false) {
        this.processOpportunityAttack(entities, seqMng.getUser(), seqMng._action);
    }
};
…and here's the bulk of the code:
Spoiler: lotta code
JavaScript:
BattleManagerTBS.processOpportunityAttack = function (targets, subject, action) {
    if (!action) return;
    targets.forEach(function (entity) {
        var unitDown = BattleManagerTBS.getEntityAt(entity.getCell().x, entity.getCell().y + 1);
        var unitLeft = BattleManagerTBS.getEntityAt(entity.getCell().x - 1, entity.getCell().y);
        var unitRight = BattleManagerTBS.getEntityAt(entity.getCell().x + 1,entity.getCell().y);
        var unitUp = BattleManagerTBS.getEntityAt(entity.getCell().x, entity.getCell().y - 1);
      
        this.setCursorCell(entity.getCell());
        if (subject.getDir() == 2 && entity && unitDown) {
            var skill = $dataSkills[unitDown.battler().attackSkillId()];
            if (unitDown.getDir() != 2 && unitDown.battler().luk > entity.battler().luk) {
                Lecode.S_TBS.OpportunityActive = true;
                entity.battler().clearResult();
                unitDown.lookAt(entity.getCell());
                unitDown.addTextPopup("Opportunity");
                //entity.startSequence("counter");
                this.forceAction(skill, unitDown);
            }
        }
        if (subject.getDir() == 4 && entity && unitLeft) {
            var skill = $dataSkills[unitLeft.battler().attackSkillId()];
            if (unitLeft.getDir() != 4 && unitLeft.battler().luk > entity.battler().luk) {
                Lecode.S_TBS.OpportunityActive = true;
                entity.battler().clearResult();
                unitLeft.lookAt(entity.getCell());
                unitLeft.addTextPopup("Opportunity");
                //entity.startSequence("counter");
                this.forceAction(skill, unitLeft);
            }
        }
        if (subject.getDir() == 6 && entity && unitRight) {
            var skill = $dataSkills[unitRight.battler().attackSkillId()];
            if (unitRight.getDir() != 6 && unitRight.battler().luk > entity.battler().luk) {
                Lecode.S_TBS.OpportunityActive = true;
                entity.battler().clearResult();
                unitRight.lookAt(entity.getCell());
                unitRight.addTextPopup("Opportunity");
                //entity.startSequence("counter");
                this.forceAction(skill, unitRight);
            }
        }
        if (subject.getDir() == 8 && entity && unitUp) {
            var skill = $dataSkills[unitUp.battler().attackSkillId()];
            if (unitUp.getDir() != 8 && unitUp.battler().luk > entity.battler().luk) {
                Lecode.S_TBS.OpportunityActive = true;
                entity.battler().clearResult();
                unitUp.lookAt(entity.getCell());
                unitUp.addTextPopup("Opportunity");
                //entity.startSequence("counter");
                this.forceAction(skill, unitUp);
            }
        }
    }.bind(this));
};
Lastly, you'll need to add Lecode.S_TBS.OpportunityActive = false; to the onTurnEnd() function.
JavaScript:
TBSEntity.prototype.onTurnEnd = function () {
    Lecode.S_TBS.OpportunityActive = false;
    this._battler.onTurnEnd();
    this.addPopup();
    this._battler.clearResult();
    this.setMovePoints();
    this._turnPlayed = true;
    this._movePerformed = false;
    this._actionPerformed = false;
};



Btw, does anyone know how to get the AI to try to attack from behind more often?

Hey bro! How did you turn the battle menu into a ring shape? I've been trying for a long time but haven't been able to make it work. I hope you can share some advice.

如果有人知道如何幫助我,仍在進行我的項目
抱歉,我的英文不是很好,所以我不太明白你的意思。 「one_time_move」標籤也許可以幫助您。

Hello, I don't know if you can help me, but here it is:

I wanted to implement an action point system using magic points that are restored to 100% each turn. However, the AI would only attack once per turn despite their action points. So I changed:

json
Copier le code
"after_offense": [
"if: canUseOffense()",
"call_behavior: use_offense",
"else",
"if: canUseEscape()",
"call_behavior: escape",
"else",
"if: pattern('ranged_fighter')",
"call_behavior: smart_move_away_enemies",
"else",
"if: !isInMeleeWith('defined_target')",
"move: toward_enemies, 100%",
"endif",
"endif",
"endif"
]

To ensure that if they can still use an offensive attack, they do so. However, when I use an invocation like the fire chicken or a dog with the same effects, it bugs and explodes in a loop. I removed the AI control to see what would happen. I moved it, made it explode, and I could still play its turn. I can skip the turn, but if I make the mistake of moving with its remaining movement points, the game freezes.

Do you have any idea how to fix this? A way to force it to end its turn after the attack, or remove its movement points? I tried but I don't know how to code and my attempts have failed.

Thank you!


<letbs>
scope: circle(4,2)
sequence: ghost_arrow
scope_options: through_obstacles

pass_on_use //this tag

</letbs>

Set in skills
<letbs>
scope: circle(4,2)
sequence: ghost_arrow
scope_options: through_obstacles

pass_on_use //this tag

</letbs>

Set in skills
thank you for your help, I figured out how to fix it
I still have problem to see ennemis move points and make them attack more than 1 time per turn
Is this plugin finished? Is it usable or still in development?
Is this plugin finished? Is it usable or still in development?
Not finish and probably not still in development
But yes, it is usable and amazing
how do i give an enemy multiple turns? i want to make a 4v1 boss but the boss only having one turn severely weakens him.
Guys, I'm doing a project for Android. The plugin works well, but the game freezes when AI is thinking. Someone foun or implemented a fix for the AI delay freeze?
Anyway for a skill's scope to only target those with a certain state? PHX mod isn't working for me.

Original thread: https://forums.rpgmakerweb.com/threads/lecode-tactical-battle-system-0-77-2b.71572/