Lecode Tactical Battle System 0.77.2B

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
792
First Language
English
Primarily Uses
RMMV
Could I also just use the normal/default circle(3) but remove these?
"[cx,cy-3],[cx-3,cy],[cx+3,cy],[cx,cy+3]"

Like is there a way to write "minus these scopes"? Cuz I know you can combine scopes, as shown in the documentation: scope: circle(3);line(4)

This would just be for a specific skill, so hard-editing the circle function would affect all skills that use circle(x) right? Unless you meant making a copy of it.
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
Could I also just use the normal/default circle(3) but remove these?
"[cx,cy-3],[cx-3,cy],[cx+3,cy],[cx,cy+3]"

Like is there a way to write "minus these scopes"? Cuz I know you can combine scopes, as shown in the documentation: scope: circle(3);line(4)

This would just be for a specific skill, so hard-editing the circle function would affect all skills that use circle(x) right? Unless you meant making a copy of it.
yes, you would make a copy of it, but then you need to change the name of it
like round(x)
then update a few functions that detect this command,

As of now, there is no "remove these scopes"
I could probably program it in at some point when I get around to it.

If this is for but one skill, the best option would definitely use a custom scope.
 

UniqueName

Veteran
Veteran
Joined
Nov 12, 2018
Messages
64
Reaction score
9
First Language
Russian
Primarily Uses
Other
Hey guys, I just found out that target rate doesnt work in this mod=(
can anything be done to fix this?
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
792
First Language
English
Primarily Uses
RMMV
@Pharonix Hey, does your LTBS extension plugin do something to Counters? Cuz I disabled YEP_X_CounterControl as a test, and I'm still able to counter!

Edit: Actually I realized it was more like...YEP_X_CounterControl was never working to begin with...sigh. Should YEP_X_CounterControl be placed above or below LTBS plugins?

Nvm...tried both, doesn't work.

I really just need Counter Control's ability to set different skills to be used as a counterattack. I currently have it so each weapon sets the counter skill to be the same attack skill it adds. different weapons' attack skills have different damage formula, that's why. I also have a passive skill the player can learn which used the <Evade Counter> tag so that actor would evade the damage when they counter instead of getting hurt, then counterattacking.
 
Last edited:

Verrillion

Villager
Member
Joined
Aug 1, 2016
Messages
17
Reaction score
1
First Language
English
Primarily Uses
Hey I apologize for the persistence, but I just really need to know how to add enemies to a battle, mid battle. I've looked at the demo, I copied it as best I could but I couldn't get it to work, on top of which when I went back and played the demo, it didn't even work so it makes me think there is like a .js file or something that has these flags or somewhere I'm not looking

Could some one please break this down for me?
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
792
First Language
English
Primarily Uses
RMMV
@Pharonix Are these included in your recent PHX_LeMod?
My counter system is actually quite in-depth

each entity, thanks to passives/weapons/etc, has a list of "counter" skills that they have at their disposal.
Each of these are then set to what I called a "counter distance" meaning, this is as far as that skill can be used to counter.
It then determines the distance between attacker, and victim.

It then works like this

Say my character has 3 counter abilities active:
Auto-Potion, Smash, Fire Ball
Auto-Potion has a Counter Distance of 20
Smash is 1
Fire Ball is 7

If the enemy is 6 cells away, the valid skills are then
Fire Ball and Auto-Potion.

Because the entity has 2 VALID counters, it randomly chooses one of them.
Then that counter skill is used.

The problem then became:
What if I had auto-potion.

Well, using the standard counter system, the victim would try to cast auto-potion on the enemy, which didn't work too well,

This led me into using 2 branches (before adding several more counter types:

Code:
if(this.checkCounter(skillId) === "Offensive")
                {
                    var popup = $dataSkills[skillId].meta["Counter Type Display"];
                    var cName = $dataSkills[skillId].meta["Counter Name"];
                    if(!popup) popup = "Offensive Counter";
                    entity.addTextPopup(popup);
                    if(!cName) cName = skill.name;
                    entity.addTextPopup(cName);
                    entity.startSequence("counter");
                    this.setCursorCell(subject.getCell());
                    this.forceAction(skill, entity);
                    entity.battler()._counters+=1;
                }
               else
                {
                    var popup = $dataSkills[skillId].meta["Counter Type Display"];
                    var cName = $dataSkills[skillId].meta["Counter Name"];
                    if(!popup) popup = "Defensive Counter";
                    entity.addTextPopup(popup);
                    if(!cName) cName = skill.name;
                    entity.addTextPopup(cName);
                    entity.startSequence("counter");
                    this.setCursorCell(entity.getCell());
                    this.forceAction(skill, entity);
                    entity.battler()._counters+=1;
                }
What this then meant was, If the skill was an offensive counter (like fireball, or smash) then it would set the "cursor" to the attacking entity,
Otherwise, since it is a defensive counter, it sets the cursor to the victim. This means that now, instead of "attacking" the oriiginal attacker with auto-potion, the victim would use it on itself.

This will make absolutely no sense to many of you, but this should be the entirety of my counter system, not including all the additions I made to YEP_Counter_Control

Code:
BattleManagerTBS.processCounterAttack = function (targets, subject, action) {
    console.log("____________________");
    console.log(action);
    console.log("____________________");
    if (!action) return;
    targets.forEach(function (entity) {
        if (entity) {
            var dist = LeUtilities.distanceBetweenCells(subject.getCell(), entity.getCell());
            //if (dist <= 1 && Math.random() < action.itemCnt(entity.battler())) {
            //var skill = $dataSkills[entity.battler().attackSkillId()];
            entity.battler().makeCounterSkills();
            if(entity.battler().counterSkills() && entity.battler()._counters<entity.battler().counterTotal() && Math.random() < action.itemCnt(entity.battler()) )
            {
                var valid = true;
                var defC = $dataSkills[1];
                if(entity.battler().isActor())
                    {defC = $dataSkills[$dataActors[entity.battler().actorId()].defaultCounter];}
                else
                    {defC = $dataSkills[1];}
           
                var skills = this.getBestCounter(entity.battler().counterSkills(),dist,defC);
                console.log("skills");
                console.log(skills);
                console.log("Default skill");
                console.log(defC);
                if(!skills.indexOf(defC)){skills.push(defC);}
                //Test
                //skills = [1,1880];
                //get random skill if user has multiple counter skills
                if(skills.length <=0)
                {return;}
                var skillId = skills[Math.floor(Math.random()*skills.length)].id;
                var sDist = this.checkCounterDistance(skillId);
           
                var skill = $dataSkills[skillId];
                console.log(skill);
                subject.battler().clearResult();
                entity.lookAt(subject.getCell());
                //Check Counter Type
                if(this.checkCounter(skillId) === "Invalid" || dist > sDist || !valid)
                {
               
                }
                else if(this.checkCounter(skillId) === "Offensive")
                {
                    var popup = $dataSkills[skillId].meta["Counter Type Display"];
                    var cName = $dataSkills[skillId].meta["Counter Name"];
                    if(!popup) popup = "Offensive Counter";
                    entity.addTextPopup(popup);
                    if(!cName) cName = skill.name;
                    entity.addTextPopup(cName);
                    entity.startSequence("counter");
                    this.setCursorCell(subject.getCell());
                    this.forceAction(skill, entity);
                    entity.battler()._counters+=1;
                }
                else if(this.checkCounter(skillId) === "Support")
                {
                    var popup = $dataSkills[skillId].meta["Counter Type Display"];
                    var cName = $dataSkills[skillId].meta["Counter Name"];
                    if(!popup) popup = "Support Counter";
                    entity.addTextPopup(popup);
                    if(!cName) cName = skill.name;
                    entity.addTextPopup(cName);
                    entity.startSequence("counter");
                    this.setCursorCell(subject.getCell());
                    this.forceAction(skill, entity);
                    entity.battler()._counters+=1;
                }
                else if(this.checkCounter(skillId) === "Elemental")
                {
                    var popup = $dataSkills[skillId].meta["Counter Type Display"];
                    var cName = $dataSkills[skillId].meta["Counter Name"];
                    if(!popup) popup = "Elemental Counter";
                    entity.addTextPopup(popup);
                    if(!cName) cName = skill.name;
                    entity.addTextPopup(cName);
                    entity.startSequence("counter");
                    this.setCursorCell(subject.getCell());
                    this.forceAction(skill, entity);
                    entity.battler()._counters+=1;
                }
                else if(this.checkCounter(skillId) === "Physical")
                {
                    var popup = $dataSkills[skillId].meta["Counter Type Display"];
                    var cName = $dataSkills[skillId].meta["Counter Name"];
                    if(!popup) popup = "Physical Counter";
                    entity.addTextPopup(popup);
                    if(!cName) cName = skill.name;
                    entity.addTextPopup(cName);
                    entity.startSequence("counter");
                    this.setCursorCell(subject.getCell());
                    this.forceAction(skill, entity);
                    entity.battler()._counters+=1;
                }
                else if(this.checkCounter(skillId) === "Magical")
                {
                    var popup = $dataSkills[skillId].meta["Counter Type Display"];
                    var cName = $dataSkills[skillId].meta["Counter Name"];
                    if(!popup) popup = "Magical Counter";
                    entity.addTextPopup(popup);
                    if(!cName) cName = skill.name;
                    entity.addTextPopup(cName);
                    entity.startSequence("counter");
                    this.setCursorCell(subject.getCell());
                    this.forceAction(skill, entity);
                    entity.battler()._counters+=1;
                }
                else
                {
                    var popup = $dataSkills[skillId].meta["Counter Type Display"];
                    var cName = $dataSkills[skillId].meta["Counter Name"];
                    if(!popup) popup = "Defensive Counter";
                    entity.addTextPopup(popup);
                    if(!cName) cName = skill.name;
                    entity.addTextPopup(cName);
                    entity.startSequence("counter");
                    this.setCursorCell(entity.getCell());
                    this.forceAction(skill, entity);
                    entity.battler()._counters+=1;
                }
            }//Won't do anything if user has no Counter Skills
           
           
            //}
        }
    }.bind(this));
};

BattleManagerTBS.checkCounterDistance = function (skillId) {
    console.log(skillId);
    var CDist = 1;
        if ($dataSkills[skillId].meta["Counter Distance"])
        CDist = $dataSkills[skillId].meta["Counter Distance"];
    if(CDist)
    {
        return Number(CDist);
    }
    else
    {
    return 0;
    }
};

BattleManagerTBS.getBestCounter = function (counterSkills, cntDistance, defCounter)
{
    counterSkills.push(defCounter);
    console.log("counter skills");
    console.log(counterSkills);
    var goodSkills = [];
    var bestSkills = [];
    counterSkills.forEach(function(skill)
    {
        console.log(skill);
        console.log(skill.id);

            //Skills with counter range 0 should be treated as permanent counters - able to counter all (auto-potion for example)
            if(BattleManagerTBS.checkCounter(skill.id) == "Invalid" || BattleManagerTBS.checkCounterDistance(skill.id)==0)
            {
            }
            else if(BattleManagerTBS.checkCounterDistance(skill.id)==cntDistance)
            {
                //console.log("best skill")
                //console.log(skill)
                bestSkills.push(skill);
            }
            else if(BattleManagerTBS.checkCounterDistance(skill.id)>=cntDistance && BattleManagerTBS.checkCounterDistance(skill.id)>0 && BattleManagerTBS.checkCounter(skill.id))
            {
                //console.log("good skill")
                //console.log(skill)
                goodSkills.push(skill);
            }
            else
            {
                //console.log("bad skill")
                console.log(skill)
           
            }
       
    });

    if(bestSkills.length>=1)
    {
        console.log(bestSkills);
        return bestSkills;//[Math.floor(Math.random()*bestSkills.length)].id;
    }
    else if(goodSkills.length>=1)
    {
        console.log(goodSkills);
        return goodSkills;//[Math.floor(Math.random()*goodSkills.length)].id;
    }
    else
        return [];//null;



};

BattleManagerTBS.checkCounter = function (skillId) {
    var defensiveSkills = [1880];
    var cType = $dataSkills[skillId].meta["Counter Type"];
    if(!cType) cType = "Counter" ;
    var n = defensiveSkills.indexOf(skillId);
    var eva = $dataSkills[skillId].counterConditionEval;
    if(eva)
    {
    // If the skill has an eval, this will make sure the skill is valid.
    // Example: If the skill is "Auto-Potion" it will make sure the player has enough potions.
    // To give enemies Auto-Potion, make sure to create a duplicate skill without the eval.
        if(!eval(eva)){return "Invalid";}
    }
    if (n>=0 || cType =="Defensive")
    {
        return "Defensive";
    }
    else if(cType =="Support")
        return "Support";
    else if(cType =="Elemental")
        return "Elemental";
    else if(cType =="Physical")
        return "Physical";
    else if(cType =="Magical")
        return "Magical";

    return "Offensive";
};

BattleManagerTBS.getCounterType = function (skillId) {
    var type = $dataSkills[skillId];


};

Here's my Changelog For basically everything I added to LeTBS.js, not including various other plugins.
# - 0.77.PHX
# * ===========
# * Positioning
# * ===========
# * Added support for variable-based actor cells
# * Added support for switch-based actor cells
# * Added support for leader-based actor cells (Party Leader auto-positioning
# * Added support for neutral positioning cells that can be used by enemies or actors
# * Added custom color for neutral positioning
# * Added logic to determine of all player entities are placed in the pre-positioning phase.
# * If this is the case, the battle is immediately started, eliminating the need for the player
# to "Confirm" they are ready. Eliminates a bug where you could "Cancel" on a pre-placed unit.
# Causing the game to crash.
# * ===========
# * Scope Select
# * ===========
# * Added support for Scope_Select if Actor is afflicted with a specific State
# * Added support for Scope_Select if Enemy Unit is afflicted with a specific State
# * Added support for Scope_Select if A Team Member is afflicted with a specific State
# * Added support for Scope_Select if An Enemy Team Member (enemies if player, player if enemies0
# * is afflicted with a specific State
# * Added support for Scope_Select if Actor Knows a specific Skill
# * Added support for Scope_Select if Enemy Knows a specific Skill
# * ===========
# * Turn Order
# * ===========
# * Added support for "Redrawing" the Turn Order
# * If enabled, the turn order will be determined at the end of every turn.
# * This allows for skills that raise a unit's agility to have a better advantage
# The next turn.
#
# * Added support for Initiative Battle System:
# ** Allows the configuring of
# *** Bonus Initiative for non-movement / remaining move points
# *** Non-Action - Not attacking/using skills/items/ect.
# *** Default Initiative cost - Initiative cost per turn
# * ===========
# * Turn Order
# * ===========
# * [Order Types]
# * Type 0
# * Fair Order - Alternates between Ally and Enemy. Ally and Enemy order is
# * based on agility. [Ally1, Enemy1, Ally2, Enemy2....etc]
# *
# * Type 1
# * Simple Order - Takes all ally/enemy together and sorts indiscriminately based on
# * agility. Can Cause unfair turn order if either side is faster in general
# * ex. [Ally1, Ally2, Enemy1, Enemy3, Enemy2, Ally3]
# *
# * Type 2 (Also known as Pre-emptive Strike)
# * Actor First - Sorts Actors and Enemies by Agility order respectively
# * (Orders Actor List by AGI. and Enemy List by AGI.
# * Then Combines the Two Lists. Results in order like the following:
# * [Ally3, Ally1, Ally2, Enemy1, Enemy3, Enemy2]
# *
# * Type 3 (Also known as Surprise Attack)
# * Enemy First - Sorts Actors and Enemies by Agility order respectively
# * (Orders Actor List by AGI. and Enemy List by AGI.
# * Then Combines the Two Lists. Results in order like the following:
# * [Enemy1 ,Enemy3, Enemy2,Ally3, Ally1, Ally2]
# *
# * Reverse
# *
# * Type 4
# * Fair Order - Alternates between Ally and Enemy. Ally and Enemy order is
# * based on agility. [Ally1, Enemy1, Ally2, Enemy2....etc] Slowest Acts First
# *
# * Type 5
# * Simple Order - Takes all ally/enemy together and sorts indiscriminately based on
# * agility. Can Cause unfair turn order if either side is faster in general
# * ex. [Ally1, Ally2, Enemy1, Enemy3, Enemy2, Ally3] Slowest Acts First
# *
# * Type 6
# * Actor First - Sorts Actors and Enemies by Agility order respectively
# * (Orders Actor List by AGI. and Enemy List by AGI.
# * Then Combines the Two Lists. Results in order like the following:
# * [Ally3, Ally1, Ally2, Enemy1, Enemy3, Enemy2] Slowest Acts First
# *
# * Type 7
# * Enemy First - Sorts Actors and Enemies by Agility order respectively
# * (Orders Actor List by AGI. and Enemy List by AGI.
# * Then Combines the Two Lists. Results in order like the following:
# * [Enemy1 ,Enemy3, Enemy2,Ally3, Ally1, Ally2] Slowest Acts First
# *
# * Special
# * Type 8
# * Initiative Order - Currently uses the Actor's initial move points and agility to determine level of initiative.
# * the higher the player's initiative, the higher in the order they go.
# * After a turn ends, bonuses can be set for:
# * Non-Action (No attack / item / skill / etc
# * Remaining Movepoints (ie: used 3 of 5 movepoints - results in 2 bonus initiative)
# * Pre-Set initiative cost deducted on turn end (default of 10). When an actor or enemy
# * has 0 or fewer initiative points, they are removed from the turn order, and must wait
# * until the initiative order is re-structured (all units finished using all initiative)
# * ===========
# * Counter System
# * ===========
# * Repaired Counter System for 0.77
# * Added support for Yanfly Counter Control
# * Added support for Counter Conditions, Counter Distance
# * Counter is selected by determining "Best Counters"
#
# * First, the skill's Counter Conditions are checked.
# ** If no counter condition is set, it is evaluated as true -
# ** otherwise it evaluates the counter condition. If false, it
# it does not add the skill to any array, if true, proceed to next step.
# * Second, it checks Counter distance (If unavailable, assumes "0") of all Counter Skills
# for the "countering" entity.
# * If Counter Distance = Distance between attacker and the entity that counters
# or the Counter Distance = 0, then that counter skill is added to the "Best" counters
# * If Counter Distance is greater than or equal to the distance between the two entities,
# then it is considered a "good" or otherwise "valid" counter.
# * If the "Best" counters has a length > 0 then it is returned, otherwise, it checks if
# the "Good" counters array has a length of > 0, if so, that one is returned.
# * If neither array has elements, it returns an empty array, and the character does NOT counter.
#
# * After the Counter SKills array is determined, it randomly selects one.
# * This counter is then checked to see what "Type" of counter it is.
# * Using an array of "Defensive Counters" (Will later be updated to use a notetag) it checks if the skill
# selected is a Defensive Counter and returns such, otherwise it returns "Offensive".
# ** CheckCounter is also used by getBestCounter(), which uses it to determine if the counter is Invalid
# ** Here, it is simply used to determine if it is defensive or offensive.
#
# * If the skill is defensive, the cursor is set to the countering entity, and the action is performed.
# ** A popup will display with "Defensive Counter" and "Skill Name"
# * If the skill is offensive, the cursor is set to the entity to BE countered, and the action is performed.
# ** A popup will display with "Offensive Counter" and "Skill Name"
# *** Will add support later for other counter types such as:
# **** Support Counter
# **** Magic Counter
# **** Physical Counter
# **** Elemental Counters
# ***** Fire,Ice,Thunder,Water,Wind,Earth,Light,Dark
#
# ****TO-DO****
# * Check if counters affect allies.
# * Add notetag to prevent ally counters
# * Add notetag to allow ally counters
# * Add notetag for specialiszed counters
# ** Nearest Enemy
# ** Nearest Ally
# ** ETC
# - 0.77.PHX.02
# * Added support for "exclude_free_cells" in the AOE. previously
# * this boolean did exist, but there was never a function to filter
# * out cells without an entity in it. This also greatly reduces lag
# * when selecting skills with 20+ range.
# *
# * Fixed "Charm" System.
# * Lecode used isAlly and isEnemy to determine which side the enemy/
# * target was on, rather than using isAlly to determine if the target
# * was an actual Ally of the user.
# *
# * This resulted in crazy situations where the ally and enemy arrays
# * for a confused user were identical, resulting in the AI getting confused.
# * Any confused AI will continue to beat up their own allies, until the
# * confusion wears off, the user dies, or all their allies are dead.
# *
# * In these cases, the user will then proceed to attack the actual enemy.
# * I believe that if the confused enemy has healing skills, he will heal
# * and/or resurrect their teammates. This can cause even more hilarious
# * situations where an enemy kills/revives/kills again their teammates.
# *

In addition to all of this, I also have 3 other plugins for general Utility, and my region and terrain plugins,

Combine those with the changes to LeTBS.js, and the yanfly plugins, I estimate I have added around 4,000 lines of code minimum to my project.
As it stands right now, it seems like counterattacks are using the attacker's stats instead of the counterattacker's.
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
@Frostorm yeah, it adds counter stuff.
You can just comment it out if you want.

As for the stats, that is really weird, as it piggy-backs off the default counter code.
Maybe I'll need to look into this to see if there's a solution.

EDIT:
Having trouble finding that post, but there should have been 2 plugins
PHX_LeMod which has the general stuff
and
PHX_Counters which has the counter code.
I re-attached them here.

EDIT 2: I suggest using WITH yanfly counter control, if not just for the Maximum counter restriction, otherwise 2 troops with counter will just counter until one dies.
 

Attachments

Last edited:

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
792
First Language
English
Primarily Uses
RMMV
Damn even w/ your plugin installed, the game is still forcing skill ID: 1 as the counter skill. I've tried using the <Default Counter: 3> notetag found in your plugin's help file. I've also tried setting the default counter skill to 3 (or even any other #). I've even tried putting <Counter Skills: 3> on the weapon. No matter what I do, the game is using the MV default of skill ID: 1 as the counter skill...

I believe this is the code that handles counters in LeTBS.js:
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())) {
                var skill = $dataSkills[entity.battler().attackSkillId()];
                subject.battler().clearResult();
                entity.lookAt(subject.getCell());
                entity.addTextPopup("Counter");
                entity.startSequence("counter");
                this.forceAction(skill, entity);
            }
        }
    }.bind(this));
};
Maybe the counter plugin you just posted makes this obsolete, but so far it hasn't had any effect after installing it. I also have the Yanfly counter plugin installed, but have tried it both with it on and off.

