Ahuramazda

Veteran
Veteran
Joined
Nov 9, 2012
Messages
262
Reaction score
131
First Language
English
Primarily Uses
RMMZ
I have been working on a plugin, and I have hit the home stretch and down to a final bit of code needed to finish it. I am wanting to make it draw 3 different icons, one for no change, one for a positive change, and one for a negative change in a value. I know the value is working properly, as it plays a sound effect when when it goes up/down and nothing when its the same.

This is the segment of code I'm using, but no matter what I do, it always wants to use the "no change" icon when I test it... and oddly enough, in the console its showing as if its getting called 2 times for some reason.

Code:
actor.newpowericon = power
    offset = this.textWidth(PowerLevel.Param.PowerText + power)
    if (PowerLevel.Param.UseIcons == "true") {
        if (actor.newpowericon == actor.oldpowericon) {
            console.log("Same old, same old")
            this.drawIcon(PowerLevel.Param.NoChangeIcon, x + offset, y)
        }
        else if (actor.newpowericon > actor.oldpowericon) {
            console.log("Power to the player!")
            this.drawIcon(PowerLevel.Param.PowerUpIcon, x + offset, y)
            actor.oldpowericon = power
        }
        else if (actor.newpowericon < actor.oldpowericon) {
            console.log("Sucks to be you...")
            this.drawIcon(PowerLevel.Param.PowerDownIcon, x + offset, y)
            actor.oldpowericon = power
        }
    }

screenshot of the console with the above as is:
upload_2018-5-23_19-19-54.png

screenshot of the console with the "actor.oldpowericon = power" set to inactive:
upload_2018-5-23_19-20-34.png

Why would it be calling the console.log 2 times? o_O I am so confused as to whats happening.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,381
Reaction score
15,189
First Language
English
Primarily Uses
RMMV
To tell you that, we'd have to have the full context of that bit of code. What class is it in? How/where are you calling it?

How do you set up the parameters, and can you confirm that they have the correct index? Maybe do a console.log of the contents of PowerLeve.Param.Power<...>Icon within the blocks to ensure the index for each one is correct?
 

Ahuramazda

Veteran
Veteran
Joined
Nov 9, 2012
Messages
262
Reaction score
131
First Language
English
Primarily Uses
RMMZ
Here is the plugin in its entirety, and as for trying the console.log thing, I have tried literally everything I can think of with the logging to see if I could find information... I've tried making my own timers and this.wait, I've tried so many things I cannot even begin to think of.

I don't have the greatest understanding of coding, esp when it comes to doing it the "proper" way, so this plugin while it works with everything (except for the icon issue I'm having), it may be built in a way that may be considered wrong, but I'm learning and this is the first time I've actively tried making something right.

So the request: I need a way to make it show the icons properly in the very bottom section of the code without overwriting themselves immediately, but for some reason it seems that the window is being called 2 times, as the console when its logging does it 2 times, every time.

Code:
//=============================================================================
// Ahuramazda Plugins - Actor Power Level
// Mazda_PowerLevels.js
// Version: 1.00
//=============================================================================

var PowerLevel = PowerLevel || {}

