Lecode Tactical Battle System 0.77.2B

moldy

Veteran
Veteran
Joined
Nov 15, 2015
Messages
191
Reaction score
29
First Language
English
Primarily Uses
Basically, I created 2 skills/states
Charm - Repaired charm function. On Player-Controlled Allies, it forces them into "AI" controlled, and swaps the enemy/ally arrays.
So what this means is according to the game system, The Enemy Units are the player's allies, and vice-versa. IIRC, this required alot of coding to make sure it worked.
I had to modify everything that said something along the lines of
var party = user.battler().isEnemy() ? this.enemyEntities() : this.allyEntities();
and replace it with
var party = TBSAiManager.prototype.getAlliesOf(user.battler(), true);

Npt to mention I had to replace the getAlliesOf and getEnemiesOf functions to determine the proper arrays.

As for "Brainwashing"
This was more complicated,

As it is, there was no way to "undo" the AIControlled on enemy entities, nor do they have a command array of sorts.
So the way it works is it clones the enemy entity, using a tag I created called [CloneID] which tells the system which ActorID the enemy should be cloned as. Then it completely erases the enemy entity, and drops in an Actor with the same exact Stats.
Obviously this causes issues unless you make sure to never use duplicates of the same enemy in battle.
On Allies, this functions exactly like "Charm" so there's no issue there.



I'm actually using 0.77 Base, not the 0.77.2 version, however, I did take some fixes from it, such as the fixed counter system, but thats when I discovered the issue.

In 0.77's base code for processCounterAttack()
It doesn't take into consideration the "Cursor"

Basically when an enemy hits you with an attack, the cursor is now placed on player character, and by default, the player is not in the array of enemies. What this means is the Character performing 'forceAction' is not allowed to perform a counter on their own cell.
But when I took the code from 0.77.2B, it seemed to have worked fine.

One thing to note, is that Counter's DO NOT apply to battle parties with more than the default 4
Since my game had 5 characters always, the 5th character would not counter,
So I wrote a plugin that raised the max battle party members to a user-defined number through the plugin manager.

At this point I have

Offensive Counters - Counters with an Offensive Skill
Defensive Counters - Counters with a Defensive Skill (Such as a barrier, retreat, etc)
Support Counters - Counters with a Support Skill (Such as Heal, Atk/Def up, etc)
Elemental Counters - Counters a specific Element - When done, this will allow countering certain attacks. (like counter a fire spell with Ice/water)
Physical Counters - Counters that 'counter" with a Physical attack
Magical Counters - Counters that 'counter" with a Magical attack

Also, Every character has a maximum number of counters that I modified the Yanfly Counter Control for, to have each character have a maximum counter number, which is reset each turn. I had to implement this CounterLimit when I realized units that can counter, will counter counter-attacks.

