Lecode Tactical Battle System 0.77.2B

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
764
Reaction score
357
First Language
English
Primarily Uses
RMMV
I was just about to suggest eval(). :LZYgrin:
eval(b.isStateAffected(StateId)) should add the restriction you are looking for.

I would strongly advise against editing the script especially regular expressions.
For example:
var string1 = "Astring";
string1.match(/string/i); // is not false
Eval is definitely better here.

I'll need to do testing to see if it supports LeUtilities though.

Edit.
works perfectly fine. You should use Eval instead then.
so you can use
scope_select: eval(LeUtilities.isEnemy(user.battler(), e.battler()) && e.battler().isStateAffected(220))
and
scope_select: eval(LeUtilities.isAlly(user.battler(), e.battler()) && e.battler().isStateAffected(220))
 
Last edited:

Adventurer_inc.

Technically a Programmer
Veteran
Joined
Sep 12, 2015
Messages
99
Reaction score
41
First Language
English
Primarily Uses
RMMV
According to your screenshots Lecode's eval() runs native javascript eval() directly. You can even do:
scope_select: eval($gameParty.gainGold(1000))
and gain 1000 gold.

He also declared a and b so you could use a and b like in the damage formula with out declaring it:
var b = e.battler();
var a = user.battler();
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
764
Reaction score
357
First Language
English
Primarily Uses
RMMV
According to your screenshots Lecode's eval() runs native javascript eval() directly. You can even do:
scope_select: eval($gameParty.gainGold(1000))
and gain 1000 gold.

He also declared a and b so you could use a and b like in the damage formula with out declaring it:
var b = e.battler();
var a = user.battler();
Sure can.
interesting to note though, that
scope_select: eval($gameParty.gainGold(1000))
doesn't eval properly, so the skill won't actually be able to target anything.
eval runs the javascript, sure. But unless it evaluates to true (The entire thing) it will not allow you to select anything.
 

Sissel Cabanela

Veteran
Veteran
Joined
Mar 28, 2016
Messages
110
Reaction score
21
First Language
English
Primarily Uses
@Pharonix
Yer' a saint boss. I've been working on making my system more FE like, so I've coded in a functioning Attack -> Counter -> Followup system and cooldowns gated by battle activity for anyone interested, though it could use work. Additionally I have a question: Double attacks don't work, no? Is there a way to make the Attack +1 and such repeats actually function? Seems a bit wonky unless you make a sequence that contains multiple action hits, I think. Is there no way to make it repeat the SAME sequence twice, for instance? I'm trying to make a weapon that guarentees a double attack when initiating combat.
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
764
Reaction score
357
First Language
English
Primarily Uses
RMMV
@Pharonix
Yer' a saint boss. I've been working on making my system more FE like, so I've coded in a functioning Attack -> Counter -> Followup system and cooldowns gated by battle activity for anyone interested, though it could use work. Additionally I have a question: Double attacks don't work, no? Is there a way to make the Attack +1 and such repeats actually function? Seems a bit wonky unless you make a sequence that contains multiple action hits, I think. Is there no way to make it repeat the SAME sequence twice, for instance? I'm trying to make a weapon that guarentees a double attack when initiating combat.
Currently, only one sequence call per skill, but what you CAN do is use a sequence to call another skill.

I have a skill called "Blinding Smite"
Which does normal damage to an enemy, and deals an additional attack dealing up to the user's attack power as additional damage.

I took this from DnD. Where the skill does physical damage and an extra dice roll of light damage.

upload_2018-2-3_18-57-32.png

However, the sequence is this:

"blinding_smite": [
"set_frame: user, atk, 0",
"wait: 15",
"play_pose: user, atk",
"effects: {aoe}_enemies, current_obj, obj_anim",
"use_skill: user, 608",
],

When used, it makes the user use the Second Blinding Smite (608) in my database
I gave it no scope or aoe damage, because it uses the same target you selected with the original skill.

upload_2018-2-3_18-58-12.png