//=============================================================================
/*:
 * @plugindesc Customizable formula for a "Power Level" in the Main Menu.
 * Requires YEP_CoreEngine to work.
 * @author Ahuramazda (requested by Vendon on RPG Maker Forums)
 *
 * @param •••Text Control•••
 * @default
 *
 * @param Power Level X
 * @desc Multiplier for the X position. Accepts Decimals.
 * Default: 2.00
 * @default 2.00
 *
 * @param Power Level Text
 * @desc What you want to call the Power Level?
 * Default: "Power Level: "
 * @default Power Level:
 *
 * @param
 * @default
 *
 * @param •Power Tiers•
 * @default
 *
 * @param Tier 1 Text Color
 * @desc What color should the tier 1 text be?
 * Default: 0 (White)
 * @default 0
 *
 * @param Tier 1 Minimum Power
 * @desc What is the lowest value in this tier?
 * Default: 0
 * @default 0
 *
 * @param Tier 1 Maximum Power
 * @desc What is the highest value in this tier?
 * Default: 1000
 * @default 1000
 *
 * @param Tier 2 Text Color
 * @desc What color should the tier 1 text be?
 * Default: 3 (Green)
 * @default 3
 *
 * @param Tier 2 Minimum Power
 * @desc What is the lowest value in this tier?
 * Default: 1001
 * @default 1001
 *
 * @param Tier 2 Maximum Power
 * @desc What is the highest value in this tier?
 * Default: 2000
 * @default 2000
 *
 * @param Tier 3 Text Color
 * @desc What color should the tier 1 text be?
 * Default: 1 (Blue)
 * @default 1
 *
 * @param Tier 3 Minimum Power
 * @desc What is the lowest value in this tier?
 * Default: 2001
 * @default 2001
 *
 * @param Tier 3 Maximum Power
 * @desc What is the highest value in this tier?
 * Default: 3000
 * @default 3000
 *
 * @param Tier 4 Text Color
 * @desc What color should the tier 1 text be?
 * Default: 30 (Purple)
 * @default 30
 *
 * @param Tier 4 Minimum Power
 * @desc What is the lowest value in this tier?
 * Default: 3001
 * @default 3001
 *
 * @param Tier 4 Maximum Power
 * @desc What is the highest value in this tier?
 * Default: 4000
 * @default 4000
 *
 * @param Tier 5 Text Color
 * @desc What color should the tier 1 text be?
 * Default: 20 (Orange)
 * @default 20
 *
 * @param Tier 5 Minimum Power
 * @desc What is the lowest value in this tier?
 * Default: 4001
 * @default 4001
 *
 * @param
 * @default
 *
 * @param •••Sound Options•••
 * @default
 *
 * @param Use Sound Effects
 * @desc Do you want to use Sound Effects when an actor gains or loses power in the main menu? Default: true
 * @default true
 *
 * @param
 * @default
 *
 * @param Power UP Name
 * @desc The sound effect name that plays when power went up. Default: Absorb2
 * @default Absorb2
 * @param Power UP Volume
 * @desc The volume that the Power UP sound effect plays at. Default: 100
 * @default 100
 * @param Power UP Pitch
 * @desc The pitch that the Power UP sound effect plays at. Default: 100
 * @default 100
 *
 * @param
 * @default
 *
 * @param Power DOWN Name
 * @desc The sound effect name that plays when power went down. Default: Down1
 * @default Down1
 * @param Power DOWN Volume
 * @desc The volume that the Power DOWN sound effect plays at. Default: 100
 * @default 100
 * @param Power DOWN Pitch
 * @desc The pitch that the Power DOWN sound effect plays at. Default: 100
 * @default 100
 *
 * @param
 * @default
 *
 * @param •••Icon Options•••
 * @default
 *
 * @param Use Icons
 * @desc Do you want to use Icons when an actor gains or loses power in the main menu? Default: true
 * @default true
 *
 * @param
 * @default
 *
 * @param No Change Icon
 * @desc The icon that is used when there is no change. Default: 88
 * @default 88
 * @param Power UP Icon
 * @desc The icon that is used when an actor gains power. Default: 87
 * @default 87
 * @param Power DOWN Icon
 * @desc The icon that is used when an actor loses power. Default: 89
 * @default 89
 *
 * @param
 * @default
 *
 * @param •••Calculation•••
 * @default
 * @param •Standard Attributes•
 * @default
 *
 * @param Attack Used
 * @desc Do you want to use the Attack attribute as part of the power level? Default: true
 * @default true
 * @param Attack Weight
 * @desc How much will each point of Attack increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param Defense Used
 * @desc Do you want to use the Defense attribute as part of the power level? Default: true
 * @default true
 * @param Defense Weight
 * @desc How much will each point of Defense increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param Magic Attack Used
 * @desc Do you want to use the Magic Attack attribute as part of the power level? Default: true
 * @default true
 * @param Magic Attack Weight
 * @desc How much will each point of Magic Attack increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param Magic Defense Used
 * @desc Do you want to use the Magic Defense attribute as part of the power level? Default: true
 * @default true
 * @param Magic Defense Weight
 * @desc How much will each point of Magic Defense increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param Agility Used
 * @desc Do you want to use the Agility attribute as part of the power level? Default: true
 * @default true
 * @param Agility Weight
 * @desc How much will each point of Agility increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param Luck Used
 * @desc Do you want to use the Luck attribute as part of the power level? Default: true
 * @default true
 * @param Luck Weight
 * @desc How much will each point of Luck increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param MaxHP Used
 * @desc Do you want to use the MaxHP attribute as part of the power level? Default: true
 * @default true
 * @param MaxHP Weight
 * @desc How much will each point of MaxHP increase Power Level? Accepts Decimals. Default: 0.10
 * @default 0.10
 *
 * @param MaxMP Used
 * @desc Do you want to use the MaxMP attribute as part of the power level? Default: true
 * @default true
 * @param MaxMP Weight
 * @desc How much will each point of MaxMP increase Power Level? Accepts Decimals. Default: 0.20
 * @default 0.20
 *
 * @param
 * @default
 * @param •Extra Attributes•
 * @default
 *
 * @param Pharmacology Used
 * @desc Do you want to use the Pharmacology attribute as part of the power level? Default: true
 * @default true
 * @param Pharmacology Weight
 * @desc How much will each 1% of Pharmacology increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param Guard Used
 * @desc Do you want to use the Guard attribute as part of the power level? Default: true
 * @default true
 * @param Guard Weight
 * @desc How much will each 1% of Guard increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param Recovery Used
 * @desc Do you want to use the Recovery attribute as part of the power level? Default: true
 * @default true
 * @param Recovery Weight
 * @desc How much will each 1% of Recovery increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param Magic Cost Rate Used
 * @desc Do you want to use the Magic Cost Rate attribute as part of the power level? Default: true
 * @default true
 * @param Magic Cost Rate Weight
 * @desc How much will each 1% of Magic Cost Rate increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param TP Cost Rate Used
 * @desc Do you want to use the TP Cost Rate attribute as part of the power level? Default: true
 * @default true
 * @param TP Cost Rate Weight
 * @desc How much will each 1% of TP Cost Rate increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param Physical Damage Rate Used
 * @desc Do you want to use the Physical Damage Rate attribute as part of the power level? Default: true
 * @default true
 * @param Physical Damage Rate Weight
 * @desc How much will each 1% of Physical Damage Rate increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param Magical Damage Rate Used
 * @desc Do you want to use the Magical Damage Rate attribute as part of the power level? Default: true
 * @default true
 * @param Magical Damage Rate Weight
 * @desc How much will each 1% of Magical Damage Rate increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param Floor Damage Rate Used
 * @desc Do you want to use the Floor Damage Rate attribute as part of the power level? Default: true
 * @default true
 * @param Floor Damage Rate Weight
 * @desc How much will each 1% of Floor Damage Rate increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param Hit Rate Used
 * @desc Do you want to use the Hit Rate attribute as part of the power level? Default: true
 * @default true
 * @param Hit Rate Weight
 * @desc How much will each 1% of Hit Rate increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param Evasion Rate Used
 * @desc Do you want to use the Evasion Rate attribute as part of the power level? Default: true
 * @default true
 * @param Evasion Rate Weight
 * @desc How much will each 1% of Evasion Rate increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param Critical Rate Used
 * @desc Do you want to use the Critical Rate attribute as part of the power level? Default: true
 * @default true
 * @param Critical Rate Weight
 * @desc How much will each 1% of Critical Rate increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param Critical Evasion Rate Used
 * @desc Do you want to use the Critical Evasion Rate attribute as part of the power level? Default: true
 * @default true
 * @param Critical Evasion Rate Weight
 * @desc How much will each 1% of Critical Evasion Rate increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param Magic Evasion Rate Used
 * @desc Do you want to use the Magic Evasion Rate attribute as part of the power level? Default: true
 * @default true
 * @param Magic Evasion Rate Weight
 * @desc How much will each 1% of Magic Evasion Rate increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param Magic Reflection Rate Used
 * @desc Do you want to use the Magic Reflection Rate attribute as part of the power level? Default: true
 * @default true
 * @param Magic Reflection Rate Weight
 * @desc How much will each 1% of Magic Reflection Rate increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param Counter Attack Rate Used
 * @desc Do you want to use the Counter Attack Rate attribute as part of the power level? Default: true
 * @default true
 * @param Counter Attack Rate Weight
 * @desc How much will each 1% of Counter Attack Rate increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param HP Regeneration Rate Used
 * @desc Do you want to use the HP Regeneration Rate attribute as part of the power level? Default: true
 * @default true
 * @param HP Regeneration Rate Weight
 * @desc How much will each 1% of HP Regeneration Rate increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param MP Regeneration Rate Used
 * @desc Do you want to use the MP Regeneration Rate attribute as part of the power level? Default: true
 * @default true
 * @param MP Regeneration Rate Weight
 * @desc How much will each 1% of MP Regeneration Rate increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param TP Regeneration Rate Used
 * @desc Do you want to use the TP Regeneration Rate attribute as part of the power level? Default: true
 * @default true
 * @param TP Regeneration Rate Weight
 * @desc How much will each 1% of TP Regeneration Rate increase Power Level? Accepts Decimals. Default: 1.00
 * @default 1.00
 *
 * @param
 * @default
 *
 * @param •Power Level Balance•
 * @default
 * @param Power Level Reduction
 * @desc Set this to higher than 1.00 if you feel like the power level showing is going to be too high for your taste.
 * Default: 1.00
 * @default 1.00
 *
 * @param
 * @default
 *
 * @param Debug To Console
 * @desc Send info to the console to see how the math stacks to test your settings. Default: false
 * @default false
 *
 * @help
 * ============================================================================
 * Introduction
 * ============================================================================
 *
 * This Plugin was designed to work with Yanfly's Core Engine at a minimum
 * resolution of 1920x1080. It may work with a lesser resolution, but it may
 * overlap other menu texts or be off-screen. I will not be supporting
 * anything less than this resolution.
 *
 * This Plugin does not have any Plugin commands.
 *
 * This Plugin is compatible with YEP_CoreEngineStatus, YEP_BaseParamControl,
 * YEP_ExtraParamFormula, SpecialParamFormula
 *
 * Simply edit the Plugin Parameters and give each attribute you choose to
 * use a weight, and the rest will be done on its own! Should be plug and
 * play as long as its below most Yanfly plugins.
 *
 * Please give credit to Yanfly for the Core Engine snippet, Ahuramazda for
 * creating the plugin, and some thanks to Vendon for requesting it!  :)
 */
