Lecode Tactical Battle System 0.77.2B

Discussion in 'JS Plugin Releases (RMMV)' started by Lecode, Nov 28, 2016.

  1. Chaosicaa

    Chaosicaa Veteran Veteran

    Messages:
    95
    Likes Received:
    120
    First Language:
    French
    @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 and Pharonix like this.
  2. Amarok

    Amarok Veteran Veteran

    Messages:
    288
    Likes Received:
    710
    Location:
    Spain
    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!
     
  3. Pharonix

    Pharonix Shadow Walker Veteran

    Messages:
    636
    Likes Received:
    274
    Location:
    Alpha Centauri Cluster
    First Language:
    English
    Primarily Uses:
    RMMV
    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: Aug 30, 2018
    Chaosicaa and genemm like this.
  4. genemm

    genemm Villager Member

    Messages:
    13
    Likes Received:
    0
    First Language:
    Filipino
    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!
     
    Last edited: Aug 31, 2018
  5. Pharonix

    Pharonix Shadow Walker Veteran

    Messages:
    636
    Likes Received:
    274
    Location:
    Alpha Centauri Cluster
    First Language:
    English
    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).
     
    genemm likes this.
  6. gRaViJa

    gRaViJa Veteran Veteran

    Messages:
    743
    Likes Received:
    269
    Location:
    Belgium
    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.
     
  7. onipunk

    onipunk Archmage of Procrastination Veteran

    Messages:
    246
    Likes Received:
    156
    Location:
    Glasgow, Scotland
    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.
     
    Pharonix and gRaViJa like this.
  8. genemm

    genemm Villager Member

    Messages:
    13
    Likes Received:
    0
    First Language:
    Filipino
    Primarily Uses:
    RMMV
    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: Aug 31, 2018
  9. Chaosicaa

    Chaosicaa Veteran Veteran

    Messages:
    95
    Likes Received:
    120
    First Language:
    French
    @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
     
    onipunk and gRaViJa like this.
  10. gRaViJa

    gRaViJa Veteran Veteran

    Messages:
    743
    Likes Received:
    269
    Location:
    Belgium
    First Language:
    Dutch
    Got it working! There is a sprite missing though when I used Ice Prison skill :)
     
    Chaosicaa likes this.
  11. Danielcross

    Danielcross Veteran Veteran

    Messages:
    85
    Likes Received:
    9
    First Language:
    English
    Primarily Uses:
    RMMV
    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.
     
  12. Pharonix

    Pharonix Shadow Walker Veteran

    Messages:
    636
    Likes Received:
    274
    Location:
    Alpha Centauri Cluster
    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.
     
    Chaosicaa and Amarok like this.
  13. Pharonix

    Pharonix Shadow Walker Veteran

    Messages:
    636
    Likes Received:
    274
    Location:
    Alpha Centauri Cluster
    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: Sep 7, 2018
    Chaosicaa likes this.
  14. sorenson11

    sorenson11 Warper Member

    Messages:
    1
    Likes Received:
    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.
     
  15. Pharonix

    Pharonix Shadow Walker Veteran

    Messages:
    636
    Likes Received:
    274
    Location:
    Alpha Centauri Cluster
    First Language:
    English
    Primarily Uses:
    RMMV
    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
     
  16. NorgMan

    NorgMan Warper Member

    Messages:
    2
    Likes Received:
    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...
     

    Attached Files:

    Last edited: Sep 8, 2018
  17. NorgMan

    NorgMan Warper Member

    Messages:
    2
    Likes Received:
    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?
     
  18. onipunk

    onipunk Archmage of Procrastination Veteran

    Messages:
    246
    Likes Received:
    156
    Location:
    Glasgow, Scotland
    First Language:
    English
    Primarily Uses:
    RMVXA
    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!
     
  19. Pharonix

    Pharonix Shadow Walker Veteran

    Messages:
    636
    Likes Received:
    274
    Location:
    Alpha Centauri Cluster
    First Language:
    English
    Primarily Uses:
    RMMV
    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: Jan 2, 2019
    Jmansmw, Chaosicaa and onipunk like this.
  20. onipunk

    onipunk Archmage of Procrastination Veteran

    Messages:
    246
    Likes Received:
    156
    Location:
    Glasgow, Scotland
    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)!
     

Share This Page