I am trying to create a Reraise Armor that breaks once used. I have implemented the reraise state and attached it to the item using a Passive State plugin. It works fine but obviously it lets me never die. I want the item to be a one time use item. I have installed the Yanfly plugin Item Durability and set it to 1 with nothing that lowers durability. Is there any way I can have the durability go down by one via death? Or a state? Because so far the plugin only allows for item and skill activation. Or is there a unique work around I can use to make it use a skill instead of a passive state? I am unsure of how to get it to work.
MV Armor Breaking on Death
RPG Maker MV SupportDepends on what you want it to do. "Breaking" could mean you just remove the thing from the inventory entirely. Maybe "Breaking" only means you get to keep the item, but the state no longer applies? Maybe it's "Repaired" after battle?
Whatever the case, I'm pretty sure you can do all this within the state notetags of the revive state.
Whatever the case, I'm pretty sure you can do all this within the state notetags of the revive state.
I want it to be unable to be repaired or used again. How would I go about doing this in the state notetags of the revive state?
This is the current state notetag:
<Category: Bypass Death Removal>
<Custom Deselect Effect>
if (target.hp <= 0 || target.isDead()) {
target.startAnimation(49);
var rate = 0.40;
var heal = Math.floor(target.mhp * rate);
target.removeState(stateId);
target.gainHp(heal);
target.startDamagePopup();
target.clearResult();
}
</Custom Deselect Effect>
This is the current state notetag:
<Category: Bypass Death Removal>
<Custom Deselect Effect>
if (target.hp <= 0 || target.isDead()) {
target.startAnimation(49);
var rate = 0.40;
var heal = Math.floor(target.mhp * rate);
target.removeState(stateId);
target.gainHp(heal);
target.startDamagePopup();
target.clearResult();
}
</Custom Deselect Effect>
To remove the equipped armor, it should be something like...
And then to remove the armor from the inventory
I'm not really a coder, I only picked up a few bits of info here and there, and googling my way around, so this may or may not work. 😅
Code:
user.forceChangeEquip(3, null);
And then to remove the armor from the inventory
Code:
gameParty.loseItem(armor, 1, false);
I'm not really a coder, I only picked up a few bits of info here and there, and googling my way around, so this may or may not work. 😅
I haven't managed to get it to work. Although I don't know where to put that code inside the notetag. I tried putting it in the script for the plugin but that didn't do anything as I assume the plugin script is only for itself.
It should go anywhere into the notetag before you remove the state basically. What part of it doesn't work? Is the armor not unequipped? I'm assuming however you applied the state is connected to wearing the armor, and should be removed once unequipped.
(Tbh not sure why you remove the state in the notetag to begin with... It should get automatically removed once the armor is no longer equipped.)
(Tbh not sure why you remove the state in the notetag to begin with... It should get automatically removed once the armor is no longer equipped.)
The armor is not unequipping and therefore not breaking.
You might need to change the slot ID.
"3" refers to the default engine slot for body. If you are using anything else, you'll need to adjust that number. By default, it's:
0 = Weapon
1 = Shield
2 = Head armor
3 = Body armor
4 = Accessory
You can check the id in your types tab.
We also need to change the script to remove the armor from the inventory. My bad.
this should remove the specific armor id.
Code:
user.forceChangeEquip(3, null);
0 = Weapon
1 = Shield
2 = Head armor
3 = Body armor
4 = Accessory
You can check the id in your types tab.
We also need to change the script to remove the armor from the inventory. My bad.
Code:
$gameParty.loseItem($dataArmors[IDOfYourArmor], 1, false);
Regardless of the number it still doesn't seem to be doing anything
I have it set up like this now:
<Category: Bypass Death Removal>
<Custom Deselect Effect>
if (target.hp <= 0 || target.isDead()) {
target.startAnimation(49);
var rate = 0.40;
var heal = Math.floor(target.mhp * rate);
target.removeState(stateId);
target.gainHp(heal);
target.startDamagePopup();
user.forceChangeEquip(2, null);
gameParty.loseItem(Armor, 57, false);
target.clearResult();
}
</Custom Deselect Effect>
I have it set up like this now:
<Category: Bypass Death Removal>
<Custom Deselect Effect>
if (target.hp <= 0 || target.isDead()) {
target.startAnimation(49);
var rate = 0.40;
var heal = Math.floor(target.mhp * rate);
target.removeState(stateId);
target.gainHp(heal);
target.startDamagePopup();
user.forceChangeEquip(2, null);
gameParty.loseItem(Armor, 57, false);
target.clearResult();
}
</Custom Deselect Effect>
You can try target.forceChangeEquip(2, null); instead of user. Sometimes the reference is a little weird in states.
You should also check the console during testing for errors.
You're not using the loseitem script call like I posted it, so that won't work either.
You should also check the console during testing for errors.
You're not using the loseitem script call like I posted it, so that won't work either.
I tried it with those changes and it still doesn't remove the item after use. It doesn't even unequip it.
Hi there.
I have a solution for ya.
You'll need to install my Durability extension plugin found HERE.
Once installed, just add the following to your given notetag:
Where X is the specific slot number of your reraise armor.
Let me know if this works.
I have a solution for ya.
You'll need to install my Durability extension plugin found HERE.
Once installed, just add the following to your given notetag:
JavaScript:
<Custom Deselect Effect>
if (target.hp <= 0 || target.isDead()) {
target.startAnimation(49);
var rate = 0.40;
var heal = Math.floor(target.mhp * rate);
target.removeState(stateId);
target.gainHp(heal);
target.startDamagePopup();
if (target.isActor()) target.damageSpItemDurability(1, target.equips()[X]);
target.clearResult();
}
</Custom Deselect Effect>
Where X is the specific slot number of your reraise armor.
Let me know if this works.
I installed the plugin and played around with the script a little to get it to do what I wanted but eventually it did work! Great plugin extension! It was exactly what I needed!
Happy to help!
Original thread: https://forums.rpgmakerweb.com/threads/armor-breaking-on-death.180850/