Lecode Tactical Battle System 0.77.2B

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
813
First Language
English
Primarily Uses
RMMV
I've noticed this game accomplished what I've been trying and failing to do. Basically I'm trying to get what normally is a sprite in the unit select box that shows HP/MP/etc to show a portrait instead.

How did they do that? I believe this is the chunk of code that handles the window in question:
JavaScript:
Window_TBSStatus.prototype.refresh = function () {
    this.contents.clear();
    this._gaugeHeight = null;
    this.resetFontSettings();
    if (!this._entity) return;
    var x, y, w, h;
    //- Face
    this.drawSprite();
    //- Name
    x = Lecode.S_TBS.Windows.statusWindowSpriteBoxW;
    y = -4;
    this.contents.fontSize += 3;
    this.changeTextColor(this.systemColor());
    this.leU_drawText(this._entity.battler().name(), "center", y);
    this.contents.fontSize -= 3;
    //- HP Gauge
    y += this.lineHeight() - 8;
    this.drawActorHp(this._entity.battler(), x, y, 193);
    //- MP Gauge
    y += this.lineHeight() - 8;
    this.drawActorMp(this._entity.battler(), x, y, 193);
    //- TP Gauge
    if (Lecode.S_TBS.Windows.statusWindowShowTP) {
    y += this.lineHeight() - 8;
        this.drawActorTp(this._entity.battler(), x, y, 193);
    }
    //- Move Points
    if (Lecode.S_TBS.Windows.statusWindowShowMovePoints) {
        y += this.lineHeight() + 4;
        var mp = this._entity.getMovePoints();
        var gw = (130 - mp * 4) / mp; //14
        x++;
        for (var i = 0; i < mp; i++) {
            this.contents.fillRect(x, y, gw, 2, this.textColor(Lecode.S_TBS.Windows.movePointsColor));
            x += gw + 4;
        }
    }
    // - States
    x = 2;
    y -= this.lineHeight();
    var max = Lecode.S_TBS.Windows.statusWindowMaxStates;
    this.drawActorIcons(this._entity.battler(), x, y, Window_Base._iconWidth * max);
};
Note: I've made edits to this, but mostly cosmetic. The important line in question is:
//- Face
this.drawSprite();
Which should be changed to something that draws the portrait, but everything I've tried throws an error...

Meaning if I have a troop with 1 enemy in it, and then I add 7 enemies with Entity event, if I only target the one enemy that's in the troop (and not the other 7 I added), the battle will complete as if I defeated all the enemies.
@Overdrive_Protocol Does this happen in the LTBS demo as well?
 
Last edited:

deathsia

Pegisister
Veteran
Joined
Feb 26, 2014
Messages
647
Reaction score
55
First Language
English
Primarily Uses
Great plugin! I'm running into a weird issue though.

When I run a battle like normal, the battle gets complete after defeating all enemies, obviously.

BUT if I add enemies as entities using the event trigger, everything works combat wise, but if I only target the enemies that are in the original enemy troop the battle will end. Meaning that only the enemies that are in the troop get counted, not the enemies added via entity event.

Meaning if I have a troop with 1 enemy in it, and then I add 7 enemies with Entity event, if I only target the one enemy that's in the troop (and not the other 7 I added), the battle will complete as if I defeated all the enemies.
Also have this issue, hoping for a fix.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
813
First Language
English
Primarily Uses
RMMV
Is it possible to use "accelerate_turn" & "decelerate_turn" with conditionals? If so, where would I put it? Let's say a simple .isStateEffected() for example.
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
Is it possible to use "accelerate_turn" & "decelerate_turn" with conditionals? If so, where would I put it? Let's say a simple .isStateEffected() for example.
Not sure, but you can try using yanfly skill core and calling
BattleManagerTBS.applyTimelineControlEffects(user, item, target)
where user is the caster, item is $dataSkills[skillID], and target is the target
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
813
First Language
English
Primarily Uses
RMMV
Wait, does that mean turn order in LTBS is controlled in the normal/usual way? Like in Yanfly's STB/CTB/ATB systems? (maybe not the latter 2, but STB ) Cuz I wanted to have battlers with twice as much speed go twice as often as a unit with half its speed. I assumed LTBS used its own turn order mechanic so didn't bother looking into it.
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
Wait, does that mean turn order in LTBS is controlled in the normal/usual way? Like in Yanfly's STB/CTB/ATB systems? (maybe not the latter 2, but STB ) Cuz I wanted to have battlers with twice as much speed go twice as often as a unit with half its speed. I assumed LTBS used its own turn order mechanic so didn't bother looking into it.
it uses its own turn order system.
Its all determined in LeTBSTurnOrderA, I believe



