Lecode Tactical Battle System 0.77.2B

Chaosicaa

Veteran
Veteran
Joined
Dec 22, 2016
Messages
95
Reaction score
121
First Language
French
Primarily Uses
@Amarok Wow, beautiful graphics you got there :)
Well, I see 2 solutions but they might not be the best!

If you are going for the multi actors route there is something you can do with YEP_UtilityCommonEvents.
I really like this script because you can run common events at the moment you close your menu for example.

Example :
Actor 1 with no weapon on ID 10
Actor 1 with weapon 1 on ID 11
Actor 1 with weapon 2 on ID 12
Actor 1 with weapon 1 on ID 13
Actor 2 with no weapon on ID 20 ...

That way if you add weapons later it will be easier to read!

When you close menu with actor 1 weapon 2 equipped, you can set up a common event that will check actor weapons (check 10,11,12,13) and change character (add then remove) (be sure to check equipment and change it too)
That way you can even display your characters with weapon equipped outside battle, and have interaction with people being afraid to talk with someone with a drawn sword)

For the second solution, there is a plugin made by SRD (common event battle intro) to display an intro as a common event (This plugin is LeTBS compatible).
You can of course not display an intro and use this to call a common event with a script call to change your characters graphics used by LeTBS at the start of each fights.

Unfortunately I do not know what the script call might be :(
 

Amarok

Veteran
Veteran
Joined
Dec 15, 2016
Messages
294
Reaction score
712
First Language
Spanish
Primarily Uses
RMMV
@Chaosicaa thanks! glad you like the graphics :D
i think for now i will go for solution 1, but yeah if i knew exactly the script call (if there is one) to change the battlers graphics that would be the perfect solution!
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
733
Reaction score
327
First Language
English
Primarily Uses
RMMV
Hi,

May I know if the move_points can be a range like the scope: circle(3,1) of certain attack? I would like my battler to move similar to a knight in Chess but not necessarily L shape. The point is to have a minimum move_points not just always 0 up to set move_points.
You might end up loving me for this.

according to the documentation:
you can add this tag to the actor:

move_scope: circle(3,1)

But for example, a knight can move 3 spaces out, 2 forward, one to left/right. Like this:
upload_2018-8-30_10-23-20.png
the aoe/scope for this is
data: "[cx-1,cy-2],[cx+1,cy-2],[cx-2,cy-1],[cx+2,cy-1],[cx-2,cy+1],[cx+2,cy+1],[cx-1,cy+2],[cx+1,cy+2]"

copy/paste for aoe/scopes in config:
"knight_move": {
data: "[cx-1,cy-2],[cx+1,cy-2],[cx-2,cy-1],[cx+2,cy-1],[cx-2,cy+1],[cx+2,cy+1],[cx-1,cy+2],[cx+1,cy+2]"
},

In actor tags, this becomes
move_scope: custom(knight_move)
upload_2018-8-30_10-41-46.png

Sample Video:
https://www.dropbox.com/s/crak4c6ufa9ogcl/custom_move_scope.mp4?dl=0

Edit:
Not sure why I didn't realize this sooner lol.
 
Last edited:

genemm

Villager
Member
Joined
Aug 17, 2018
Messages
16
Reaction score
0
First Language
Filipino
Primarily Uses
RMMV
Not normally, as it loads from the notetags.
Notetag data can to an extent be changed in-game, but it will not save. (Think of it like it gets stored as session-data, erased after reset).
The only way around this is to use the use_character function.

I use Yanfly's class change core and force characters to change graphics when their class changes.
Only problem is that it uses the actor's name when looking for 'dead' etc.

But I can confirm using the use_character works.


You can't, the function to let the system just randomly select any 2 of 4 cells doesn't exist.
The system currently only works like such:

Places Enemies in <Enemy Cell>
Places Actors in <Actor Cell>
there is no <Entity Cell>

you would have to modify the core code.

================
EDIT:
Which I did.

Added a new cell type called <Entity Cell>
which sets the data type to "all"
then I updated the functions that determine which cells are enemy/actor
inside the actor one, i added a check for if the type is "all" and if the cell is NOT occupied by an enemy.

The result was this video.

https://www.dropbox.com/s/m5cf3pns58h0b33/shared_entity_cells.mp4?dl=0
Wow, thank you Pharonix! How can I implement this on my game? Please guide me.

You might end up loving me for this.

according to the documentation:
you can add this tag to the actor:

move_scope: circle(3,1)

But for example, a knight can move 3 spaces out, 2 forward, one to left/right. Like this:
View attachment 97361
the aoe/scope for this is
data: "[cx-1,cy-2],[cx+1,cy-2],[cx-2,cy-1],[cx+2,cy-1],[cx-2,cy+1],[cx+2,cy+1],[cx-1,cy+2],[cx+1,cy+2]"

copy/paste for aoe/scopes in config:
"knight_move": {
data: "[cx-1,cy-2],[cx+1,cy-2],[cx-2,cy-1],[cx+2,cy-1],[cx-2,cy+1],[cx+2,cy+1],[cx-1,cy+2],[cx+1,cy+2]"
},

In actor tags, this becomes
move_scope: custom(knight_move)
View attachment 97362

Sample Video:
https://www.dropbox.com/s/crak4c6ufa9ogcl/custom_move_scope.mp4?dl=0

Edit:
Not sure why I didn't realize this sooner lol.
Amazing! Another thank you so much Pharonix! You are so brilliant! I will try this soon!
 
Last edited:

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
733
Reaction score
327
First Language
English
Primarily Uses
RMMV
Wow, thank you Pharonix! How can I implement this on my game? Please guide me.



Amazing! Another thank you so much Pharonix! You are so brilliant! I will try this soon!
You won't really be able to implement it in your game, as I had to modify the source code.
However, I only needed to mod the LeTBS.js file, so if you want to PM me your file, I can edit it for you and send you the modified file. (For future note if you download a newer version of LETBS, you will need to have the changes re-added).
 

gRaViJa

Veteran
Veteran
Joined
Mar 16, 2012
Messages
840
Reaction score
379
First Language
Dutch
When I want to testplay, it asks to update javascript files. If i do so, i get an error at launch: "TypeError, cannot read property 'Resize' of undefined". Does this have to do with MV versions? I'm on the latest (1.61?) version.
 

onipunk

Archmage of Procrastination
Veteran
Joined
Jun 27, 2017
Messages
250
Reaction score
160
First Language
English
Primarily Uses
RMVXA
A few pages back Pharonix said that 1.6 broke everything and he's on 1.5, so you'll need to roll back your version by the looks of things.
 

genemm

Villager
Member
Joined
Aug 17, 2018
Messages
16
Reaction score
0
First Language
Filipino
Primarily Uses
RMMV
You won't really be able to implement it in your game, as I had to modify the source code.
However, I only needed to mod the LeTBS.js file, so if you want to PM me your file, I can edit it for you and send you the modified file. (For future note if you download a newer version of LETBS, you will need to have the changes re-added).
I will surely ask you to modify the source code Pharonix! Please mod it according to how you implemented it. I will PM you the link to my LeTBS.js file.
 
Last edited:

Chaosicaa

Veteran
Veteran
Joined
Dec 22, 2016
Messages
95
Reaction score
121
First Language
French
Primarily Uses
@onipunk @gRaViJa
Actually it WAS the case, the version 1.6.0 broke LeTBS but now it works well (1.6.1) and there is a little performance boost, so I would recommend you to do the update :p
This Demo on 1.6.1 works perfectly :
https://www.dropbox.com/s/du45ml08yybqulf/LeTBS_0772B.rar?dl=0

If you have the error message :
"TypeError, cannot read property 'Resize' of undefined" Try to put the console plugin to OFF (there is one console plugin by Lecode and one option to show console on Yanfly Core, be sure to put both OFF if you have this problem but it should not happen anymore!).

Noproblem.png
 

gRaViJa

Veteran
Veteran
Joined
Mar 16, 2012
Messages
840
Reaction score
379
First Language
Dutch
Got it working! There is a sprite missing though when I used Ice Prison skill :)
 

