Durability notifications

akukoa

Warper
Member
Joined
Jun 1, 2019
Messages
4
Reaction score
1
First Language
English
Primarily Uses
N/A
Hi,

This might not be in the right category but I wasn't sure where else to post this, if it is in the wrong category, please move it to the right one.

I am still very new to RPG maker and am not sure how to do this.
What I am looking for is a way to have a notification or event start when an equipped item's durability hits a certain percentage ( such as 20% or so ).
I am using Yep.72 - Item Durability ( http://yanfly.moe/2016/02/20/yep-72-item-durability/ )for the durability on items but can't seem to figure out how to use the durability parameter to trigger events or make notifications pull up.

To give some insight on why I want this, I have a few other scripts and things set up that depending on the weapons and armors that the characters are using their status image is changing. With that, I also want to show wear and tear on the armors and weapons when it gets to certain percentages of being damaged.

What I currently use for the visuals of the armors on each actor is some variables that then using a script pull the image associated with the result of that variable, so for the durability, all I would really need is to know what code piece I could use to pull the durability of an item and put it in a variable.

Similar to
If durability is 100 then set variable to "Clean"
If durability is 75 then set variable to "Scratched"
If durability is 50 then set variable to "Dented"
If durability is 25 then set variable to "Damaged"

If need be, having the things as numbers, such as clean being 0, scratched being 1 etc is fine too, I can work with that.

Anyone know how I can do this? I tried to find it myself but all I was doing was not working at all, when I tried to make some changes in the scripts itself it also started to break other things that I have set up for this.

Edit: This is in RPG Maker MV

Thanks in advance.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,088
Reaction score
1,508
First Language
EN
Primarily Uses
RMMZ
What I currently use for the visuals of the armors on each actor is some variables that then using a script pull the image associated with the result of that variable, so for the durability, all I would really need is to know what code piece I could use to pull the durability of an item and put it in a variable.
This script will assign the value 128 to variable ID 42:
Code:
$gameVariables.setValue(42, 128);
I had a look at the plugin code, and this looks promising re getting the durability:
Code:
DataManager.getDurability(item);
If you don't already have the item conveniently stored in a variable, you could, for instance, reference a particular actor's equipment:
Code:
var item = $gameActors.actor(1).equips()[0];
^ This should retrieve the item in actor 1's first equip slot. So...putting that all together, for instance:
Code:
var item = $gameActors.actor(1).equips()[0];
var varId = 42;
var value = DataManager.getDurability(item);
$gameVariables.setValue(varId, value);
As you can see, it depends a bit on what you're starting with. :kaothx:
 

akukoa

Warper
Member
Joined
Jun 1, 2019
Messages
4
Reaction score
1
First Language
English
Primarily Uses
N/A
OMG, you make it look so easy and it works too ....
Thank you so much, now William ( my main character ) can be running around in shiny and all busted up armor.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,865
Messages
1,017,059
Members
137,575
Latest member
akekaphol101
Top