hope this helps.
 

Sissel Cabanela

Veteran
Veteran
Joined
Mar 28, 2016
Messages
110
Reaction score
21
First Language
English
Primarily Uses
@Pharonix
Hm, I've seen such, but it's not exactly what I'm looking for. Granted, I CAN use that for a certain type of weapon. Anyway, perhaps a better question would be is this: How do I FORCE an action without using sequences? For instance, and this seems to be the closest toward what I'm looking for, the Yanfly Skill Core incorporated with the engine? I made a Fire Emblem Counter system, but it's already showing issues in flexibility.

My current System looks like this:

Attacker initiates attack, applying 'Attacker' state to themselves and 'Defender' state to the target, which grants them 100% Counter Rate
Defender, due to 100% Counter Rate, returns fire. The Before Eval with the skill core will check if the person is currently afflicted with the Defender state and thus doing a counter attack. If they Defender is 5 or more AGI slower than the Attacker, the Attacker is granted the 'Follow Up' State before damage is done, granting THEM 100% Counter Rate, meaning they can return fire once more and end combat there.

That part, er, ALONE works, to a semi-usable degree. Here are the issues with this clearly crude system:
  • The Follow-up is RELIANT on the opponent being able to retaliate. So if you attack an opponent who CANNOT return fire(ie, you are an Archer and they have a Sword), you cannot perform a follow-up because the follow-up attack is just a prettied up Counter
  • Likewise, if the DEFENDER has 5 or more speed than the opponent, they cannot double-attack with their counter even though they outspeed due, again, PRETTY BOI COUNTER
I think the main issue to this system is that I don't know how to make a force action work with the Skill Core, because I can't seem to find the script call for it(and assuming it would work with LeTBS. Sorry to bombard you, but you have any suggestions?
 

Adventurer_inc.

Technically a Programmer
Veteran
Joined
Sep 12, 2015
Messages
99
Reaction score
41
First Language
English
Primarily Uses
RMMV
@Pharonix
You are quite insightful. I hope you don't mind me borrowing that idea also.

@Sissel Cabanela
You might be looking for this:
"obj" in the param can be a skill object such as $dataSkills[skillId]
"entity" is the target entity and can be called such as target.getEntity() in a yanfly notebox
Code:
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);
    entity.checkDeath();
};
There is also this:
I personally prefer this one because instead of triggering a skill you have complete control of the damage flow.
Code:
BattleManagerTBS.applyFloatingDamage = function (amount, target) {
    target.battler().gainHp(-amount);
    target.addPopup();
    target.callSequence("damaged");
    target.checkDeath();
};
Such as this notebox code that triggers an explosion on death that hits targets in-front and beside the dying target using Yanfly's BuffStatesCore:
Code:
<Custom React Effect>
if (b.hp - value < 1){
  var entity = b.getEntity();
  var cells = [];
  cells.push(entity.getBackwardCell());
  cells.push(entity.getForwardCell());
  cells = cells.concat(entity.getSideCells());
  for(var i = 0; i < cells.length; i++){
    var target = cells[i].getEntity();
    if(!target) continue;
    target.newAnimation(1, false, 0);
    BattleManagerTBS.applyFloatingDamage(b.atk, target);
  }
}
</Custom React Effect>
 

Sissel Cabanela

Veteran
Veteran
Joined
Mar 28, 2016
Messages
110
Reaction score
21
First Language
English
Primarily Uses
@Adventurer_inc.
Wow! That was one of my main concerns, since I was unsure of Yanfly could reference LeTBS entities like that!

I thank you for the new option to control the damage flow, but in this case I specifically need to sort of 'action rally', if that makes sense, or 'action chain' rather.

For instance, and here's what I've been stuck on desperately: Vantage. Vantage is a skill in the Fire Emblem games that, if the User is attacked when below a certain threshold of HP and can perform a counter, they will attack BEFORE the Attacker has the chance to even start their assault. And THEN the Attacker will proceed to attack normally. I've been toying with skill sequences trying to get this to work, including evals and delegate_calls, but no dice.