Danielcross

Veteran
Veteran
Joined
Sep 27, 2017
Messages
100
Reaction score
10
First Language
English
Primarily Uses
RMMV
Not that I am currently aware of.
Right now, the only way would be to "Reshuffle" the turn order, which wouldn't be feasible.

I did find that calling the script at the end of the skill:
BattleManagerTBS.activeEntity()._actionPerformed=false
may do the trick,
so what you would do is invoke a common event in the skill that simply calls a function that runs this as a script.
It will be performed at the end of the skill, before the skill popup displays:
View attachment 97273
View attachment 97274

This actually works, here's a video.
I made Infinity End have the c
https://www.dropbox.com/s/y58v04qdfeyr36x/extra_action.mp4?dl=0
Works perfectly, thank you! I'm adding you to my special thanks credits whenever I get my next game out Pharonix, you've been a great help to everybody working with LeTBS.
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
733
Reaction score
327
First Language
English
Primarily Uses
RMMV
So, one issue I've been struggling with was the automatic "Starting" when you auto-place all actors in cells.
It still required you to click "Start" then "Begin"

So what I did was add the part from actor positioning that checks if all spots are filled and I run it after the Actor and Enemy pre-positioning phase.

This results in a "confirm" popup if all spots are pre-filled.

So I went a step further and invoked the actual "Confirm / Cancel" handler for the pop-up window.
This results in the following video:
https://www.dropbox.com/s/eko3n02mhxz6fvl/Battle_start.mp4?dl=0