//=============================================================================

//=============================================================================
// Parameter Variables
//=============================================================================

PowerLevel.Parameters = PluginManager.parameters('Mazda_PowerLevels');
PowerLevel.Param = PowerLevel.Param || {};

PowerLevel.Param.PowerPosition                 = Number(PowerLevel.Parameters['Power Level X'] || 2.00);
PowerLevel.Param.PowerText                     = String(PowerLevel.Parameters['Power Level Text'] || "Power Level: ");
PowerLevel.Param.TierOneColor                 = Number(PowerLevel.Parameters['Tier 1 Text Color'] || 0);
PowerLevel.Param.TierOneMinimum             = Number(PowerLevel.Parameters['Tier 1 Minimum Power'] || 0);
PowerLevel.Param.TierOneMaximum                = Number(PowerLevel.Parameters['Tier 1 Maximum Power'] || 1000);
PowerLevel.Param.TierTwoColor                 = Number(PowerLevel.Parameters['Tier 2 Text Color'] || 3);
PowerLevel.Param.TierTwoMinimum             = Number(PowerLevel.Parameters['Tier 2 Minimum Power'] || 1001);
PowerLevel.Param.TierTwoMaximum                = Number(PowerLevel.Parameters['Tier 2 Maximum Power'] || 2000);
PowerLevel.Param.TierThreeColor             = Number(PowerLevel.Parameters['Tier 3 Text Color'] || 1);
PowerLevel.Param.TierThreeMinimum             = Number(PowerLevel.Parameters['Tier 3 Minimum Power'] || 2001);
PowerLevel.Param.TierThreeMaximum            = Number(PowerLevel.Parameters['Tier 3 Maximum Power'] || 3000);
PowerLevel.Param.TierFourColor                 = Number(PowerLevel.Parameters['Tier 4 Text Color'] || 30);
PowerLevel.Param.TierFourMinimum             = Number(PowerLevel.Parameters['Tier 4 Minimum Power'] || 3001);
PowerLevel.Param.TierFourMaximum            = Number(PowerLevel.Parameters['Tier 4 Maximum Power'] || 4000);
PowerLevel.Param.TierFiveColor                 = Number(PowerLevel.Parameters['Tier 5 Text Color'] || 20);
PowerLevel.Param.TierFiveMinimum             = Number(PowerLevel.Parameters['Tier 5 Minimum Power'] || 4001);
PowerLevel.Param.UseSoundEffects             = String(PowerLevel.Parameters['Use Sound Effects'] || true);
PowerLevel.Param.PowerUpName                 = String(PowerLevel.Parameters['Power UP Name'] || "Absorb2");
PowerLevel.Param.PowerUpVolume                 = Number(PowerLevel.Parameters['Power UP Volume'] || 100);
PowerLevel.Param.PowerUpPitch                 = Number(PowerLevel.Parameters['Power UP Pitch'] || 100);
PowerLevel.Param.PowerDownName                 = String(PowerLevel.Parameters['Power DOWN Name'] || "Down1");
PowerLevel.Param.PowerDownVolume             = Number(PowerLevel.Parameters['Power DOWN Volume'] || 100);
PowerLevel.Param.PowerDownPitch             = Number(PowerLevel.Parameters['Power DOWN Pitch'] || 100);