I actually built 7 additional systems myself.
1 for surprise attacks
1 for pre-emptive
These actually utilize Yanfly for this

4 for the reverse order of the 2 defaults and the 2 i added
These 4 are just the slowest first version of the other 4.

Lastly, I added one for initiative order, where "initiative" is based on a formula (move points + agility) for testing.
Subtracts 10 initiative per turn, and grants bonus initiative for each movepoint remaining.
in battles with weak enemies,and players with high agility, this can actually turn into a situation where the player team just keeps attacking and the enemy can't do anything.
I didn't fully implement this, as I couldn't find the right balance.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
813
First Language
English
Primarily Uses
RMMV
How does yours handle pre-emptive and surprise attacks? When you say they utilize Yanfly's do you mean his battle systems / YEP_BattleEngineCore?
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
How does yours handle pre-emptive and surprise attacks? When you say they utilize Yanfly's do you mean his battle systems / YEP_BattleEngineCore?
All it does it utiilize the part of Yanfly that handles pre-emptive and surprise attacks, and checks whether those apply, and changes the Turn Order to apply them.
Since Yanfly Pre-emptive and surprise didn't work last I checked.
 

Pootscooter

Veteran
Veteran
Joined
Jun 7, 2020
Messages
41
Reaction score
10
First Language
Mandarin
Primarily Uses
RMMV
Is it possible to use an Active/Charge Turn Battle system for turn order in LTBS somehow?
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
813
First Language
English
Primarily Uses
RMMV
Setting turn order from fair (true) to simple (false) is probably the closest I'm going to get. I suggest trying that. I wish I could figure out what are some valid formulas for the "Turn Order Sort Method" though...
 

UniqueName

Veteran
Veteran
Joined
Nov 12, 2018
Messages
67
Reaction score
9
First Language
Russian
Primarily Uses
Other
Good News Everyone.

I've finally started getting around to creating a general utility plugin for LeTBS.
This will include multiple features and functionality changes and tweaks that should help you guys out, as
well as some bug fixes.

The one thing I am not sure of is the compatibility with 77.2B, as I use 77 base, but in theory, it should work fine.

I will update this comment with a link when its ready.
If there's any of my fixes you absolutely want from earlier posts, please let me know.
I have a ton of code to go through at the moment, but thankfully 70% or so of my changes to my javascript files were documented.

I have done preliminary testing of my own and am waiting for @Frostorm to do some of his own testing, but if it works, this plugin will include support for, and instructions on implementing YEP_WeaponUnleash in LeTBS, as the current code does not support this.
The fixes inside do change quite a bit, but hopefully I'll have everything labelled as to what they do, so they'll be easy to comment out if you don't want that particular fix.


I have 2 plugins in the works right now.
I will update these change logs as I add more to them.