Which as you can see, has improper placement of the Battle Start Logo.
Which I figured out, when I force the battle to start, the system thinks the image has no height/width, so when it calculates the positioning, it places it over to the side.
I got around this by using a set size for my Battle Start Image (Set in Config).

Resulting in the following video.
https://www.dropbox.com/s/71mv39hcrwga4ll/Battle_Start_New.mp4?dl=0

As you can see here, it displays perfectly fine.
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
733
Reaction score
327
First Language
English
Primarily Uses
RMMV
Found an easy way to add Distance modifiers.
if you use yanfly's custom damage formulas, use this

<Damage Formula>
var dist = LeUtilities.distanceBetweenCells(BattleManagerTBS.activeEntity()._cell,BattleManagerTBS._activeCell);
//10% boost default per cell distance
var distMod = dist/10;

value = (value * (1+distMod))
</Damage Formula>

if your damage in your main formula is
20, then with the below in the notebox, it should become
20 * 1+distMod
if distance is 7,
distMod = 0.7

value = value * (1+0.7)
value = value * 1.7
value = 20*1.7
value = 34

if you want to limit the boost, use clamp(min, max)

<Damage Formula>
var dist = LeUtilities.distanceBetweenCells(BattleManagerTBS.activeEntity()._cell,BattleManagerTBS._activeCell);
//10% boost default per cell distance
var distMod = dist/10;
//will set distMod to 1, if it is greater than that, so the maximum boox
//will come from 10 cells away
distMod.clamp(0,1)

value = (value * (1+distMod))
</Damage Formula>

This is all theory, but from preliminary checks, it should work.
EDIT:
As it is, it doesn't. This is due to the character moving BEFORE damage calculation.
I will need to find another way.


EDIT 2:
Working.

Had to create a new function in LeTBS.js

BattleManagerTBS.setBattleDistance = function () {
this.activeEntity().battler()._cellDistance= LeUtilities.distanceBetweenCells(this.activeEntity()._cell, this._activeCell)
};

Then in my skill, i explicitly set value to a.atk:
if state 681, then I increase the max distance boost, and double the multiplier value
state 681 is Warp Master, which doubles the distance bonus, and raises the limit to 500% boost

<Damage Formula>
value = a.atk;
var dist = a._cellDistance
console.log(dist);
var mDmg = 1
if(a.isStateAffected(681)){
mDmg = 5;
var distMod = dist/5;}
else{
var distMod = dist/10;}

distMod.clamp(0,mDmg);
value *= (1+ distMod);
</Damage Formula>

When a.atk = 10, this resulted in 64 damage (i was using distance as a direct multiplier for easier testing at lower values)


HOWEVER for this all to work, if you use sequences, you must use this line FIRST:
"script: BattleManagerTBS.setBattleDistance();",
This will set the current battler's distance modifier to the distance between the battler and the target.

If you want to use this for skills that don't use sequences, then it gets a little easy.
Just use the damage formula, and call
BattleManagerTBS.setBattleDistance();
at the start.
Since the battler doesn't move in non-sequence skills, this shouldn't give you any problems with the damage.


"What will he think of next?"
-everyone
 
Last edited:

sorenson11

Warper
Member
Joined
Sep 7, 2018
Messages
1
Reaction score
0
First Language
English
Primarily Uses
RMMV
Does anyone happen to have any experience getting LeTBS to work with Hime's Battle Action EXP? Or is willing to share code that accomplishes something similar? http://himeworks.com/2016/02/battle-action-exp/

I am trying to make it so that EXP is gained when an enemy unit is damaged, and not just after the battle is resolved. When I set LeTBS to OFF, Hime's plugin seems to work fine. However, I cannot actually get it to work in the LeTBS encounters.
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
733
Reaction score
327
First Language
English
Primarily Uses
RMMV
Does anyone happen to have any experience getting LeTBS to work with Hime's Battle Action EXP? Or is willing to share code that accomplishes something similar? http://himeworks.com/2016/02/battle-action-exp/