PowerLevel.Param.UseIcons                     = String(PowerLevel.Parameters['Use Icons'] || true);
PowerLevel.Param.NoChangeIcon                 = Number(PowerLevel.Parameters['No Change Icon'] || 88);
PowerLevel.Param.PowerUpIcon                 = Number(PowerLevel.Parameters['Power UP Icon'] || 87);
PowerLevel.Param.PowerDownIcon                 = Number(PowerLevel.Parameters['Power DOWN Icon'] || 89);

PowerLevel.Param.UseAttack                     = String(PowerLevel.Parameters['Attack Used'] || true);
PowerLevel.Param.AttackWeight                  = Number(PowerLevel.Parameters['Attack Weight'] || 1.00);
PowerLevel.Param.UseDefense                    = String(PowerLevel.Parameters['Defense Used'] || true);
PowerLevel.Param.DefenseWeight                 = Number(PowerLevel.Parameters['Defense Weight'] || 1.00);
PowerLevel.Param.UseMagicAttack                = String(PowerLevel.Parameters['Magic Attack Used'] || true);
PowerLevel.Param.MagicAttackWeight             = Number(PowerLevel.Parameters['Magic Attack Weight'] || 1.00);
PowerLevel.Param.UseMagicDefense            = String(PowerLevel.Parameters['Magic Defense Used'] || true);
PowerLevel.Param.MagicDefenseWeight         = Number(PowerLevel.Parameters['Magic Defense Weight'] || 1.00);
PowerLevel.Param.UseAgility                    = String(PowerLevel.Parameters['Agility Used'] || true);
PowerLevel.Param.AgilityWeight                 = Number(PowerLevel.Parameters['Agility Weight'] || 1.00);
PowerLevel.Param.UseLuck                    = String(PowerLevel.Parameters['Luck Used'] || true);
PowerLevel.Param.LuckWeight                 = Number(PowerLevel.Parameters['Luck Weight'] || 1.00);
PowerLevel.Param.UseMaxHP                   = String(PowerLevel.Parameters['MaxHP Used'] || true);
PowerLevel.Param.MaxHPWeight                = Number(PowerLevel.Parameters['MaxHP Weight'] || 0.10);
PowerLevel.Param.UseMaxMP                    = String(PowerLevel.Parameters['MaxMP Used'] || true);
PowerLevel.Param.MaxMPWeight                 = Number(PowerLevel.Parameters['MaxMP Weight'] || 0.20);
PowerLevel.Param.UsePharmacology               = String(PowerLevel.Parameters['Pharmacology Used'] || true);
PowerLevel.Param.PharmacologyWeight            = Number(PowerLevel.Parameters['Pharmacology Weight'] || 1.00);
PowerLevel.Param.UseGuard                    = String(PowerLevel.Parameters['Guard Used'] || true);
PowerLevel.Param.GuardWeight                 = Number(PowerLevel.Parameters['Guard Weight'] || 1.00);
PowerLevel.Param.UseRecovery                = String(PowerLevel.Parameters['Recovery Used'] || true);
PowerLevel.Param.RecoveryWeight             = Number(PowerLevel.Parameters['Recovery Weight'] || 1.00);
PowerLevel.Param.UseMagicCostRate           = String(PowerLevel.Parameters['Magic Cost Rate Used'] || true);
PowerLevel.Param.MagicCostRateWeight        = Number(PowerLevel.Parameters['Magic Cost Rate Weight'] || 1.00);
PowerLevel.Param.UseTPCostRate               = String(PowerLevel.Parameters['TP Cost Rate Used'] || true);
PowerLevel.Param.TPCostRateWeight            = Number(PowerLevel.Parameters['TP Cost Rate Weight'] || 1.00);
PowerLevel.Param.UsePhysicalDamageRate      = String(PowerLevel.Parameters['Physical Damage Rate Used'] || true);
PowerLevel.Param.PhysicalDamageRateWeight    = Number(PowerLevel.Parameters['Physical Damage Rate Weight'] || 1.00);
PowerLevel.Param.UseMagicalDamageRate          = String(PowerLevel.Parameters['Magical Damage Rate Used'] || true);
PowerLevel.Param.MagicalDamageRateWeight    = Number(PowerLevel.Parameters['Magical Damage Rate Weight'] || 1.00);
PowerLevel.Param.UseFloorDamageRate          = String(PowerLevel.Parameters['Floor Damage Rate Used'] || true);
PowerLevel.Param.FloorDamageRateWeight        = Number(PowerLevel.Parameters['Floor Damage Rate Weight'] || 1.00);
PowerLevel.Param.UseHitRate                  = String(PowerLevel.Parameters['Hit Rate Used'] || true);
PowerLevel.Param.HitRateWeight                = Number(PowerLevel.Parameters['Hit Rate Weight'] || 1.00);
PowerLevel.Param.UseEvasionRate              = String(PowerLevel.Parameters['Evasion Rate Used'] || true);
PowerLevel.Param.EvasionRateWeight            = Number(PowerLevel.Parameters['Evasion Rate Weight'] || 1.00);
PowerLevel.Param.UseCriticalRate              = String(PowerLevel.Parameters['Critical Rate Used'] || true);
PowerLevel.Param.CriticalRateWeight            = Number(PowerLevel.Parameters['Critical Rate Weight'] || 1.00);
PowerLevel.Param.UseCriticalEvasionRate      = String(PowerLevel.Parameters['Critical Evasion Rate Used'] || true);
PowerLevel.Param.CriticalEvasionRateWeight    = Number(PowerLevel.Parameters['Critical Evasion Rate Weight'] || 1.00);
PowerLevel.Param.UseMagicEvasionRate          = String(PowerLevel.Parameters['Magic Evasion Rate Used'] || true);
PowerLevel.Param.MagicEvasionRateWeight        = Number(PowerLevel.Parameters['Magic Evasion Rate Weight'] || 1.00);
PowerLevel.Param.UseMagicReflectionRate      = String(PowerLevel.Parameters['Magic Reflection Rate Used'] || true);
PowerLevel.Param.MagicReflectionRateWeight    = Number(PowerLevel.Parameters['Magic Reflection Rate Weight'] || 1.00);
PowerLevel.Param.UseCounterAttackRate          = String(PowerLevel.Parameters['Counter Attack Rate Used'] || true);
PowerLevel.Param.CounterAttackRateWeight    = Number(PowerLevel.Parameters['Counter Attack Rate Weight'] || 1.00);
PowerLevel.Param.UseHPRgenerationRate          = String(PowerLevel.Parameters['HP Regeneration Rate Used'] || true);
PowerLevel.Param.HPRgenerationRateWeight    = Number(PowerLevel.Parameters['HP Regeneration Rate Weight'] || 1.00);
PowerLevel.Param.UseMPRgenerationRate          = String(PowerLevel.Parameters['MP Regeneration Rate Used'] || true);
PowerLevel.Param.MPRgenerationRateWeight    = Number(PowerLevel.Parameters['MP Regeneration Rate Weight'] || 1.00);
PowerLevel.Param.UseTPRgenerationRate          = String(PowerLevel.Parameters['TP Regeneration Rate Used'] || true);
PowerLevel.Param.TPRgenerationRateWeight    = Number(PowerLevel.Parameters['TP Regeneration Rate Weight'] || 1.00);
PowerLevel.Param.PowerLevelBalance            = Number(PowerLevel.Parameters['Power Level Reduction'] || 1.00);
PowerLevel.Param.Debug                        = String(PowerLevel.Parameters['Debug To Console'] || false);