General Mod Utility
JavaScript:
/*
* ============================================================================
 * What it Does:
 * ============================================================================
 *
 * PHX Mod Plugin For LeTBS to add features and fixes for LeTBS
 * Place Under all other LeTBS plugins in your plugin manager
 *
 *
 * makes changes to getObjectSequenceData, makeScope, and adds support for YEP_WeaponUnleash
 *
 *
 *
 *
 * ============================================================================
 * getObjectSequenceData:
 * ============================================================================
 *
 * This allows the use of e.function() in sequence calls, as well as handle functions with parameters
 * This allows you to create skills that rely on a function to return which sequence should run.
 * Example:
 *
 * sequence: e.vorpal();
 * In my code, e.vorpal is a TBSEntity.prototype.vorpal = function () {} type function
 * and checks a rate of 10% 3 times, and increases the number of hits for each success.
 * this function returns "vorpal2" (the default) if none of the checks pass, and vorpal3, vorpal4 or vorpal5 based
 * on how many "hits" the skill should make.
 *
 *
 * ============================================================================
 * makeScope:
 * ============================================================================
 *
 * The changes made here are very simple.
 * With these changes, LeTBS now handles support for calling functions like
 * e.customSquare() and e.customSquare(param,goes,here) inside the scope.
 * That return strings for scope size, so you can do things like:
 * scope: square(e.customSquare())
 * where e.customSquare is a TBSEntity function such as
 *
 *  TBSEntity.prototype.customSquare = function () {
 *     if(this.getMovePoints()>2)
 *     {return 5;}
 *     else
 *     {return 3;}
 * };
 * This function returns 5 if the user's movement Points is greater than 2, otherwise it returns 3.
 * This is just an example, but this shows that you can now, with my code, adjust scopes with functions
 * based on states, or variables, etc.
 * you could even use things like this.battler() to call the actual battler, then use
 * this.battler().isStateAffected(id)
 * this would allow you to adjust scope if the user is affected with a state.
 *
 * ============================================================================
 * weaponUnleash:
 * ============================================================================
 *
 * Requires Yanfly's YEP_WeaponUnleash.js plugin to work. comment it out if you do not want to use
 *
 * Function is called as a sequence like so:
 *
 * sequence: e.weaponUnleash("atk", true)
 *
 * This function takes in 2 parameters seq, and isWeapon.
 *
 * seq: this is the default sequence that should be used if weapon unleash fails
 *
 * isWeapon: this boolean is used to separate weapon-unleashes from guard-unleashes. If this is true,
 * the unleash code checks for weapon unleash, if false, it checks guard unleash.
 *
 * How to Use:
 *
 * Weapon Notetag: normal Yanfly Weapon Unleash Tag
 * <Weapon Unleash 100%: 1911>
 * <Weapon Unleash chance: skillId>
 *
 *
 * Skill Notetag: use the regular sequence: sequenceId line in <LeTBS></LeTBS> like you would normally
 * "atk" is to be replaced by the sequence that should play normally, leave true for weapon skills and make it false for * * guard skills
 * sequence: e.weaponUnleash("atk", true)
 * sequence: e.weaponUnleash("dagger_attack", true)
 *
 * Setting Up "Unleash Skills"
 *
 * Weapon Unleashes this way end up using the new skill's sequence and the current one's damage formula
 * This can be Problematic for some users, so creating a skill to handle the "Unleash" as an interim works best
 *
 * For Example: My Dragon Dagger can unleash "Accel Rave" which slashes the enemy 12 times. This skill however is
 * skill 105, and I do not want to use the base dagger attack formula.
 * Therefore, my Dragon Dagger instead unleashes skill 1911 - "Dagger Unleash"
 *
 * Dagger Unleash is set up like a regular skill, but no damage formula and it calls the sequence "dagger_unleash"
 * via sequence: dagger_unleash
 *
 * dagger_unleash sequence is very simple, as all it does is force the user to use a different skill.
 * by doing this, the user of the dragon dagger's unleash uses the forced skill's damage formula and sequence,
 * thereby effectively Unleashing the Power of the Weapon
 *
 * Unleash Sequence:
 *    "dagger_unleash": [
 *       "use_skill: user, 105",
 *   ],
 * All this does is force the user to use skill 105, which is my skill ID for Accel Rave.
 *
 * This may all seem unnecessarily complex, but Yanfly's Weapon Unleash, as is, is incompatible, but by modifying how
 * LeTBS handles functions as sequences, we can do amazing things.
 *
 *
 *
 * ============================================================================
 * Other Fixes:
 * ============================================================================
 *
 *
 * ===========
 * Positioning
 * ===========
 * Added support for variable-based actor cells
 * <Var Cell: x> / <Var Cell: 5>
 * Loads the value stored in Variable x, and loads that actor. Useful for Battles where you "split"
 * the party.
 *
 * Added support for switch-based actor cells
 * <Switch Cell: x>
 * Loads Switch x, and if it is on, pulls that actor in.
 * Good for Permadeath and merc recruiting where you don't want mercenaries in the party, but want them
 * in battle.
 *
 * Added support for leader-based actor cells (Party Leader auto-positioning
 * <Leader Cell
 * Loads the Party leader into the cell.
 *
 * Added support for neutral positioning cells that can be used by enemies or actors
 * <Entity Cell>
 * Denotes a "Neutral" cell, where an enemy or ally can begin. If left unoccupied by enemy positioning
 * it allows the player to place a character there. Uses the Neutral Color Parameter
 *
 * 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.
 *
 * Fixes issues when trying to use moveable events for positioning. Before it was using the Game Map event location,
 * and not the actual event location.
 * ===========
 *
 * Charmed
 *
 * 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.
 *
 *
 *
 * //Scopes
 * 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
 *
 * Added support for Scope_Select if Actor is afflicted with a specific State
 * scope_select: AstateId stateID
 *
 * Added support for Scope_Select if Enemy Unit is afflicted with a specific State*
 * scope_select: EstateId stateID
 *
 * Added support for Scope_Select if A Team Member is afflicted with a specific State*
 * scope_select: AllystateId stateID
 *
 * Added support for Scope_Select if An Enemy Team Member (enemies if player, player if enemies)*
 * is afflicted with a specific State*
 * scope_select: EnemystateId stateID
 *
 * Added support for Scope_Select if An Enemy Team Member (enemies if player, player if enemies)*
 * is afflicted with a specific State*
 * scope_select: StateId stateID
 *
 * Added support for Scope_Select if Actor Knows a specific Skill*
 * scope_select: AskillId skillID
 *
 * Added support for Scope_Select if Enemy Knows a specific Skill*
 * scope_select: EskillId skillID
 *
 *
 * //Distance
 * Added Support to keep track of distance between user and target. This allows you to create
 * skills that get stronger/weaker the further/closer you are.
 * When using advanced damage formulas, use a._cellDistance to pull in the distance between the
 * user of the skill, and the targeted cell.
 */