I am trying to make it so that EXP is gained when an enemy unit is damaged, and not just after the battle is resolved. When I set LeTBS to OFF, Hime's plugin seems to work fine. However, I cannot actually get it to work in the LeTBS encounters.
I used to use it myself.
I found the when enemy is killed xp to work better though.
I currently have it disabled,
Send me what you have in the config setting.
upload_2018-9-7_23-36-11.png
 

NorgMan

Warper
Member
Joined
Sep 5, 2018
Messages
2
Reaction score
0
First Language
English
Primarily Uses
RMMV
I like this combat system, I think it's nice and wanted to use it in a game that I was working on. However, I've been having a bit of trouble getting it to work right and was wondering if someone could help me.

I actually ran into some strange behavior. I read all of the documentation, set everything up, set up all the plugins.

When I copy over all script files from the js folder in the demo and overwrite in the script folder, the battles will work once, but if I save my progress in RPG Maker, it stops working.

*Edit* I think I figured out what's going on. I downloaded the plugin files from Github LeTBS but they don't seem to work quite right. The demo plugin files work. However, I had added the Github version plugins, then physically replaced them with the Demo version, but the Github versions were still configured in the plugin menu in RPGMMV plugin manager. - So after a save, it would somehow mess up the working Demo plugins.

To solve I removed all plugins from RPGMMV plugin manager, then copied and replaced all plugin files using the demo version, then readded into the plugin manager. And now it works...
 

Attachments

Last edited:

NorgMan

Warper
Member
Joined
Sep 5, 2018
Messages
2
Reaction score
0
First Language
English
Primarily Uses
RMMV
I wanted to make a mind controlled attack where an enemy would attack their allies while effected by the 'fascination' state.

I tried to do something like this in the Lecode.S_TBS.Config.AI section:

"use_mindcontrolled": [
"search_target: closest_ally, 100%, offense",
"if: isTargetValid()",
"set_action: damage, average",
"move_for_action: null",
"use: defined_action",
"call_behavior: after_offense",
"else",
"move: toward_allies, 100%",
"endif"
],

Then add this to the fascination state:
<letbs>
use_mindcontrolled
</letbs>

And then the fascination state would be applied by a seduction spell.

It's not quite working though, when I cast it, the enemy character just skips their turn until the effect wears off, they don't actually engage in friendly fire.

Is there a way to change the above behavior commands to get it to work?
 

onipunk

Archmage of Procrastination
Veteran
Joined
Jun 27, 2017
Messages
250
Reaction score
160
First Language
English
Primarily Uses
RMVXA
So, one issue I've been struggling with was the automatic "Starting" when you auto-place all actors in cells.
It still required you to click "Start" then "Begin"

So what I did was add the part from actor positioning that checks if all spots are filled and I run it after the Actor and Enemy pre-positioning phase.

This results in a "confirm" popup if all spots are pre-filled.

So I went a step further and invoked the actual "Confirm / Cancel" handler for the pop-up window.
This results in the following video:
https://www.dropbox.com/s/eko3n02mhxz6fvl/Battle_start.mp4?dl=0

Which as you can see, has improper placement of the Battle Start Logo.
Which I figured out, when I force the battle to start, the system thinks the image has no height/width, so when it calculates the positioning, it places it over to the side.
I got around this by using a set size for my Battle Start Image (Set in Config).

Resulting in the following video.
https://www.dropbox.com/s/71mv39hcrwga4ll/Battle_Start_New.mp4?dl=0

As you can see here, it displays perfectly fine.
Would you be cool with sharing the code you've got on auto-placing actors and automatically starting the battle, and also where to put it? LeTBS.js, I would assume? For my current project I'm using both random battles and a resolution that the positioning window is just way too big for so I'd really appreciate being able to skip all that entirely!
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
733
Reaction score
327
First Language
English
Primarily Uses
RMMV
Would you be cool with sharing the code you've got on auto-placing actors and automatically starting the battle, and also where to put it? LeTBS.js, I would assume? For my current project I'm using both random battles and a resolution that the positioning window is just way too big for so I'd really appreciate being able to skip all that entirely!
auto-placing actors requires the use of <actor cell: x> where x is the actor id.
as for the code that actually auto-starts battle, its a bit more difficult.