Looking at the first code box, I can probably use ForceAction to force the user to use a 'Follow Up' Attack Skill if the Agility criteria are met, I'd think. The only reason I don't wish to use the applyFloatingDamage function is began certain effects only activate when the skill is USED that need to be accounted for, such as the effects of the <Custom Initiate Effect> in some cases which I am using. Sorry if I am unclear, but I GREATLY appreciate your assistance, I've been driving myself up a wall with my ineptitude.

Edit: To show I'm not, ya know, entirely sitting on my hands here, I fumbled around a bit with the forceAction trying to replicate Vantage. What I did was give the DEFENDER a State with the following:
<Custom Select Effect>
BattleManagerTBS.forceAction($dataSkills[1],origin.getEntity());
</Custom Select Effect>
Which results in the DEFENDER getting attacked, then PUNCHING THEMSELF. Honestly, it was amazing to watch. However, I see I've gotten the order wrong(the DEFENDER should at least punch himself BEFORE getting attacked) as well as the targeting. Am I off base here?
 
Last edited:

Adventurer_inc.

Technically a Programmer
Veteran
Joined
Sep 12, 2015
Messages
99
Reaction score
41
First Language
English
Primarily Uses
RMMV
@Sissel Cabanela
Glad I can help. I'm always looking for new mechanics since I couldn't have played all of the games. The noticeable key difference between forceAction() and applyFloatingDamage() is that forceAction() is a literally an attack that can trigger other effects while applyFloatingDamage() is a "fake attack". I even had to do "target.newAnimation(1, false, 0);" to play an animation #1. LZYskeptic

Edit: You might be falling into the processCounterAttack() trap I'm still trying to figure out a clean work around. As you can see below, the active entity and target flips during a counter attack on the active entity's turn.
Code:
BattleManagerTBS.processCounterAttack = function (targets, subject, action) {
    if (!action) return;
    this.setCursorCell(subject.getCell());
    targets.forEach(function (entity) { // Can't counter allies or yourself
        if (entity && !LeUtilities.isAlly(subject.battler(), entity.battler())) {
            var dist = LeUtilities.distanceBetweenCells(subject.getCell(), entity.getCell());
            if (dist <= 1 && Math.random() < action.itemCnt(entity.battler())) {
                var skill = $dataSkills[entity.battler().counterSkillId()];
                subject.battler().clearResult();
                entity.lookAt(subject.getCell());
                entity.addTextPopup("Counter");
                entity.startSequence("counter");
                this.forceAction(skill, entity);
            }
        }
    }.bind(this));
};
Edit 2: I accidently posted my edited one instead of the original one. You can ignored the "&& !LeUtilities.isAlly(subject.battler(), entity.battler())", unless you don't want to counter allies or counter yourself. It got super werid for me.
 
Last edited:

Sissel Cabanela

Veteran
Veteran
Joined
Mar 28, 2016
Messages
110
Reaction score
21
First Language
English
Primarily Uses
@Sissel Cabanela
Edit: You might be falling into the processCounterAttack() trap I'm still trying to figure out a clean work around. As you can see below, the active entity and target flips during a counter attack on the active entity's turn.
Code:
BattleManagerTBS.processCounterAttack = function (targets, subject, action) {
    if (!action) return;
    this.setCursorCell(subject.getCell());
    targets.forEach(function (entity) { // Can't counter allies or yourself
        if (entity && !LeUtilities.isAlly(subject.battler(), entity.battler())) {
            var dist = LeUtilities.distanceBetweenCells(subject.getCell(), entity.getCell());
            if (dist <= 1 && Math.random() < action.itemCnt(entity.battler())) {
                var skill = $dataSkills[entity.battler().counterSkillId()];
                subject.battler().clearResult();
                entity.lookAt(subject.getCell());
                entity.addTextPopup("Counter");
                entity.startSequence("counter");
                this.forceAction(skill, entity);
            }
        }
    }.bind(this));
};
I don't THINK so, at least, not yet. I have not yet enabled the Counter Attack yet, the Counter Attack Rate is current 0. The only thing that state has is the code I posted above. I'm not currently trying to get the Counter Attack working, just the Vantage element of attacking FIRST in response to being targetted for an attack. Does that make sense?
 