Counter System
JavaScript:
/*
 * ===========
 * 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
 *
 *
 * ******NOTE TAGS******
 *
 * ***ACTOR NOTETAGS***
 * <Default Counter: x>
 * where x is the skillID to counter with.
 *
 * ***SKILL NOTETAGS***
 * Dagger Counter Attack
 * <Counter Name:Dagger>
 * <Counter Type:Offensive>
 * <Counter Type Display:Offensive Counter>
 * <Counter Distance: 1>
 *
 *
 * ***PASSIVE SKILL COUNTER ***
 * Auto-Potion: Make this a Passive Skill, and it will be detected by the counter system
 * So long as it is equipped (if using skill equip core) or learned.
 *
 * <Counter Name: Auto-Potion>
 * <Custom Counter Condition>
 * $gameParty.numItems($dataItems[1]) > 0
 * </Custom Counter Condition>
 * <Counter Distance: 0>
 *
*/
Hey Im so hyped for this =D
the makescope thing is what letbs really lacked
also can you pls fix the directional damage mechanic in this mod?
letbs already has some commands for this but they dont work
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
Here's a slightly updated Version of my Mod js.
includes example functions for the sequence mods and scope modification.

As for directional damage, it applies a state to the attacker if they attack from front/side/back
make sure these are 1 turn states.

If you want back attacks to deal twice the damage, the state for Back Attack should just have buffs that raise the attributes of the character afflicted with the state.


Now mind you, this is a general fix/mod plugin, but you can feel free to take from it what you want.
Any questions, feel free to ask.
Ignore the enable/disable parameters, they currently don't apply.
 

Attachments

UniqueName

Veteran
Veteran
Joined
Nov 12, 2018
Messages
67
Reaction score
9
First Language
Russian
Primarily Uses
Other
Here's a slightly updated Version of my Mod js.
includes example functions for the sequence mods and scope modification.

As for directional damage, it applies a state to the attacker if they attack from front/side/back
make sure these are 1 turn states.

If you want back attacks to deal twice the damage, the state for Back Attack should just have buffs that raise the attributes of the character afflicted with the state.


Now mind you, this is a general fix/mod plugin, but you can feel free to take from it what you want.
Any questions, feel free to ask.
Ignore the enable/disable parameters, they currently don't apply.
Well I mean the directional damage modifier works with default attacks
like when I hit from behind it already deals more damage
but I was talking about the tag commands themselves
like "back_dmg_bonus: numeric" and "back_dmg_reduction: numeric"
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
813
First Language
English
Primarily Uses
RMMV
Do Yanfly notetags like <Custom Action Start Effect> work? Or does the whole actions being sequences thing make it impossible? I have a Pokemon-style Paralysis state:
JavaScript:
<Custom Action Start Effect>
var paralysisRate = (1 / 3);
if (Math.random() < paralysisRate) {
  user.startAnimation(64);
  if (user.currentAction()) {
    user.useItem(user.currentAction().item());
  }
  user.clearActions();
  var logWindow = SceneManager._scene._logWindow;
  if (state.message3) {
    var msg = '<CENTER>' + user.name() + state.message3;
    logWindow.addText(msg);
  }
  BattleManager.actionWaitForAnimation();
  logWindow.push('clear');
}
</Custom Action Start Effect>
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
Do Yanfly notetags like <Custom Action Start Effect> work? Or does the whole actions being sequences thing make it impossible? I have a Pokemon-style Paralysis state:
JavaScript:
<Custom Action Start Effect>
var paralysisRate = (1 / 3);
if (Math.random() < paralysisRate) {
  user.startAnimation(64);
  if (user.currentAction()) {
    user.useItem(user.currentAction().item());
  }
  user.clearActions();
  var logWindow = SceneManager._scene._logWindow;
  if (state.message3) {
    var msg = '<CENTER>' + user.name() + state.message3;
    logWindow.addText(msg);
  }
  BattleManager.actionWaitForAnimation();
  logWindow.push('clear');
}
</Custom Action Start Effect>
If thats Yanfly Action Sequences plugin, I don't think it works.
However I believe there's a Turn Start you can try using,
and use
e = BattleManagerTBS.activeEntity();
to save the entity
do your calculations, then if they can't do anything:
e._movePerformed = true;
e._actionPerformed = true;
As long as you don't allow multiple move and action, this should work.

