Damaged Battle Sprites Plugin (MV)

Yes that is right. Right now I still have the standard battle system wich I want to change too. If you now a goid one wich works perfect or good with one I was locking for, pls name it ^^
I just updated the script, tell me if you get any help 🙂
I just updated the script, tell me if you get any help 🙂
Nice 🙂 Do I need a program for the script ? How di I get it to work I simply dont know XD
Introduction
​
This plugin allows you to add damage phases to battle sprites. Think of it as those games where girls progressively lose clothes as you deplete their HP..... Or you can just use it to visually simulate damage, I guess....
Also, if the battler recovers enough HP, their sprite will revert back to its previous phase (or the original battle sprite if it's fully healed).


Usage
​
For every phase you will need to specify a corresponding sprite name in the battler's notes, something like this:
JavaScript:
// Example for actors:
     <Damaged Sprite: Actor8_1, 60%/>
// Example for enemies:
     <Damaged Sprite: Soldier, 33.3%/>

In this example, the actor's battle sprite will change to "Actor8_1" once it reaches 60% or lower HP, and the enemy will change its sprite to "Soldier.png" once it reaches 33.3% or lower. It's that simple!

The game will search for the sprites inside their default battler sprite folders, so "sv_actors" for actors and "sv_enemies" for enemies.
The damaged phases you add will automatically be sorted in descending order.

As an added bonus, you can now easily change a battle sprite with script calls:
JavaScript:
//Change an actor or enemy sprite
     Game_Battler.setBattlerImage(fileName)
//Return an actor's sprite back to default
     Game_Battler.setBattlerImage(this.actor().battlerName)
// For enemies
     Game_Battler.setBattlerImage(this.enemy().battlerName)


Terms of service
​
- Free to use in Commercial Projects, no credit required;
- To avoid outdated versions, please don't repost and instead link to this thread.
Hi, I'm probably just confused, but I'm trying to add multiple phases and It's only showing the second phase. Is there a special input that i need to specify that it's the third phase or something? right now I have:

<Damaged Sprite: IOE Damage 2, 66.6%/>
<Damaged Sprite: IOE Damage 3, 33.3%/>

it only ever shows IOE Damage 2 even when bellow 1/3 of it's health
Hi, I'm probably just confused, but I'm trying to add multiple phases and It's only showing the second phase. Is there a special input that i need to specify that it's the third phase or something? right now I have:

<Damaged Sprite: IOE Damage 2, 66.6%/>
<Damaged Sprite: IOE Damage 3, 33.3%/>

it only ever shows IOE Damage 2 even when bellow 1/3 of it's health
Hi!
I just updated the script in this post, it should be fine now. Tell me if you still have any issues
Hi!
I just updated the script in this post, it should be fine now. Tell me if you still have any issues
Thanks for the help, but I'm having another problem. It works really good for normal enemies but now it's giving me an issue with transforming enemies. I use the transform enemy function for seeds that grow into full enemies and now their graphic doesn't change (stats and behavior do though). It's definitely this plugin because I turned it off and I didn't have this problem.
Thanks for the help, but I'm having another problem. It works really good for normal enemies but now it's giving me an issue with transforming enemies. I use the transform enemy function for seeds that grow into full enemies and now their graphic doesn't change (stats and behavior do though). It's definitely this plugin because I turned it off and I didn't have this problem.
I see, I forgot to add compatibility for transformed enemies. I updated the plugin and I think it's working as intended now.

By the way, keep in mind that if you transform an enemy its HP percentage can also change if the new enemy has a higher max HP (since it keeps the same current HP).
I see, I forgot to add compatibility for transformed enemies. I updated the plugin and I think it's working as intended now.

By the way, keep in mind that if you transform an enemy its HP percentage can also change if the new enemy has a higher max HP (since it keeps the same current HP).
I'm sorry I keep running into issues, but randomly when characters or enemies take damage it displays:

TypeError
Cannot read property 'length' of undefined

And yeah I checked and its this plugin. When I was testing at first it seemed like it was just when the player took damage but while trying to get the error to happen so I could copy it down it happened when I attacked an enemy. If it helps I'm using the first person battle system. The plugin has some stuff for side view so it may interfere or something but that seems weird since it didn't before.
I'm sorry I keep running into issues, but randomly when characters or enemies take damage it displays:

TypeError
Cannot read property 'length' of undefined

And yeah I checked and its this plugin. When I was testing at first it seemed like it was just when the player took damage but while trying to get the error to happen so I could copy it down it happened when I attacked an enemy. If it helps I'm using the first person battle system. The plugin has some stuff for side view so it may interfere or something but that seems weird since it didn't before.
I'm having the same issue after updating from 2.1 to the latest
Oh, I'm sorry, It was a silly mistake that I completely overlooked. fingers crossed that there are no other bugs! The file is already updated
I'm sorry I keep running into issues, but randomly when characters or enemies take damage it displays:

TypeError
Cannot read property 'length' of undefined

And yeah I checked and its this plugin. When I was testing at first it seemed like it was just when the player took damage but while trying to get the error to happen so I could copy it down it happened when I attacked an enemy. If it helps I'm using the first person battle system. The plugin has some stuff for side view so it may interfere or something but that seems weird since it didn't before.
I'm sorry I keep running into issues, but randomly when characters or enemies take damage it displays:

TypeError
Cannot read property 'length' of undefined

And yeah I checked and its this plugin. When I was testing at first it seemed like it was just when the player took damage but while trying to get the error to happen so I could copy it down it happened when I attacked an enemy. If it helps I'm using the first person battle system. The plugin has some stuff for side view so it may interfere or something but that seems weird since it didn't before.
I'm having this exact issue too. It just happened a few seconds ago!
I'm having this exact issue too. It just happened a few seconds ago!
I uploaded a fix 40 minutes ago, did you test with that one? I personally cannot recreate the error anymore
I uploaded a fix 40 minutes ago, did you test with that one? I personally cannot recreate the error anymore
Just downloaded it and it fixed the issue! Thanks a bunch!
Oh, I'm sorry, It was a silly mistake that I completely overlooked. fingers crossed that there are no other bugs! The file is already updated
Thank you so much, it works perfectly.
Hey is it possible to use this plugin on states? Like the state chicken will turn you into a chicken?
Hey is it possible to use this plugin on states? Like the state chicken will turn you into a chicken?
Sure. Thing is, I would basically have to write an entire new script to make that work with notes like I did with damaged sprites.

You can open my script with notepad or notepad+ and replace the function "Game_Battler.prototype.gainHp" with the one bellow:

JavaScript:
Ozu_GameBattler_gainHp = Game_Battler.prototype.gainHp;
Game_Battler.prototype.gainHp = function (value) {
    Ozu_GameBattler_gainHp.call(this, value);
    if(this.isStateAffected(2)) { // Replace 2 with the ID nº of your chicken state
        this._battlerName = "chicken" // change this to the name of your chicken sprite
    } else this.updateBattler();
}

To change back from a chicken, the enemy/player needs to be attacked again. Another way to change the sprite back is to call this function:

JavaScript:
this.updateBattler();
Sure. Thing is, I would basically have to write an entire new script to make that work with notes like I did with damaged sprites.

You can open my script with notepad or notepad+ and replace the function "Game_Battler.prototype.gainHp" with the one bellow:

JavaScript:
Ozu_GameBattler_gainHp = Game_Battler.prototype.gainHp;
Game_Battler.prototype.gainHp = function (value) {
    Ozu_GameBattler_gainHp.call(this, value);
    if(this.isStateAffected(2)) { // Replace 2 with the ID nº of your chicken state
        this._battlerName = "chicken" // change this to the name of your chicken sprite
    } else this.updateBattler();
}

To change back from a chicken, the enemy/player needs to be attacked again. Another way to change the sprite back is to call this function:

JavaScript:
this.updateBattler();
Thanks a lot this really helped me
Hi, I was wondering if there is a way to use your plugin with YEP_X_AnimatedSVEnemies? If you are not familiar with the plugin, it lets you use side view actors as enemies. I find that using side view actors as enemies gives me more freedom. I'd like the foes in my game to have different sprites based on how much damage they have taken, but I am unsure about the compatibility since side view actor sprites are placed in a different folder. Not to mention basic enemies are one pose only, while side view actors have a lot of poses in one picture, if that makes sense.

If there is no compatibility, that is okay, I just wanted to ask before I spend hours trying to make it work in vain.

@0zuma
does it work with 0% hp if theres a dont disappear flag?
Hi! Is it possible to use other variables to change the appearance? In the hp version, you will need to work hard to make it work.
Introduction
​
This plugin allows you to add damaged phases to enemy or actor battle sprites. Think of it like those games where the girls progressively lose clothes as their HP depletes. Of course you could do a lot of other stuff with it too!
Also, if the battler recovers enough HP it will change back to its previous battle sprite. (including the default battle sprite if HP returns to 100%)


Usage
​
For every phase you will need to specify a corresponding sprite name in the battler's notes, like so:
JavaScript:
// Place this in the actor or enemy's notes:
    <Damaged Sprite: SpriteA, 60%/>
    <Damaged Sprite: SpriteB, 33.3%/>

In this example, the battler's sprite will change to "SpriteA.png" once it reaches 60% or lower HP and to "SpriteB.png" once it reaches 33.3% or lower. It's that simple!

The game will search for the sprites inside their default battler sprite folders.

As an added bonus, you can now easily change a battle sprite with script calls:
JavaScript:
//Change an actor or enemy sprite
     Game_Battler.setBattlerImage(spriteName)
//Return an actor's sprite back to default
     Game_Battler.setBattlerImage(this.actor().battlerName)
// For enemies
     Game_Battler.setBattlerImage(this.enemy().battlerName)


Terms of service
​
- Free to use in Commercial Projects, no credit required;
- To avoid outdated versions, please don't repost and instead link to this thread.
Hi Ozuma. There's a problem here: when I use the script call
JavaScript:
Game_Battler.setBattlerImage(MySprite)
I get the error "MySprite is not defined". Please tell me what am I doing wrong? I haven't been able to figure it out for two days now... 🙁

Original thread: https://forums.rpgmakerweb.com/threads/damaged-battle-sprites-plugin-mv.116443/