Adventurer_inc.

Technically a Programmer
Veteran
Joined
Sep 12, 2015
Messages
99
Reaction score
41
First Language
English
Primarily Uses
RMMV
<Custom Select Effect>
BattleManagerTBS.forceAction($dataSkills[1],origin.getEntity());
</Custom Select Effect>
Try changing "origin" to "b". I'm still trying to get the feel for Yanfly's variables. Trial and Errors.

Edit:
I think I'm starting to see what you are trying to do. You want the counterattack to hit before the initial attack. That is quite tricky to do. I'll try diving deeper.
 

Sissel Cabanela

Veteran
Veteran
Joined
Mar 28, 2016
Messages
110
Reaction score
21
First Language
English
Primarily Uses
Try changing "origin" to "b". I'm still trying to get the feel for Yanfly's variables. Trial and Errors.
Same result my man, origin and b refer to the same entity(the defender) in this scenario, plugged it in to be sure. On another note, playing around with processCounterAttack as an alternative for ForceAction. Not getting much mileage but that's likely because I'm using it entirely wrong in terms of what arguments and being passed by the function.
 

Adventurer_inc.

Technically a Programmer
Veteran
Joined
Sep 12, 2015
Messages
99
Reaction score
41
First Language
English
Primarily Uses
RMMV
@Sissel Cabanela
If "b" doesn't work then it can only be "a".

The thing about sequences is that LeCode purposely queries them one after another purposefully to prevent bugs. You can't have the same entity doing two different things at the same time now.
 

Sissel Cabanela

Veteran
Veteran
Joined
Mar 28, 2016
Messages
110
Reaction score
21
First Language
English
Primarily Uses
@Sissel Cabanela
If "b" doesn't work then it can only be "a".

The thing about sequences is that LeCode purposely queries them one after another purposefully to prevent bugs. You can't have the same entity doing two different things at the same time now.
Mmm, see, a in this scenario is attacker, which results in the Attacker doing a weird (presumably) attack animation toward nothing. You are correct in that what I'm trying to do is making it so that the defender will counter attack before the initial hit, but I think it might currently be impossible? For now, I'm gonna see if I can get the other aspects of the Battle Flow functioning and hopefully circle back to that. I appreciate your assistance!
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
764
Reaction score
357
First Language
English
Primarily Uses
RMMV
Mmm, see, a in this scenario is attacker, which results in the Attacker doing a weird (presumably) attack animation toward nothing. You are correct in that what I'm trying to do is making it so that the defender will counter attack before the initial hit, but I think it might currently be impossible? For now, I'm gonna see if I can get the other aspects of the Battle Flow functioning and hopefully circle back to that. I appreciate your assistance!
yanfly's counter control might have something that can help

theres a section for
'Counter Condition"
http://yanfly.moe/2016/03/11/yep-82-counter-control/

If you want the counter to go first, this probably won't help you, but it is worth looking at.

The problem with counters is they don't typically go first.
 

Sissel Cabanela

Veteran
Veteran
Joined
Mar 28, 2016
Messages
110
Reaction score
21
First Language
English
Primarily Uses
yanfly's counter control might have something that can help

theres a section for
'Counter Condition"
http://yanfly.moe/2016/03/11/yep-82-counter-control/

If you want the counter to go first, this probably won't help you, but it is worth looking at.

The problem with counters is they don't typically go first.
Indeed, that's what I'm using. I'm gonna use a 'workaround' that just making the Counter evade the first attack(normally they can hit) and return fire, but guarantee the Attacker can try to attack again. Probably. I'm looking at processCounterAttack, but I'm a bit stumped: How can I tell if the opponent is in range to counter? By opponent, in this scenario I mean the defender.