You should see the massive web of javascript, that happens to be much too complex to fully explain.
Interesting! I was actually thinking about doing something similar (making actors corresponding to each enemy and just summoning them to the battle field in the enemy's place). Would there be a way to make the enemy regain its senses and return to the battle as an enemy though?
 

cmcorbin

Villager
Member
Joined
Mar 14, 2019
Messages
14
Reaction score
6
First Language
english
Primarily Uses
RMMV
Hey everyone. I have a quick question. Is it possible to create a skill that targets a single person when one tile away and does a small AoE at longer distances? My idea is to have a shotgun that does more damage to a single target right next to the user but then have the shot spread out at longer ranges. The distance modifier isnt a problem thanks to Pharonix (Thank you for posting that by the way), but I am not sure how or if its possible to build a skill like that. Thanks in advance!
 

Adventurer_inc.

Technically a Programmer
Veteran
Joined
Sep 12, 2015
Messages
99
Reaction score
40
First Language
English
Primarily Uses
RMMV
@Pharonix
It seems like Counter is quite buggy. I took a different approach to counter. My counter is similar to FFT where you would counter when the enemy is within the range of your current held weapon and with your current held weapon. I think my problem might be in the action sequence department.

I even left myself a comment before I took a hiatus that I can't seem to make it out:
Code:
/*
1/16/19 Note: When stacking forceAction the sequences are appended together and becomes one sequence.
The problem is that only one actionEnd is played so the skill of the first forceAction replaces the second skill
*/
Your charm gives me an idea of creating multiple teams in battle similar to Lecode's 0.8. Enemies that will attack both other enemies and players alike.
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
645
Reaction score
277
First Language
English
Primarily Uses
RMMV
@Pharonix
It seems like Counter is quite buggy. I took a different approach to counter. My counter is similar to FFT where you would counter when the enemy is within the range of your current held weapon and with your current held weapon. I think my problem might be in the action sequence department.

I even left myself a comment before I took a hiatus that I can't seem to make it out:
Code:
/*
1/16/19 Note: When stacking forceAction the sequences are appended together and becomes one sequence.
The problem is that only one actionEnd is played so the skill of the first forceAction replaces the second skill
*/
Your charm gives me an idea of creating multiple teams in battle similar to Lecode's 0.8. Enemies that will attack both other enemies and players alike.
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.
 
Last edited:

moldy

Veteran
Veteran
Joined
Nov 15, 2015
Messages
191
Reaction score
29
First Language
English
Primarily Uses
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.
I love this concept! It's basically the Reactive Abilities in Final Fantasy Tactics. Any way to replicate the counter magic ability? It basically forces the user to cast any offensive magic that was used on them back at the original attacker as soon as the original spell lands.
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
645
Reaction score
277
First Language
English
Primarily Uses
RMMV
I love this concept! It's basically the Reactive Abilities in Final Fantasy Tactics. Any way to replicate the counter magic ability? It basically forces the user to cast any offensive magic that was used on them back at the original attacker as soon as the original spell lands.
Should be easy

S8 basically counter fireball with fireball?
Should be simple with what ive built.
I woukd just add another branch before the counter skill ti check if victim has state [counter magicks] and if so force the skill
Otherwise, counter normally

Should be able to write a snippet that works for the base 77.2B coubter code sometime this week, Ive been quite busy with work
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
645
Reaction score
277
First Language
English
Primarily Uses
RMMV
I love this concept! It's basically the Reactive Abilities in Final Fantasy Tactics. Any way to replicate the counter magic ability? It basically forces the user to cast any offensive magic that was used on them back at the original attacker as soon as the original spell lands.
Replace BattleManagerTBS.processCounterAttack with the below, and give it a shot
Replace 666/777/888 with the state you want your character to be affected with to counter skills with the same skill.
This is very crude, but should work

Note:
Replace 666 with the skill that will counter [Certain Hit] Attacks with the same skill
Replace 777 with the skill that will counter [Physical] Attacks with the same skill
Replace 888 with the skill that will counter [Magical] Attacks with the same skill

If you only want to use Reactive Magic, then set the other 2 states to an unused ID

If you want different states to work for cetain/physical attack

Code:
BattleManagerTBS.processCounterAttack = function (targets, subject, action) { //Reactive Abilities
    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())) {
                hitType = $dataSkills[BattleManagerTBS.activeEntity()._lastAction].hitType; // 0=certain, 1=Physical, 2= Magical
                if(BattleManagerTBS.activeEntity().battler().isStateAffected(666) && hitType==0) //Change this value to your "Full Counter Skill"
                {
                    var skill = $dataSkills[BattleManagerTBS.activeEntity()._lastAction];
                    subject.battler().clearResult();
                    entity.lookAt(subject.getCell());
                    entity.addTextPopup("Counter");
                    entity.startSequence("counter");
                    this.forceAction(skill, entity);
                }
                else if(BattleManagerTBS.activeEntity().battler().isStateAffected(777) && hitType==1) //Change this value to your "Full Counter Skill"
                {
                    var skill = $dataSkills[BattleManagerTBS.activeEntity()._lastAction];
                    subject.battler().clearResult();
                    entity.lookAt(subject.getCell());
                    entity.addTextPopup("Counter");
                    entity.startSequence("counter");
                    this.forceAction(skill, entity);
                }
                else if(BattleManagerTBS.activeEntity().battler().isStateAffected(888) && hitType==2) //Change this value to your "Full Counter Skill"
                {
                    var skill = $dataSkills[BattleManagerTBS.activeEntity()._lastAction];
                    subject.battler().clearResult();
                    entity.lookAt(subject.getCell());
                    entity.addTextPopup("Counter");
                    entity.startSequence("counter");
                    this.forceAction(skill, entity);
                }
                else
                {
                    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));
};

Let me know if this crashes
 

