MV How do I make an if statement check a game data value in a subroutine

Okay so I'm 100% certain that everything I say here is going to be some flavour of the wrong word for what I'm talking about so just bare with me while I clumsily stumble:

I want to make my game check the value of the party member before deciding whether to draw an MP gauge, a TP gauge, or neither. Different characters use different gauges, you see.

So, here's where I'm at:

JavaScript:
Window_BattleStatus.prototype.drawGaugeAreaWithTp = function(rect, actor) {
    this.drawActorHp(actor, rect.x + 0, rect.y, 108);
    this.drawActorMp(actor, rect.x + 123, rect.y, 96);
    this.drawActorTp(actor, rect.x + 234, rect.y, 96);

This is the built in function for drawing a gauge with Tp involved. I intend to hijack this function because I have no goddamn clue how to make my own plugin. I will comment out the parts I plan to replace so that if anything goes wrong I can always put it back.

What I want to do is put the in game actor ID for each actor being checked with this function into an if statement that measures that value against a pool of fixed numerical integers (there are only 4 player characters so it need not be flexible or elegant, merely functional) so I can hard code specific actors to have specific gauge drawing parameters.

The trouble is, I have literally no idea how to write any code at all. Every time I've used control f4 to search through for subroutine declarations and tried to hobble together something to make this happen, it's just squawked at me that "undefined is not a function" or whatever the hell it keeps saying.

I can code in game, but the raw script walls are not my friend. In my head, it looks something like this:

JavaScript:
Window_BattleStatus.prototype.drawGaugeAreaWithTp = function(rect, actor) {
    if \\the actor's in game ID is equal to 2
    then
    this.drawActorHp(actor, rect.x + 0, rect.y, 108);
    this.drawActorMp(actor, rect.x + better number, rect.y, 96);
    else if \\the actor's in game ID is equal to 3
    then
    this.drawActorHp(actor, rect.x + 0, rect.y, 108);
    this.drawActorTp(actor, rect.x + better number, rect.y, 96);
    else
    this.drawActorHp(actor, rect.x + 0, rect.y, 108);
}

How do I translate this into actual, functional code?
Just out of curiosity, why aren't you using an existing plugin instead of trying to write your own if you know you're not proficient? Off the top of my head, Yanfly's Skill Core does this by simply putting
<Swap Gauge Nothing: TP>, for example, in the notes of an actor.

If you really want to go it on your own,
JavaScript:
Window_BattleStatus.prototype.drawGaugeAreaWithTp = function(rect, actor) {
    if \\the actor's in game ID is equal to 2
    then
    this.drawActorHp(actor, rect.x + 0, rect.y, 108);
    this.drawActorMp(actor, rect.x + better number, rect.y, 96);
    else if \\the actor's in game ID is equal to 3
    then
    this.drawActorHp(actor, rect.x + 0, rect.y, 108);
    this.drawActorTp(actor, rect.x + better number, rect.y, 96);
    else
    this.drawActorHp(actor, rect.x + 0, rect.y, 108);
}
Code:
if (actor.actorId()==2)

but then you have other syntax issues, like you'll need to create code blocks with braces after the if and else if.

Really, with no offense or condescension or anything, it doesn't make much sense to try to create code if you don't know how 😉 It seems much more logical to use existing plugins while you use tutorials/classes/whatever to learn how to code. Then, if you need to modify the plugin you're using (or have some reason to entirely write your own), you'll know how.
To add: a plugin is a file containing code. If you define an existing method in a plugin, it will replace that method with the code in the plugin. So you can just copy the relevant method(s) into a new .js file, save it in your project's js/plugins subfolder, and import it via the Plugin Manager.

In this case it looks like you want to handle 3 different cases:
  1. Show HP and MP;
  2. 1, with MP replaced by TP;
  3. 1, with MP removed.
I think you could do that by replacing the MP gauge based on which actor it is, e.g. (untested):
Spoiler: plugin code
JavaScript:
/*:
 * @target MV
 * @plugindesc Change which gauges are drawn for specific actors.
 * @help Actor notetags:
 *    <HP Only>
 *    <Replace MP with TP>
 *
 * Free to use and/or modify for any project, no credit required.
 */
;void (function() {
'use strict';
  // Remember current function to include it in the new one
  var alias = Window_Base.prototype.drawActorMp;
  // Redefine that function
  Window_Base.prototype.drawActorMp = function(actor, x, y, width) {
    var meta = actor.actor().meta;
    // if actor is tagged with <HP Only> then skip this (i.e. draw nothing)
    if (!meta["HP Only"]) {
      if (meta["Replace MP with TP"]) {
        // if actor is tagged with <Replace MP with TP> then draw TP instead 
        this.drawActorTp(actor, x, y, width);
      } else {
        // otherwise draw as usual
        alias.apply(this, arguments);
      }
    }
  };
})();
As a bonus, this is defined for Window_Base, which means it should affect all places in game where these gauges are drawn, e.g. pause menu and status/skill screens.

Or, like Turan says, use an existing free plugin that does this.
I had that in mind, like caethyril said using a meta to add or swap
mp/tp or to add both, the plugin is far smaller and more efficient.

like ATT_Turan said, learning the basics and read the code can
create your own, as overwriting is not always usefull unless you
have a reason for, else alias it for less coding but add new functions
to it what you want.
Thank you all so much for the assistance! I was unaware that there already existed a plugin which would allow me to achieve this end goal. No offence or condescention taken; I'm here to learn and improve, and even though I need not make changes here and today, knowing how to make changes should the need arise is all valauble information!
For future reference, I would advise never putting edits in the core code: they'll be overwritten by any future updates to the engine.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-make-an-if-statement-check-a-game-data-value-in-a-subroutine.153597/