//=====================================================================================
//Yanfly Core Engine Status Re-Write
//=====================================================================================
var _Window_Base_drawActorSimpleStatus = Window_Base.prototype.drawActorSimpleStatus;
Window_Base.prototype.drawActorSimpleStatus = function(actor, x, y, width) {
   
    _Window_Base_drawActorSimpleStatus.call(this, actor, x, y, width)
    // var lineHeight = this.lineHeight();
    var xpad = Window_Base._faceWidth + (2 * Yanfly.Param.TextPadding);
    var x2 = x + xpad;
    var x3 = x2 + (xpad * PowerLevel.Param.PowerPosition); // Added in for Power levels
    // var width2 = Math.max(180, width - xpad - this.textPadding());
    var width3 = Math.max(180, width - (xpad * 2) - this.textPadding()); // Added in for Power levels
    // this.drawActorName(actor, x, y);
    // this.drawActorLevel(actor, x, y + lineHeight * 1);
    // this.drawActorIcons(actor, x, y + lineHeight * 2);
    // this.drawActorClass(actor, x2, y, width2);
    this.drawActorPower(actor, x3, y, width3); // Added in for Power levels
    // this.drawActorHp(actor, x2, y + lineHeight * 1, width2);
    // this.drawActorMp(actor, x2, y + lineHeight * 2, width2);
    // if (eval(Yanfly.Param.MenuTpGauge)) {
      // this.drawActorTp(actor, x2, y + lineHeight * 3, width2);
    // }
};