Edit: I noticed this line var skill = $dataSkills[entity.battler().attackSkillId()]; is what's forcing it to use Skill ID: 1 when countering, since it's the default attack skill. Like you, I don't use this skill in my, weapons add a different skill to use as a replacement for basic attack. Only (melee) monsters use this skill in my project. I also notice this line entity.startSequence("counter"); calls the counter sequence, which is the following (by default).
"counter": [
"anim: user, 177, 0, true",
"wait: 15"
],


I also noticed the BattleManagerTBS.processCounterAttack function in PHX_Counter.js is highly expanded upon compared to the one in LeTBS.js...shouldn't that have fixed my issue?

Edit: @Pharonix I gotta thank you for uploading your counter extension plugin. I looked into it and edited the this line in LeTBS.js: var skill = $dataSkills[entity.battler().attackSkillId()]; to the one you used in your plugin: var skill = $dataSkills[$dataActors[entity.battler().actorId()].defaultCounter]; and that fixed my issue! Idk why your plugin wasn't working for me, it was as if it wasn't overwriting the BattleManagerTBS.processCounterAttack function in LeTBS.js as intended, but oh wells. At least my counters work now! Maybe it has something to do w/ the fact that I'm using v0.77.2b? I know you said you were using a slightly earlier version, but I can't imagine it to be that different...

