1 (edited by Starcutter 2021-08-17 21:40:25)

Topic: Self-Damaging Moves (Any version)

In "DefaultBattleGUI"

At the top of your class, paste

public FPLibrary.Fix64 SelfDamageCap = 600;

That 600 there is the minimum amount of HP your character can have and still activate the self-inflicting damage, so change that however you like.

And then once you've done that, after

if (this.player2.targetLife > UFE.GetPlayer2ControlsScript().currentLifePoints){
                this.player2.targetLife -= this.lifeDownSpeed * deltaTime;
                if (this.player2.targetLife < UFE.GetPlayer2ControlsScript().currentLifePoints)
                    this.player2.targetLife = (float)UFE.GetPlayer2ControlsScript().currentLifePoints;
            }
            if (this.player2.targetLife < UFE.GetPlayer2ControlsScript().currentLifePoints){
                this.player2.targetLife += this.lifeUpSpeed * deltaTime;
                if (this.player2.targetLife > UFE.GetPlayer2ControlsScript().currentLifePoints)
                    this.player2.targetLife = (float)UFE.GetPlayer2ControlsScript().currentLifePoints;
            }

and before

bool player1CurrentStartButton = false;
            bool player1PreviousStartButton = false;
            bool player2CurrentStartButton = false;
            bool player2PreviousStartButton = false;

between those, paste

//Code for self-damaging (Player 1)
            //Make sure Gauge 5 isn't used for anything else, and that your character has 1000 Max Gauge
            if (player1.controlsScript.currentGaugesPoints[4] <= (UFE.config.player1Character.maxGaugePoints - 50))
            {
                if ((UFE.GetPlayer1ControlsScript().currentLifePoints - (player1.controlsScript.currentGaugesPoints[4] * 10)) > 0)
                {
                    UFE.GetPlayer1ControlsScript().currentLifePoints = (UFE.GetPlayer1ControlsScript().currentLifePoints - (player1.controlsScript.currentGaugesPoints[4] * 10));
                    player1.controlsScript.currentGaugesPoints[4] = UFE.config.player1Character.maxGaugePoints;
                }
                else
                {
                    UFE.GetPlayer1ControlsScript().currentLifePoints = 50;
                    player1.controlsScript.currentGaugesPoints[4] = (UFE.config.player1Character.maxGaugePoints - 1);
                }

                if (UFE.GetPlayer1ControlsScript().currentLifePoints <= SelfDamageCap)
                {
                    player1.controlsScript.currentGaugesPoints[4] = (UFE.config.player1Character.maxGaugePoints - 1);
                }
                else
                {
                    player1.controlsScript.currentGaugesPoints[4] = UFE.config.player1Character.maxGaugePoints;
                }
            }
            //Code for self-damaging (Player 2)
            //Make sure Gauge 5 isn't used for anything else, and that your character has 1000 Max Gauge
            if (player2.controlsScript.currentGaugesPoints[4] <= (UFE.config.player2Character.maxGaugePoints - 50))
            {
                if ((UFE.GetPlayer2ControlsScript().currentLifePoints - (player2.controlsScript.currentGaugesPoints[4] * 10)) > 0)
                {
                    UFE.GetPlayer2ControlsScript().currentLifePoints = (UFE.GetPlayer2ControlsScript().currentLifePoints - (player2.controlsScript.currentGaugesPoints[4] * 10));
                    player2.controlsScript.currentGaugesPoints[4] = UFE.config.player2Character.maxGaugePoints;
                }
                else
                {
                    UFE.GetPlayer2ControlsScript().currentLifePoints = 50;
                    player2.controlsScript.currentGaugesPoints[4] = (UFE.config.player2Character.maxGaugePoints - 1);
                }

                if (UFE.GetPlayer2ControlsScript().currentLifePoints <= SelfDamageCap)
                {
                    player2.controlsScript.currentGaugesPoints[4] = (UFE.config.player2Character.maxGaugePoints - 1);
                }
                else
                {
                    player2.controlsScript.currentGaugesPoints[4] = UFE.config.player2Character.maxGaugePoints;
                }
            }

Once you've pasted this code, go into your move you want to be self-damaging and create a new gauge option. Choose gauge 5 and set the gauge required to 100%

If you have your character's max gauge to 1000 like I have, your remainder % of "gauge cost" times 100 will be how much damage will be self-inflicted. For example, if I set "gauge cost" to 95%, the remaining 5% will be multiplied by 100 to reach 500 self-inflicted damage.

Other notes, this uses up Gauge 5, so if you already have something using gauge 5, it may mess things up. In that case, replace any [4]s you see there with whatever gauge you aren't using -1.


Honestly, this isn't really the best way to do things since it uses up a gauge among other things (such as my very amateur programming, or how the health is depleted instantly) but since I got this to work, I figured I might as well share it! Hopefully this works for you, too!

Edit: I'm pretty sure a similar method could be used for healing moves as well, with slight adjustments it would definitely be possible.

Share

Thumbs up +3 Thumbs down