But I cannot guarantee that Yanfly's Action Sequences do.
 
Joined
Apr 26, 2020
Messages
3
Reaction score
2
First Language
English
Primarily Uses
RMMV
Also have this issue, hoping for a fix.
Hey man I figured it out. You need to use the add-on plugin that comes with LETBS called "LETBS Win Conditions". I did not use this at first because I was getting crashes with every battle, but it turns out it works fine I just have to manually invoke victory conditions right before the battle.

Here's what it looks like:
Screenshot_6.png

If you don't add a win condition though at all, game will crash, just FYI. But it works!
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
813
First Language
English
Primarily Uses
RMMV
If thats Yanfly Action Sequences plugin, I don't think it works.
However I believe there's a Turn Start you can try using,
and use
e = BattleManagerTBS.activeEntity();
to save the entity
do your calculations, then if they can't do anything:
e._movePerformed = true;
e._actionPerformed = true;
As long as you don't allow multiple move and action, this should work.

But I cannot guarantee that Yanfly's Action Sequences do.
It's actually just Yanfly's Buffs&States Core.

I'll try your suggestion though, thx.

Edit: Btw, is it possible for Aggro/Taunt mechanics to work on a single target?
 
Last edited:

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
813
First Language
English
Primarily Uses
RMMV
So I'm running into a small roadblock. I'm trying to create a conditional statement to check if the current unit is an actor for the status window (the bottom left unit window during battle). This is what I've got so far:
JavaScript:
Window_TBSStatus.prototype.refresh = function () {
    this.contents.clear();
    this._gaugeHeight = null;
    this.resetFontSettings();
    if (!this._entity) return;
    var x, y, w, h;
    //- Face
    if (this.isActor) {
        this.drawFace;
    } else {
    this.drawSprite();
    }
The above is just a snippet and not the entire function, for the purposes of this post. So I'm guessing the syntax in my line if (this.isActor) { is incorrect. Also, I'm not sure "isActor" is even correct, since I only want the conditional to target PLAYER actors, and use "else" for enemy units. What would be the correct syntax in this situation? Like is there something akin to "isAlly"?
 
Last edited:

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
747
Reaction score
340
First Language
English
Primarily Uses
RMMV
So I'm running into a small roadblock. I'm trying to create a conditional statement to check if the current unit is an actor for the status window (the bottom left unit window during battle). This is what I've got so far:
JavaScript:
Window_TBSStatus.prototype.refresh = function () {
    this.contents.clear();
    this._gaugeHeight = null;
    this.resetFontSettings();
    if (!this._entity) return;
    var x, y, w, h;
    //- Face
    if (this.isActor) {
        this.drawFace;
    } else {
    this.drawSprite();
    }
The above is just a snippet and not the entire function, for the purposes of this post. So I'm guessing the syntax in my line if (this.isActor) { is incorrect. Also, I'm not sure "isActor" is even correct, since I only want the conditional to target PLAYER actors, and use "else" for enemy units. What would be the correct syntax in this situation? Like is there something akin to "isAlly"?

Couple things

isActor() is a function
you are calling this.isActor() inside the Window_TBSStatus "class"
this won't work
What you want is to call
BattleManagerTBS.activeEntity() to grab the current entity, then try

if (BattleManagerTBS.activeEntity().isActor) {
this.drawFace;
}

If that doesn't work Try
BattleManagerTBS.activeEntity().battler().isActor()
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
813
First Language
English
Primarily Uses
RMMV
@Pharonix Thanks, that worked! However, I just realized "isActor" simply checks if it's a unit and not if it's a friendly unit. What should I use instead so that I can check if the actor is a player character?
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I've had some hard times. A co-worker accused me (not going into detail here), and I am trying finish training next week. Still not paid yet, I think next week.
I don't like hard boiled eggs...
it's weird to eat something that crunchy outside soft inside. And after chewing it for a while it started to spill red sauces that taste like iron.
Latest member to OcRam -plugin suite: OcRam_Layers! Optimized parallax layers (for parallax mapping?) + dynamic layers which can be used in title-, battle and map scenes!
People convinced me to use my old graphics for this new project, i guess i can't run away from blender just yet. https://gyazo.com/2a105847c042bb78c6d4919ec1308660

Forum statistics

Threads
102,963
Messages
996,323
Members
134,428
Latest member
productscrack
Top