WARNING: Before Doing ANY of this, backup your Config file. I won't take responsibility if you mess up your code.


Add this function:

BattleManagerTBS.checkAllyCells = function () {
var nbrFixedActors = this.allyStartCells().filter(function (cell) {
return cell._positioningData.fixed != null;
}).length;
if (this.allyEntities().length === (nbrFixedActors + $gameParty.members().length)
|| this.allyEntities().length === this.allyStartCells().length) {
LeUtilities.getScene()._windowPositioning.deactivate();
LeUtilities.getScene()._windowPositioning.deselect();
this.positioningPhaseEnd();
LeUtilities.getScene()._windowConfirm._handlers.ok();
}

};
This essentially is a rip of the code that checks all ally cells when you place an actor, but is a callable function that you can then call in the initail pre-positioning phase.
The only difference between this call and the original is that instead of having the 3 LeUtilities calls (2 before the bold, 1 after) it just has the in-bold.


Look for:
BattleManagerTBS.processPositioningPhase


Then you will see 2 function calls:

this.processActorsPrePositioning();
this.processEnemyPositioning();

Place the call right after the enemy positioning one.
upload_2018-9-9_21-21-24.png


THEN there's the issue with the BATTLE START image displaying

This will fix it:

After this line:
Lecode.S_TBS.battleStartSpriteDelay = Number(parameters["Battle Start Sprite Delay"] || 50); // (): Duration of the battle start sprite.
add these 2

Lecode.S_TBS.battleStartSpriteWidth = Number(parameters["Battle Start Sprite Width"] || 672); // (): Width of the battle start sprite.
Lecode.S_TBS.battleStartSpriteHeight = Number(parameters["Battle Start Sprite Height"] || 138); // (): Height of the battle start sprite.

By default the image display for these gets messed up using the above code to auto-start, this will fix that. You should set this height/width to the Height and width for the battle start graphic.

Then look for this function:
BattleManagerTBS.battleBeginning = function () {

Comment out these two lines with //
//this._startSprite.x = Graphics.width / 2 - this._startSprite.width / 2;
//this._startSprite.y = Graphics.height / 2 - this._startSprite.height / 2;
this._startSprite.width results in 0 for the above auto-start patch. so replace with this:

this._startSprite.x = Graphics.width / 2 - Lecode.S_TBS.battleStartSpriteWidth / 2;
this._startSprite.y = Graphics.height / 2 - Lecode.S_TBS.battleStartSpriteHeight / 2;


This will make it use your now pre-determined width/height for the battle start graphic.


I don't think I missed anything.

EDIT:
Realized I missed a few parameters, this causes the BATTLE START to not show...


Place these 2
*
* @param Battle Start Sprite Width
* @desc Width of the battle start sprite.
* @Default 672
*
* @param Battle Start Sprite Height
* @desc Height of the battle start sprite.
* @Default 138

Below

* @param Battle Start Sprite Delay
* @desc Duration of the battle start sprite.
* @Default 50
==================

And:

Lecode.S_TBS.battleStartSpriteWidth = Number(parameters["Battle Start Sprite Width"] || 672); // (): Width of the battle start sprite.
Lecode.S_TBS.battleStartSpriteHeight = Number(parameters["Battle Start Sprite Height"] || 138); // (): Height of the battle start sprite.

Below

Lecode.S_TBS.battleStartSpriteDelay = Number(parameters["Battle Start Sprite Delay"] || 50) ; // (): Duration of the battle start sprite.
 
Last edited:

onipunk

Archmage of Procrastination
Veteran
Joined
Jun 27, 2017
Messages
250
Reaction score
160
First Language
English
Primarily Uses
RMVXA
Man, that's intense, I'd never have figured all that out myself. Once again you're an absolute legend and I probably owe you a few drinks by now. Thanks so much (again)!
 

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

Latest Threads

Latest Posts

Latest Profile Posts


It's my cute little ghost~
Minecraft Dungeons is a great example of a game that's much simpler than other games in its genre but almost as equally immersive and fun to play. Lotta RPGmaker devs could learn from that lesson.
Well, it's been a while since the last time I came here... Is there a JS scripting FAQ? I'd like to know what it's capable of achieving, and how :rswt
I love the Time Fantasy tiles, but haven't played anything made with it yet. Can anyone recommend me something?
Vote for what I show more indepth on Twitter tomorrow from the MZ default resources

Forum statistics

Threads
99,366
Messages
964,506
Members
130,978
Latest member
urza220
Top