Edit2: I would still prefer to use your Counter plugin, but I just can't figure out why it's not working...
 
Last edited:

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
Did you put my counter code before or after the LeTBS One.
I just realized I never used the overload format.
So if you put it before LeTBS, LeTBS is just going to overwrite it.
Your best option is to comment out the LeTBS code and paste my code right in the LeTBS.js file right underneath it.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
792
First Language
English
Primarily Uses
RMMV
Did you put my counter code before or after the LeTBS One.
I just realized I never used the overload format.
So if you put it before LeTBS, LeTBS is just going to overwrite it.
Your best option is to comment out the LeTBS code and paste my code right in the LeTBS.js file right underneath it.
I put it after LeTBS (it wouldn't make sense to put it before). I also did try to comment out the LeTBS code, but the game threw an error when I did that. Screenshot when it's commented out:
1595989597977.png

Edit: Maybe I should try copy-pasting the contents of your plugin into LeTBS.js? Replacing the old BattleManagerTBS.processCounterAttack function with yours as well as including the supplementary functions.

@Pharonix Btw, have you tested whether counters are using the target's stats or the counter-attacker's stats? Even with your plugin, counter's are using the target's stats, not the counter-attacker's.

Edit2: I found out something cool! Changing subject.battler().clearResult(); to entity.battler().clearResult(); gets rid of that pesky double number popup when you counter!

Edit3: I'm guessing the stat issue is due to the forceAction function?
JavaScript:
BattleManagerTBS.forceAction = function (obj, entity) {
    var battler = entity.battler();
    var center = entity.getCell().toCoords();
    var action = new TBS_FloatingAction(battler, false);
    action.setItemObject(obj);
    entity.battler()._itemOnUse = obj;

    var data = obj.id === battler.attackSkillId() ? entity.getAttackScopeData() : entity.getObjectScopeData(obj);
    this.makeActionScope(entity, data, obj);

    var aoeData = obj.id === battler.attackSkillId() ? entity.getAttackAoEData() : entity.getObjectAoEData(obj);
    var aoeCenter = this._activeCell.toCoords();
    var param = this.makeObjAoEParam(obj, entity, aoeCenter);
    var aoe = this.getScopeFromData(aoeData, aoeCenter, param);
    this._actionAoE = aoe;

    var item = action.item();
    var id = action.isAttack() ? entity.getWeaponSequenceData() : entity.getObjectSequenceData(item);
    battler.useItem(item);
    action.applyGlobal();
    entity.lookAt(this._activeCell);
    entity.appendSequence(id, action);
};
 
Last edited:

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
I'll need to do some testing to see which stat blocks it is using.
If it is an issue with force action, then that is a serious bug.

One way to test is main actor with high hp, low def, low atk.
enemy with high hp, no def, high hp, high atk.
This would set up a scenario where actor would deal small dmg with counter if using its own stats, whereas it would deal high dmg if using the attacker's.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
792
First Language
English
Primarily Uses
RMMV
I'll need to do some testing to see which stat blocks it is using.
If it is an issue with force action, then that is a serious bug.

One way to test is main actor with high hp, low def, low atk.
enemy with high hp, no def, high hp, high atk.
This would set up a scenario where actor would deal small dmg with counter if using its own stats, whereas it would deal high dmg if using the attacker's.
Yea I did exactly that, so it would be very obvious which unit's stats were being used. I've also tried changing the damage formula of the skill to use b.atk instead of a.atk, but it made no difference. So that really perplexes me...

Also, if not forceAction, then perhaps this? (though I doubt it)
JavaScript:
BattleManagerTBS.onPrimarySequenceEnd = function (seqMng) {
    var entities = LeUtilities.uniqArray(seqMng._affectedTargets);
    this.processCounterAttack(entities, seqMng.getUser(), seqMng._action);
};
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
Te be honest, I'm not sure.
according to force action, it loads the correct entity in, and has them perform the attack.

I'll need to do some in depth testing, but won't be able to get to it until the weekend.
In the meantime, f you figure anything out, let me know.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
792
First Language
English
Primarily Uses
RMMV
I'm thinking the stat issue might be because it's technically still the attacker's turn, not the counter-attacker's turn, thus the game uses the attacker's stat block.
 

huoixn

Veteran
Veteran
Joined
Mar 11, 2019
Messages
32
Reaction score
1
First Language
Chinese
Primarily Uses
RMMV
<letbs>

scope: circle(2)

scope_options: need_free_cell

sequence: summon(wind_spirit)

</letbs>



<letbs_AI>

type: summon

</letbs_AI>



<Cooldown: 12>

I want to create a new summon, how should I modify the above settings?
After including my modification (wind_spirit), where do I need to enter it?

I want to make a short-term attack skill, and the orcs become mad, but I can't choose myself as the target. In addition, I want to add a weakened state to myself at the end of this madness skill.
Does anyone know how to achieve it?
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
792
First Language
English
Primarily Uses
RMMV
I want to make a short-term attack skill, and the orcs become mad, but I can't choose myself as the target. In addition, I want to add a weakened state to myself at the end of this madness skill.
Does anyone know how to achieve it?
There may be a huge problem w/ LTBS I just noticed, which might affect you as well. I recently realized states were not going through the regenerate phase, as in, they are just stuck at however many turns left as when applied. Like if I apply any state that has X (let's say 5 for example) amount of turns on it, it would stay at 5 turns remaining...forever. Do you guys have this issue too?

Edit: Nvm, my project is just seriously bugged... The demo works just fine.
 
Last edited:

huoixn

Veteran
Veteran
Joined
Mar 11, 2019
Messages
32
Reaction score
1
First Language
Chinese
Primarily Uses
RMMV
There may be a huge problem w/ LTBS I just noticed, which might affect you as well. I recently realized states were not going through the regenerate phase, as in, they are just stuck at however many turns left as when applied. Like if I apply any state that has X (let's say 5 for example) amount of turns on it, it would stay at 5 turns remaining...forever. Do you guys have this issue too?

Edit: Nvm, my project is just seriously bugged... The demo works just fine.
I can finish my tests normally, but I still can't see myself as a goalQQ图片20200802181153.jpg
 

Attachments

huoixn

Veteran
Veteran
Joined
Mar 11, 2019
Messages
32
Reaction score
1
First Language
Chinese
Primarily Uses
RMMV
As the sole purpose, problem solved

<letbs>

scope: circle(0)

scope_options: include_center

</letbs>



<Cooldown: 12>
 

huoixn

Veteran
Veteran
Joined
Mar 11, 2019
Messages
32
Reaction score
1
First Language
Chinese
Primarily Uses
RMMV
<letbs_sprite>

pose(idle): use_chara

pose(dead): use_chara, Damage4, 1, 1

turn_order: auto

status_sprite: auto

</letbs_sprite>



<letbs>

ai_pattern: ranged_fighter

</letbs>

I use the demo settings. After the main character is killed, the dead image is not normal. It turns into a side walking picture,

But the enemy corpse settings are normal. What did I do wrong
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
792
First Language
English
Primarily Uses
RMMV
pose(dead): use_chara, Damage4, 1, 1

This is why your unit is doing the "side walking".

Btw, be wary of double (or triple in your case) posting. The mods are definitely gonna say something about it... Best to just merge them together, there's an edit button.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 3)

Latest Threads

Latest Posts

Latest Profile Posts

Besides my Might and Magic inspired project, I have always wanted to make a Fire Emblem-like game. Time is the culprit... Between life, composing music packs, and working on a game can it be done!? The tactical plugins for MV work quite well based on what I have tested.
Yaaay! My second public script is out and approved! A VX Ace Final Fantasy IX styled Throw Script!

I look forward to all the constructive feedback I get but most importantly I hope everyone who ends up using it enjoys!

Yaaaay! Making scripts is fun lol. :D
When you're lost out therrrrre and you're alllll alone, ahwahwah waitin, to carry you hooooommmme, uhhheverywhere you look! (someone hit me with those backing vocals)
X.X cant focus... too many thing want do... help!
Day 2 of teaching MV, student can move cat across the map.

Forum statistics

Threads
100,525
Messages
976,813
Members
132,080
Latest member
nwr
Top