Adventurer_inc.

Technically a Programmer
Veteran
Joined
Sep 12, 2015
Messages
99
Reaction score
40
First Language
English
Primarily Uses
RMMV
Hey everyone. I have a quick question. Is it possible to create a skill that targets a single person when one tile away and does a small AoE at longer distances? My idea is to have a shotgun that does more damage to a single target right next to the user but then have the shot spread out at longer ranges. The distance modifier isnt a problem thanks to Pharonix (Thank you for posting that by the way), but I am not sure how or if its possible to build a skill like that. Thanks in advance!
This is the closest I could get using sequence conditioning. If anyone finds a better way to do it, I'm all ears.
ezgif.com-crop.gif

@Pharonix My memory is hazy but, I don't think .lastAction is part of the lecode's default code base. Also wouldn't the parameter action be lastAction? What would it look like if you hit multiple enemies and multiple enemies counter you simultaneously?
Code:
BattleManagerTBS.activeEntity()._lastAction
 
Last edited:

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
645
Reaction score
277
First Language
English
Primarily Uses
RMMV
This is the closest I could get using sequence conditioning. If anyone finds a better way to do it, I'm all ears.
View attachment 121177

@Pharonix My memory is hazy but, I don't think .lastAction is part of the lecode's default code base. Also wouldn't the parameter action be lastAction? What would it look like if you hit multiple enemies and multiple enemies counter you simultaneously?
Code:
BattleManagerTBS.activeEntity()._lastAction
You are right.

I added ._lastAction via the LastUsedItem.js plugin.

Since I'm unable to find anything regarding distribution, I'm uploading it here unless told otherwise to remove it.

=========
If you hit multiple enemies, I believe, from what I remember, is they end up getting queued up through the Battle Manager.
I'll run some tests later. It's 11pm here :)
 

Attachments

Myers & Sparks

Veteran
Veteran
Joined
Jan 2, 2017
Messages
91
Reaction score
3
First Language
English
Primarily Uses
RMMV
Hey another question/thought. After meddling witth 0.772B for a few days, I wanted to try to use some interactive skills. Legend of Dragoon. Wild arms, etc style.

http://sumrndm.site/timed-attack-core/

Something like that. I added the Script into the 0.772B and while it didn't crash or anything it just, didn't do anything. Lol. :hswt2:

My thoughts are something just isn't updating correctly / or conflicting with the scene update of sorts. Sadly My Java isn't the greatest and LeTBS core is a pretty hefty chunk of code :rswt

Can someone point me in the general direction?

or does someone know of another Script like the one listed above? Perhaps a snippet that is floating around already?
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
645
Reaction score
277
First Language
English
Primarily Uses
RMMV
Hey another question/thought. After meddling witth 0.772B for a few days, I wanted to try to use some interactive skills. Legend of Dragoon. Wild arms, etc style.

http://sumrndm.site/timed-attack-core/

Something like that. I added the Script into the 0.772B and while it didn't crash or anything it just, didn't do anything. Lol. :hswt2:

My thoughts are something just isn't updating correctly / or conflicting with the scene update of sorts. Sadly My Java isn't the greatest and LeTBS core is a pretty hefty chunk of code :rswt

Can someone point me in the general direction?

or does someone know of another Script like the one listed above? Perhaps a snippet that is floating around already?
Pretty sure LeTBS doesnt use the normal attack functionns when invoking forceAction, that wont work.
At leas nit wothout rewriting quite a few chunks of the core code.
 

Myers & Sparks

Veteran
Veteran
Joined
Jan 2, 2017
Messages
91
Reaction score
3
First Language
English
Primarily Uses
RMMV
Pretty sure LeTBS doesnt use the normal attack functionns when invoking forceAction, that wont work.
At leas nit wothout rewriting quite a few chunks of the core code.
I figured it does considering it uses the Dmg formula from skill #1 to express the damage done to enemy.

Edit: Furthermore it wont work on skills either.
 
Last edited:

Myers & Sparks

Veteran
Veteran
Joined
Jan 2, 2017
Messages
91
Reaction score
3
First Language
English
Primarily Uses
RMMV
Think I found a work around but, as expected there would still be an issue.

I found this during some digging: https://forums.rpgmakerweb.com/index.php?threads/quick-time-events-r2-26-11.71268/

