Lecode Tactical Battle System 0.77.2B

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
I use 1.5.2 so thats no issue
However my code is built on 77 base not 77.2B, however some of the good fixes from later versions are present.

I could release my full dev. build with all my code.
This would include my main .js files (like managers.js) as I have edited some of them with fixes for some things.

As for my customizations, most of them are denoted in my code with //Modified by PHX
So if you find fixes you want as a plugin, it should be more than easy enough to convert the code into a working plugin.

But yeah, some of my fixes might not be particularly.... super user friendly right out of the box, as most of my fixes/features were created especially for my game.

But yeah, if you find something you like, just let me know, and I can see what I can do for you.

=======================

Update 6/19/2020

The code I added which modifies getObjectSequenceData
works like a charm

JavaScript:
TBSEntity.prototype.getObjectSequenceData = function (obj) {//Modified by PHX
    var defaultSeqId = DataManager.isSkill(obj) ? Lecode.S_TBS.defaultSkillSequence : Lecode.S_TBS.defaultItemSequence;
    var e = BattleManagerTBS.activeEntity();
    //Check if the obj has a sequence
    if (obj.TagsLetbs.sequence)
    {
        //If it does, collect it into a variable, and check if it is a function.
        objSequence = obj.TagsLetbs.sequence;
        if(objSequence.includes("()"))
        {
            console.log(objSequence);
            //If it is a function, evaluate it, and return the sequence
            str = eval(objSequence);
            return str;
        }
        return obj.TagsLetbs.sequence;
    }
    //Return normal stuff. Redundant actually as we check above if obj has a sequence and we return it if it is not a function.
    //But whatever
    return obj.TagsLetbs.sequence || defaultSeqId;
};


Then I created a new function called vorpal which has a 4-3-2-1 pull for now.
I will at some point be checking states and whatnot but this is just for testing and I needed something simple like a random number generator for simple testing.

A Vorpal Sword will have like a 20% chance of additional attacks which will eventually be 5 conditionals that check for a % roll and if it succeeds it goes up by one hit, but the second it fails, it returns the sequence I set aside for the number of hits

for example:
rolls 51 -> hits = 2
rolls 67 -> hits = 3
rolls 19 -> return "atk3" (which is then processed by the sequence manager)

JavaScript:
TBSEntity.prototype.vorpal = function () {
    var hits = Math.floor(Math.random()*10+1);
    console.log(hits);
    switch (hits) {
    case 1:
        return "atk2";
    case 2:
        return "atk2";
    case 3:
        return "atk2";
    case 4:
        return "atk2";
    case 5:
        return "atk3";
    case 6:
        return "atk3";
    case 7:
        return "atk3";
    case 8:
        return "atk4";
    case 9:
        return "atk4";
    case 10:
        return "atk5";
    }
};
 