Edit: So after looking a bit closer, I see the line to determine the range for Counter Attack:
Code:
var dist = LeUtilities.distanceBetweenCells(subject.getCell(), entity.getCell());
            if (dist <= 1 && Math.random() < action.itemCnt(entity.battler())) {
Gonna play around with it and see I can 'fix it', aka make it not a static 1 but rather match the range of the defender's attackskill scope.

EDIT 2: So...turns out I wasn't on the most recent version of LeTBS. Updated from 75 and now counters are...worse! Enemy can counter, but for some reason the ally party member cannot, even with 1000% CNT Rate. Could this be the same issue you were getting before, @Adventurer_inc. ? Something about not reaching the end of the sequence?
 
Last edited:

Adventurer_inc.

Technically a Programmer
Veteran
Joined
Sep 12, 2015
Messages
99
Reaction score
41
First Language
English
Primarily Uses
RMMV
@Sissel Cabanela
Sorry, I usually avoid tackling those kinds of problems (problems where you have to edit the script directly) because they usually cause more problems than they solve.

It's not impossible to do to say at least. My solution would be to build an attack sequence at the location where an attack is declared but before it is run. Not very robust but will definitely work. Don't forget to check deaths.

You have hit the correct spot for checking distance!
 

Sissel Cabanela

Veteran
Veteran
Joined
Mar 28, 2016
Messages
110
Reaction score
21
First Language
English
Primarily Uses
@Sissel Cabanela
Sorry, I usually avoid tackling those kinds of problems (problems where you have to edit the script directly) because they usually cause more problems than they solve.

It's not impossible to do to say at least. My solution would be to build an attack sequence at the location where an attack is declared but before it is run. Not very robust but will definitely work. Don't forget to check deaths.

You have hit the correct spot for checking distance!
I can avoid the early counter thing for now, but THANK YOU for that suggestion, that's a great idea. However, I noticed you posted earlier about endofsequence issues after updating, and I'm experiencing the same. Is there a fix for that? It's getting the in the way of doing even standard counters.
 

Adventurer_inc.

Technically a Programmer
Veteran
Joined
Sep 12, 2015
Messages
99
Reaction score
41
First Language
English
Primarily Uses
RMMV
I can avoid the early counter thing for now, but THANK YOU for that suggestion, that's a great idea. However, I noticed you posted earlier about endofsequence issues after updating, and I'm experiencing the same. Is there a fix for that? It's getting the in the way of doing even standard counters.
I'd hate to say this but you are going have to wait for @Lecode for those types of issues. Your problem can stem from its version or it might even be script conflicts. If it works in the demo but breaks in yours the problem could be just about anywhere. :LZYyuck:
 

TWings

The Dragon Whisperer
Veteran
Joined
Jul 26, 2017
Messages
527
Reaction score
860
First Language
French
Primarily Uses
RMMV
I've been looking for a way to add some light tactical battles in my project for a while and this plugin seems to be able to do the trick (and so much more), so thank you for the hard work.
Anyway, I started to implement it yesterday (last 0.77.1 version) and I'm stuck on the sprite part.
I tried several ways of using the character tags without much success.
For now, I'm only trying to use the RTP
First in the way of the old version demo :
Code:
<letbs_sprite>
use_character
sprite_name: Hero1
auto_turn_order_face
auto_status_sprite
</letbs_sprite>
Then I noticed the plugins comments and tried that :
Code:
<letbs_sprite>
pose(): use_chara, Hero1, 0
turn_order: auto
status_sprite: auto
</letbs_sprite>
But I'm always getting a "The battler 'Xxxxx' has no sprite configuration!" error.
I'm sure I'm missing something. Are the tags somehow wrong ? Do I need to define every pose even though I wish to use the RTP ?
I would really appreciate if someone could give me some pointers to set it up properly.
 
Last edited:

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

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,033
Messages
1,018,441
Members
137,820
Latest member
georg09byron
Top