//=====================================================================================
//Power Level Calculation
//=====================================================================================
 
Window_Base.prototype.drawActorPower = function(actor, x, y, width) {
   
    //=================================================================================
    // Base Setup
    //=================================================================================
   
    power = 0
    previous = 0
    if (actor.oldpower == null) {
        actor.oldpower = 0
    }
    if (actor.oldpowericon == null) {
        actor.oldpowericon = 0
    }
   
    //=================================================================================
    // Standard Attributes
    //=================================================================================
   
    if (PowerLevel.Param.UseAttack == "true") {
        power += actor.atk * PowerLevel.Param.AttackWeight
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Attack: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseDefense == "true") {
        power += actor.def * PowerLevel.Param.DefenseWeight
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Defense: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseMagicAttack == "true") {
        power += actor.mat * PowerLevel.Param.MagicAttackWeight
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Magic Attack: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseMagicDefense == "true") {
        power += actor.mdf * PowerLevel.Param.MagicDefenseWeight
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Magic Defense: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseAgility == "true") {
        power += actor.agi * PowerLevel.Param.AgilityWeight
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Agility: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseLuck == "true") {
        power += actor.luk * PowerLevel.Param.LuckWeight
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Luck: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseMaxHP == "true") {
        power += (actor.mhp * PowerLevel.Param.MaxHPWeight)
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("MaxHP: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseMaxMP == "true") {
        power += actor.mmp * PowerLevel.Param.MaxMPWeight
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("MaxMP: " + power + " +(" + increase + ")")
        previous = power
    }
   
    //=================================================================================
    // Extra Attributes
    //=================================================================================
   
    if (PowerLevel.Param.UsePharmacology == "true") {
        if (actor.pha == 1) {
            power += 0
        }
        else if (actor.pha < 1) {
            power -= (actor.pha * 100) * PowerLevel.Param.PharmacologyWeight
        }
        else if (actor.pha > 1) {
            power += ((actor.pha * 100) - 100) * PowerLevel.Param.PharmacologyWeight
        }
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Pharamacology: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseGuard == "true") {
        if (actor.grd == 1) {
            power += 0
        }
        else if (actor.grd < 1) {
            power -= (actor.grd * 100) * PowerLevel.Param.GuardWeight
        }
        else if (actor.grd > 1) {
            power += ((actor.grd * 100) - 100) * PowerLevel.Param.GuardWeight
        }
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Guard Rate: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseRecovery == "true") {
        if (actor.rec == 1) {
            power += 0
        }
        else if (actor.rec < 1) {
            power -= (actor.rec * 100) * PowerLevel.Param.RecoveryWeight
        }
        else if (actor.rec > 1) {
            power += ((actor.rec * 100) - 100) * PowerLevel.Param.RecoveryWeight
        }
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Recovery Effect: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseMagicCostRate == "true") {
        if (actor.mcr == 1) {
            power += 0
        }
        else if (actor.mcr < 1) {
            power += (actor.mcr * 100) * PowerLevel.Param.MagicCostRateWeight
        }
        else if (actor.mcr > 1) {
            power -= ((actor.mcr * 100) - 100) * PowerLevel.Param.MagicCostRateWeight
        }
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("MP Cost Rate: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseTPCostRate == "true") {
        if (actor.tcr == 1) {
            power += 0
        }
        else if (actor.tcr < 1) {
            power += (actor.tcr * 100) * PowerLevel.Param.TPCostRateWeight
        }
        else if (actor.tcr > 1) {
            power -= ((actor.tcr * 100) - 100) * PowerLevel.Param.TPCostRateWeight
        }
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("TP Cost Rate: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UsePhysicalDamageRate == "true") {
        if (actor.pdr == 1) {
            power += 0
        }
        else if (actor.pdr < 1) {
            power -= (actor.pdr * 100) * PowerLevel.Param.PhysicalDamageRateWeight
        }
        else if (actor.pdr > 1) {
            power += ((actor.pdr * 100) - 100) * PowerLevel.Param.PhysicalDamageRateWeight
        }
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Physical Damage Rate: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseMagicalDamageRate == "true") {
        if (actor.mdr == 1) {
            power += 0
        }
        else if (actor.mdr < 1) {
            power -= (actor.mdr * 100) * PowerLevel.Param.MagicalDamageRateWeight
        }
        else if (actor.mdr > 1) {
            power += ((actor.mdr * 100) - 100) * PowerLevel.Param.MagicalDamageRateWeight
        }
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Magical Damage Rate: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseFloorDamageRate == "true") {
        if (actor.fdr == 1) {
            power += 0
        }
        else if (actor.fdr < 1) {
            power += (actor.fdr * 100) * PowerLevel.Param.FloorDamageRateWeight
        }
        else if (actor.fdr > 1) {
            power -= ((actor.fdr * 100) - 100) * PowerLevel.Param.FloorDamageRateWeight
        }
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Floor Damage: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseHitRate == "true") {
        if (actor.hit == 1) {
            power += 0
        }
        else if (actor.hit < 1) {
            power -= (actor.hit * 100) * PowerLevel.Param.HitRateWeight
        }
        else if (actor.hit > 1) {
            power += (actor.hit * 100) * PowerLevel.Param.HitRateWeight
        }
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Hit: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseEvasionRate == "true") {
        if (actor.eva == 0) {
            power += 0
        }
        else if (actor.eva < 0) {
            power -= (actor.eva * 100) * PowerLevel.Param.EvasionRateWeight
        }
        else if (actor.eva > 0) {
            power += (actor.eva * 100) * PowerLevel.Param.EvasionRateWeight
        }
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Evasion: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseCriticalRate == "true") {
        if (actor.cri == 0) {
            power += 0
        }
        else if (actor.cri < 0) {
            power -= (actor.cri * 100) * PowerLevel.Param.CriticalRateWeight
        }
        else if (actor.cri > 0) {
            power += (actor.cri * 100) * PowerLevel.Param.CriticalRateWeight
        }
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Critical Hit: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseCriticalEvasionRate == "true") {
        if (actor.cev == 0) {
            power += 0
        }
        else if (actor.cev < 0) {
            power -= (actor.cev * 100) * PowerLevel.Param.CriticalEvasionRateWeight
        }
        else if (actor.cev > 0) {
            power += (actor.cev * 100) * PowerLevel.Param.CriticalEvasionRateWeight
        }
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Critical Evasion: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseMagicEvasionRate == "true") {
        if (actor.mev == 0) {
            power += 0
        }
        else if (actor.mev < 0) {
            power -= (actor.mev * 100) * PowerLevel.Param.MagicEvasionRateWeight
        }
        else if (actor.mev > 0) {
            power += (actor.mev * 100) * PowerLevel.Param.MagicEvasionRateWeight
        }
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Magical Evasion: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseMagicReflectionRate == "true") {
        if (actor.mrf == 0) {
            power += 0
        }
        else if (actor.mrf < 0) {
            power -= (actor.mrf * 100) * PowerLevel.Param.MagicReflectionRateWeight
        }
        else if (actor.mrf > 0) {
            power += (actor.mrf * 100) * PowerLevel.Param.MagicReflectionRateWeight
        }
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Magic Reflection: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseCounterAttackRate == "true") {
        if (actor.cnt == 0) {
            power += 0
        }
        else if (actor.cnt < 0) {
            power -= (actor.cnt * 100) * PowerLevel.Param.CounterAttackRateWeight
        }
        else if (actor.cnt > 0) {
            power += (actor.cnt * 100) * PowerLevel.Param.CounterAttackRateWeight
        }
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("Counter Attack: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseHPRgenerationRate == "true") {
        if (actor.hrg == 0) {
            power += 0
        }
        else if (actor.hrg < 0) {
            power -= (actor.hrg * 100) * PowerLevel.Param.HPRgenerationRateWeight
        }
        else if (actor.hrg > 0) {
            power += (actor.hrg * 100) * PowerLevel.Param.HPRgenerationRateWeight
        }
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("HP Regeneration: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseMPRgenerationRate == "true") {
        if (actor.mrg == 0) {
            power += 0
        }
        else if (actor.mrg < 0) {
            power -= (actor.mrg * 100) * PowerLevel.Param.MPRgenerationRateWeight
        }
        else if (actor.mrg > 0) {
            power += (actor.mrg * 100) * PowerLevel.Param.MPRgenerationRateWeight
        }
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("MP Regeneration: " + power + " +(" + increase + ")")
        previous = power
    }
    if (PowerLevel.Param.UseTPRgenerationRate == "true") {
        if (actor.trg == 0) {
            power += 0
        }
        else if (actor.trg < 0) {
            power -= (actor.trg * 100) * PowerLevel.Param.TPRgenerationRateWeight
        }
        else if (actor.trg > 0) {
            power += (actor.trg * 100) * PowerLevel.Param.TPRgenerationRateWeight
        }
    }
    if (PowerLevel.Param.Debug == "true") {
        increase = (power - previous)
        console.log("TP Regeneration: " + power + " +(" + increase + ")")
        previous = power
    }
    power = parseInt(power / PowerLevel.Param.PowerLevelBalance)
    if (PowerLevel.Param.Debug == "true") {
        console.log("Final Calculation: " + power + " (" + previous + "/" + PowerLevel.Param.PowerLevelBalance + ")")
    }
   
    //=================================================================================
    // Text Control
    //=================================================================================
   
    width = width || 300
    offset = this.textWidth(PowerLevel.Param.PowerText)
    this.drawText(PowerLevel.Param.PowerText, x, y, width)
   
    if (power > PowerLevel.Param.TierOneMinimum && power < PowerLevel.Param.TierOneMaximum) {
        this.changeTextColor(this.textColor(PowerLevel.Param.TierOneColor))
        this.drawText(power, x + offset, y, width)
    }
    if (power > PowerLevel.Param.TierTwoMinimum && power < PowerLevel.Param.TierTwoMaximum) {
        this.changeTextColor(this.textColor(PowerLevel.Param.TierTwoColor))
        this.drawText(power, x + offset, y, width)
    }
    if (power > PowerLevel.Param.TierThreeMinimum && power < PowerLevel.Param.TierThreeMaximum) {
        this.changeTextColor(this.textColor(PowerLevel.Param.TierThreeColor))
        this.drawText(power, x + offset, y, width)
    }
    if (power > PowerLevel.Param.TierFourMinimum && power < PowerLevel.Param.TierFourMaximum) {
        this.changeTextColor(this.textColor(PowerLevel.Param.TierFourColor))
        this.drawText(power, x + offset, y, width)
    }
    if (power > PowerLevel.Param.TierFiveMinimum) {
        this.changeTextColor(this.textColor(PowerLevel.Param.TierFiveColor))
        this.drawText(power, x + offset, y, width)
    }
   
    this.changeTextColor(this.textColor(0))
   
    //=================================================================================
    // Sound Control
    //=================================================================================
   
    actor.newpower = power
    if (PowerLevel.Param.UseSoundEffects == "true") {
        if (actor.newpower == actor.oldpower) {
        }
        else if (actor.newpower > actor.oldpower) {
            actor.oldpower = power
            var audio = {}
            audio.name = PowerLevel.Param.PowerUpName
            audio.volume = PowerLevel.Param.PowerUpVolume
            audio.pitch = PowerLevel.Param.PowerUpPitch
            AudioManager.playSe(audio)
        }
        else if (actor.newpower < actor.oldpower) {
            actor.oldpower = power
            var audio = {}
            audio.name = PowerLevel.Param.PowerDownName
            audio.volume = PowerLevel.Param.PowerDownVolume
            audio.pitch = PowerLevel.Param.PowerDownPitch
            AudioManager.playSe(audio)
        }
    }
   
    //=================================================================================
    // Icon Control
    //=================================================================================
    actor.newpowericon = power
    offset = this.textWidth(PowerLevel.Param.PowerText + power)
    if (PowerLevel.Param.UseIcons == "true") {
        if (actor.newpowericon == actor.oldpowericon) {
            console.log("Same old, same old")
            this.drawIcon(PowerLevel.Param.NoChangeIcon, x + offset, y)
        }
        else if (actor.newpowericon > actor.oldpowericon) {
            console.log("Power to the player!")
            this.drawIcon(PowerLevel.Param.PowerUpIcon, x + offset, y)
            actor.oldpowericon = power
        }
        else if (actor.newpowericon < actor.oldpowericon) {
            console.log("Sucks to be you...")
            this.drawIcon(PowerLevel.Param.PowerDownIcon, x + offset, y)
            actor.oldpowericon = power
        }
    }
}
 

Latest Threads

Latest Posts

Latest Profile Posts

Another comic with Backstage Malak...
If you want to ask him anything, you can ask on my DeviantArt page! I'm not sure if you're allowed to do it here.
Forum tip of the day ...
If you get a temporary suspension for being a jerk to people who are trying to help you, and arguing with mods and admins, don't go making new accounts. Chances are, if you p**s us off enough to suspend you for a week, we're not going to hesitate giving you a permanent ban when you give us a reason.
E_6fAErVkAQILXu.png
I'm so close to releasing my game on steam! :blush::blush::blush:
Us:
"This game is awesome! I wish there are more games like this in the future."
Also us:
"I hate how games stopped being original and start copying other successful games."
Should've done this a few days ago but...
PRI_200136808.jpg
Rest in Peace, Sir Clive Sinclair
1940 - 2021
Entrepreneur, Technologist, Father of the Modern British Computing Industry, and protagonist of Legend of ZUN.

Without you, England's games and tech industry wouldn't be where it is.

Forum statistics

Threads
115,287
Messages
1,088,661
Members
149,917
Latest member
statdev
Top