Last edited:

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
809
First Language
English
Primarily Uses
RMMV
Ok, so I finally got combat working w/o a hitch...EXCEPT my attacks (normal basic attack, i.e. skill #1) do 0 damage. The monsters, who also use the same skill #1 attack, deal damage just fine tho... What could be the problem? Animations play just fine too, it's just the damage is always 0 from the player side.

Edit: I just tried it w/ ALL plugins off (except LTBS plugins of course) and it still does 0 damage.
Edit2: Ok, I just noticed that ONLY normal attack is affected...sigh whyyy :kaocry:
Edit3: I've narrowed it down to the fact that anything that has the element: Normal Attack is affected.
How do I fix this while still keeping the Normal Attack feature (i.e. the skill uses the weapon's element)
EDIT4: OMFG YES I FIXED IT!!!:kaopride:
It was all cuz I had edited my main js files to make elemental rates additive instead of multiplicative, and I forgot to give the enemy 100% base elemental rates. So the "normal" attack was using blunt/slash/pierce element against something that was immune lol. Jeez. I'm such a tard.
 
Last edited:

Jessku

Warper
Member
Joined
Jun 21, 2020
Messages
1
Reaction score
0
First Language
English
Primarily Uses
RMMV
Is anyone having trouble downloading the plugin? Every time I try to it says page not found :(
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
809
First Language
English
Primarily Uses
RMMV
Is anyone having trouble downloading the plugin? Every time I try to it says page not found :(
Link works fine for me: https://www.dropbox.com/s/du45ml08yybqulf/LeTBS_0772B.rar?dl=0

Also, does anyone know how or what part of the plugin do I edit if I want the unit sprites to be 6pixels higher across the board?

Edit: I just found a huge bug, AttackTimes+ doesn't work at all! Please help! This feature is critical to my game...
 
Last edited:

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
Link works fine for me: https://www.dropbox.com/s/du45ml08yybqulf/LeTBS_0772B.rar?dl=0

Also, does anyone know how or what part of the plugin do I edit if I want the unit sprites to be 6pixels higher across the board?

Edit: I just found a huge bug, AttackTimes+ doesn't work at all! Please help! This feature is critical to my game...
Are you referring to the state / actor effect Attack Times+?
Because by default skills use the attack or skill sequence, which only attacks once.
You would need my edited code for getSequence data and create a function for it that returns the right number of hits and add in the conditionals.
I did it with Vorpal sword (a weapon that attacks 2-5 times)


my vorpal function, has a 25% chance to upgrade number of hits, and checks 3 times (which would increase it to 5 hits if all succeed)

TBSEntity.prototype.vorpal = function () {
var hits = 2;
var hit = Math.floor(Math.random()*100+1);
if(hit<=25)
hits+=1;
var hit = Math.floor(Math.random()*100+1);
if(hit<=25)
hits+=1;
var hit = Math.floor(Math.random()*100+1);
if(hit<=25)
hits+=1;
console.log(hits);
switch (hits) {
case 2:
return "vorpal2";
case 3:
return "vorpal3";
case 4:
return "vorpal4";
case 5:
return "vorpal5";
}
};

Then for the sequences I just put the following in my LeTBSconfig.js file:


"vorpal2": [
"play_pose: user, atk",
"wait: 10",
"effects: {aoe}_battlers, current_obj, obj_anim",
"effects: {aoe}_battlers, current_obj, obj_anim",
"wait: 60"
],

"vorpal3": [
"play_pose: user, atk",
"wait: 10",
"effects: {aoe}_battlers, current_obj, obj_anim",
"effects: {aoe}_battlers, current_obj, obj_anim",
"effects: {aoe}_battlers, current_obj, obj_anim",
"wait: 15"
],

"vorpal4": [
"play_pose: user, atk",
"wait: 10",
"effects: {aoe}_battlers, current_obj, obj_anim",
"effects: {aoe}_battlers, current_obj, obj_anim",
"effects: {aoe}_battlers, current_obj, obj_anim",
"effects: {aoe}_battlers, current_obj, obj_anim",
"wait: 60"
],

"vorpal5": [
"play_pose: user, atk",
"wait: 10",
"effects: {aoe}_battlers, current_obj, obj_anim",
"effects: {aoe}_battlers, current_obj, obj_anim",
"effects: {aoe}_battlers, current_obj, obj_anim",
"effects: {aoe}_battlers, current_obj, obj_anim",
"effects: {aoe}_battlers, current_obj, obj_anim",
],
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
809
First Language
English
Primarily Uses
RMMV
Thanks! This is super useful, btw you said the plugin had some code that forces the actor cells to always start at the event's initial location. What's the fix to that?

And for the code you posted earlier w/ the Vorpal Sword, where should I paste that snippet? Do I just stick it at the end of LeTBS.js?
Edit: Ok, I see, I'm supposed to overwrite the existing portion w/ your code.
So what if I want an actor who has an attackTimes+ trait or a state (in case we can't use attackTimes+) to attack more than once across the board (w/ normal attack and all physical attacks)?
i.e.: if (this.isAttack() || this.isPhysical())

I know where to put the sequences, but where did you put the function?
 
Last edited:

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
Thanks! This is super useful, btw you said the plugin had some code that forces the actor cells to always start at the event's initial location. What's the fix to that?

And for the code you posted earlier w/ the Vorpal Sword, where should I paste that snippet? Do I just stick it at the end of LeTBS.js?
Edit: Ok, I see, I'm supposed to overwrite the existing portion w/ your code.
So what if I want an actor who has an attackTimes+ trait or a state (in case we can't use attackTimes+) to attack more than once across the board (w/ normal attack and all physical attacks)?
i.e.: if (this.isAttack() || this.isPhysical())

I know where to put the sequences, but where did you put the function?
I just put the function in the main LeTBS.js file under any function for TBSEntity
In my case, I put it under

TBSEntity.prototype.getMovePoints = function () {
if (this.oneTimeMove() && this._movePerformed) return 0;
return Math.max(0, this._movePoints.clamp(0, this._movePoints));
};

As for making it apply to all physical skills, I cannot think of a solution right now.

However in your sequences you can try
"if: entity('user').battler().isStateAffected(X)",
"effects: {aoe}_battlers, current_obj, obj_anim",
"effects: {aoe}_battlers, current_obj, obj_anim",
"else",
"effects: {aoe}_battlers, current_obj, obj_anim",
"end_if",
But I cannot guarantee this will work.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
809
First Language
English
Primarily Uses
RMMV
Thanks, I will give it a shot and see what happens...
Just to double check, it should look like this right?:
JavaScript:
    "stuff": [
        "if: entity('user').battler().isStateAffected(X)",
        "effects: {aoe}_battlers, current_obj, obj_anim",
        "effects: {aoe}_battlers, current_obj, obj_anim",
        "else",
        "effects: {aoe}_battlers, current_obj, obj_anim",
        "end_if",
    ]
Basically referring to the brackets and stuff. So I'd have to add "sequence: stuff" to every single skill that could have an extra attack right? (don't worry, I will name stuff accordingly)
 
Last edited:

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
Thanks, I will give it a shot and see what happens...
Just to double check, it should look like this right?:
JavaScript:
    "stuff": [
        "if: entity('user').battler().isStateAffected(X)",
        "effects: {aoe}_battlers, current_obj, obj_anim",
        "effects: {aoe}_battlers, current_obj, obj_anim",
        "else",
        "effects: {aoe}_battlers, current_obj, obj_anim",
        "end_if",
    ]
Basically referring to the brackets and stuff.
that should be correct, but I don't know if it will work.
I just tried copying from atk_push and tried to make it apply here
Just make sure you replace (X) with the state you want to use.


"atk_push": [
"play_pose: user, atk",
"wait: 10",
"effects: {aoe}_battlers, current_obj, obj_anim",
"if: isHit('{aoe}_battlers')",
"set_speed: {aoe}_battlers, +6",
"push: {aoe}_battlers, user_cell, $1",
"set_speed: all, reset",
"end_if",
"wait: 60"
],
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
809
First Language
English
Primarily Uses
RMMV
If this works, it would open the door for so many possibilities. We wouldn't be limited to just .isStateAffected(), we could use anything! lol
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
If this works, it would open the door for so many possibilities. We wouldn't be limited to just .isStateAffected(), we could use anything! lol
VERY Good News.
It works.
I set "extra turn" (stateid 251 in my game) to be the test state for additional attacks, and used your "Stuff" sequence as it was.

This video shows it.
First battle has the state equipped, second, does not.

So anyone who wants to add if blah, then do multiple hits, you can use

"if: entity('user').battler().isStateAffected(251)",
"effects: {aoe}_battlers, current_obj, obj_anim",
"effects: {aoe}_battlers, current_obj, obj_anim",
"else",
"effects: {aoe}_battlers, current_obj, obj_anim",
"end_if",

And it will work,
most checks will be on the battler so just replace isStateAffected(X) with the correct command, or use something else.

To call it on the actual battler itself however, you will need to use
entity('user') to generate an entity, then use .battler() to call the battler of it.


EDIT:

Working on updating my getObjectSequence Data to allow for functions with variables.
My goal is to create a sequence: custom(fire) type of function call
which will, if it works, overwrite one of the sequences in LeTBSconfig.
These sequences, if I understand correctly, are only loaded at the beginning, so creating an "empty" sequence, then overwriting it with a new one via a function, should be completely viable.

Using the whole "use a function then return a call"

would work like


atk looks like this
"atk": [
"play_pose: user, atk",
"wait: 10",
"effects: {aoe}_battlers, current_obj, obj_anim",
"wait: 60"
],
But if I understand, the data returned for atk is this
["play_pose: user, atk" , "wait: 10" , "effects: {aoe}_battlers, current_obj, obj_anim" , "wait: 60"]

so this means, we can in theory, dynamically generate an array of valid effects and whatnot, then replace a "placeholder" function in
Lecode.S_TBS.Config.Sequences

Lecode.S_TBS.Config.Sequences is just an array, and LeTBS seems to call the id of "atk" when it pulls the sequence, so overwriting this, in the function call, then returning the "placeholder" as the sequence, if we overwrite "placeholder" correctly, custom, dynamic sequences should be completely possible.

With my updated code, I am checking if it supports functions with parameters
(such as createCustomSequence("Fire"))
Then in the function for it it'd be like

TBSEntity.prototype.createCustomSequence = function (seq) {
if(seq == "Fire")
{
//Build Fire Sequence
}
else if(seq == "Ice")
{
//Build Ice Sequence
}
else
{
// Return Atk, no valid match, return default sequence
return "atk";
}
};
 
Last edited:

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
809
First Language
English
Primarily Uses
RMMV
Question: What does "call: pre-skill" and "call: post-skill" do? Btw, how do I reference the attackTimes+ trait? I'm trying to do something akin to:
JavaScript:
    "dualWield": [
        "if: entity('user').battler().attackTimesAdd() >= 3",
        "effects: {aoe}_battlers, current_obj, obj_anim",
        "effects: {aoe}_battlers, current_obj, obj_anim",
        "effects: {aoe}_battlers, current_obj, obj_anim",
        "else if: entity('user').battler().attackTimesAdd() >= 2",
        "effects: {aoe}_battlers, current_obj, obj_anim",
        "effects: {aoe}_battlers, current_obj, obj_anim",
        "else",
        "effects: {aoe}_battlers, current_obj, obj_anim",
        "end_if",
    ]
I need to reference attackTimes+ somehow since 1-handed weapons grant +0.5 attackTimes+ so that if someone is dual wielding they get a total of +1 attackTimes+. Not to mention certain states that increase that figure.
 
Last edited:

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
Question: What does "call: pre-skill" and "call: post-skill" do?
Pre and Post-Skill are default sequences
call:
is used to call another sequence, using this, you can chain sequences together, or create a specific sequence that multiple sequences should use, and just call it, instead of rewriting the code 40 times.

"pre-skill": [
"call: cast(loop)",
"wait: 4",
"play_pose: user, atk, wait",
"set_frame: user, atk, last",
"wait: 2"
],

"post-skill": [
"wait: 10",
"play_pose: user, idle",
"wait: 10"
],
 

eaufidrane

Villager
Member
Joined
May 11, 2020
Messages
27
Reaction score
0
First Language
english
Primarily Uses
RMMV
please does anyone here can telll me what should i do to fix the error "cannot read property height undefined"?

that occurs when i procces a battle to a different map

thanks in advance for those who will try to help
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
does anyone here can telll me what should i do to fix the error "cannot read property height undefined"?

that occurs when i procces a battle to a different map

thanks in advance for those who will try to help
Did you make sure there are events tagged <Actor Cell> and <Enemy Cell> on the battle map.
Are the sprites configured properly?
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
809
First Language
English
Primarily Uses
RMMV
@eaufidrane Also, make sure your list of animations goes up to at least 280 (it can be blank).

Edit: For some reason, when I try to add ANY sequences, such as the one for "Stuff" I get this error:
Error.png
What am I doing wrong? I doubt it's the sequence itself since you've confirmed it to work...
Edit: Derp, I simply forgot a comma... -.-
 
Last edited:

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
@eaufidrane Also, make sure your list of animations goes up to at least 280 (it can be blank).

Edit: For some reason, when I try to add ANY sequences, such as the one for "Stuff" I get this error:
View attachment 148558
What am I doing wrong? I doubt it's the sequence itself since you've confirmed it to work...
Edit: Derp, I simply forgot a comma... -.-
If you put in your dual-wield and "stuff" sequences exactly as you posted, you missed a comma after the closing square bracket ]
sequences are an array, so missing a comma will break stuff.
EDIT: Didn't see your Edit the first time.
 

eaufidrane

Villager
Member
Joined
May 11, 2020
Messages
27
Reaction score
0
First Language
english
Primarily Uses
RMMV
Did you make sure there are events tagged <Actor Cell> and <Enemy Cell> on the battle map.
Are the sprites configured properly?
yeah there are events tagged with that actually it works fine on the default map but whenever i created a map and process a battle on it and then this error always shows up
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
809
First Language
English
Primarily Uses
RMMV
So for some reason, it's not working for me at all. Even using the unmodified: (using state #9)
JavaScript:
    "stuff": [
        "if: entity('user').battler().isStateAffected(9)",
        "effects: {aoe}_battlers, current_obj, obj_anim",
        "effects: {aoe}_battlers, current_obj, obj_anim",
        "else",
        "effects: {aoe}_battlers, current_obj, obj_anim",
        "end_if",
    ]
I made sure to put this in the skill notebox:
JavaScript:
<letbs>
scope: circle(1)
sequence: stuff
</letbs>
I also also made the additions to getObjectSequenceData in LeTBS.js, what else am I missing?

Edit: I got rid of the conditional statement and just left 2 lines of "effects:", and it still uses the normal atk sequence. Basically, I think it's not even calling the sequence...halp >.>

Maybe its cuz of the modifications to getObjectSequenceData? As in is there a special procedure for calling sequences w/ this edit? It just seems like...
<letbs>
sequence:
</letbs>
...isn't doing anything. The only way I've been able to test my sequences is by editing the default sequence in the plugin options.

Edit: Okay, it looks like it was because the attack command always uses the sequence you set in the plugin options. I'm using YEP_WeaponUnleash so I thought the attack skill would be changed to w/e I had on my weapon, but I guess it doesn't...
 
Last edited:

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
I dint use the default atk, too much headache
Instead i use the extra skill and put that on each weapon, so each weapon gets its own skill.
Then i remove attack from commands available

Did Yanflys weapon unleash work before?
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Stream will be live shortly with some Darkest Dungeon! Feel free to drop by!
I made a battle results screen for my minigame.. any feedback? :)
Things I thought would never happen but just did: I needed to use my snow shovel. In August. In the Northern Hemisphere.
So I finished Cupcake, now I need to figure out my next project!
Do I pick up one of my incomplete games?
Do I start something entirely new???
The possibilities are endless!
Am I the only one who keeps thinking TPBS means "Turn Press Battle System" and not "Time Progress Battle System?"

Forum statistics

Threads
100,678
Messages
978,348
Members
132,300
Latest member
belphe89
Top