I was able to get it to work(ish) once again doesn't break anything or give strange errors. Even works in battle too by running a common event from the skill.

upload_2019-8-17_0-1-57.png



Common event.

upload_2019-8-17_0-2-25.png



The problem is that it calculates the damage before analyzing the input. D'oh! :frown:


upload_2019-8-17_0-3-51.png


Any thoughts how to make input required before checking for DMG?

Saw some comments further back about .floating damage and forcing actions.

Thanks in advance:hwink:
 

Attachments

Myers & Sparks

Veteran
Veteran
Joined
Jan 2, 2017
Messages
91
Reaction score
3
First Language
English
Primarily Uses
RMMV
Not really. From a technological standpoint, the battle is still taking place in a different "battle scene", so it actually has to re-fetch the current map's data (as if you had just been transported to the map fresh) to use when building things like the actual display map, the tile passibilities, and where to place characters.

The best I've found is just pre-placing all the combatants based on where they should be at the start of the fight.
When I tried to do this it freaked out on me. It acted like I had no one to select and wouldn't let me "Start Battle"
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
645
Reaction score
277
First Language
English
Primarily Uses
RMMV
Think I found a work around but, as expected there would still be an issue.

I found this during some digging: https://forums.rpgmakerweb.com/index.php?threads/quick-time-events-r2-26-11.71268/

I was able to get it to work(ish) once again doesn't break anything or give strange errors. Even works in battle too by running a common event from the skill.

View attachment 121349



Common event.

View attachment 121350



The problem is that it calculates the damage before analyzing the input. D'oh! :frown:


View attachment 121351


Any thoughts how to make input required before checking for DMG?

Saw some comments further back about .floating damage and forcing actions.

Thanks in advance:hwink:
Thos is because common events run at the end of the skill
 

Myers & Sparks

Veteran
Veteran
Joined
Jan 2, 2017
Messages
91
Reaction score
3
First Language
English
Primarily Uses
RMMV
Thos is because common events run at the end of the skill
So is there currently anyway to force a player to make a secondary action? I might still be able to string something interesting together if so. If not I'll have to wait to 0.8 :rswt
 

Aezriel

Shadow Slayer
Member
Joined
Mar 28, 2019
Messages
16
Reaction score
0
First Language
English
Primarily Uses
RMMV
So I've been using the Lecode Tactical Battle System for awhile now and I've ran into a problem.
I'm trying to make a skill that allows the character to transform into something else. It will change the characters sprite in battle and change its class. I made the skill, gave it an animation, then i made a common event that when activated, changed the class of Actor 0001 to the class for the transformation and after that, it would change the sprite of actor 0001 to the sprite for the transformation. I use the skill in battle and the animation works, his class changes, but the sprite wont change mid battle. Is there a way to make this work?

Common Event:
upload_2019-8-18_17-55-32.png

Skill:
upload_2019-8-18_17-56-37.png
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
645
Reaction score
277
First Language
English
Primarily Uses
RMMV
So I've been using the Lecode Tactical Battle System for awhile now and I've ran into a problem.
I'm trying to make a skill that allows the character to transform into something else. It will change the characters sprite in battle and change its class. I made the skill, gave it an animation, then i made a common event that when activated, changed the class of Actor 0001 to the class for the transformation and after that, it would change the sprite of actor 0001 to the sprite for the transformation. I use the skill in battle and the animation works, his class changes, but the sprite wont change mid battle. Is there a way to make this work?

Common Event:
View attachment 121510

Skill:
View attachment 121511
I was actually working on something like that. I actually got a "Transfigure Skill" working. Where it transformed actors/enemies into puppies.
I'll try to get you the correct steps tomorrow.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Brother made thumbnails for my Lets Plays. He's a swood dude.
Since I'm getting so busy (the fact that I'm often here is due to the fact that this is my procrastination #1 destination), I'm trying a new system where everyday I dedicate 30 minutes to my personal game project. That way it won't fall into the abyss.
In today's seminar:
Presenter: In the past, there was a saying, "One who has tuberculosis is doomed for life." But now-
Everyone: *starts coughing in unision*
Gosh... Today seems too much like a good day to do nothing....

I need to keep myself focused...! :kaoback:

Forum statistics

Threads
93,699
Messages
914,744
Members
123,300
Latest member
jamssi
Top