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
1,810
Reaction score
1,268
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

Oh man the controls in Mario Sunshine are pretty awful and I haven't even witnessed the controls without FLUDD
Lots of cool changes for Battle Castle in the works! Not just reworked dialogue, but gameplay, combat, and possibly lore changes to make things weightier.
Actor2_2 added!

I started really going in on my project April of last year... I'm just now making starting the actual game... making assets (and not even all of them), whoooo... TIME SINK.


Imagine being a pleb and using --------------------.js :LZSwink:

Forum statistics

Threads
102,947
Messages
996,206
Members
134,411
Latest member
Scop
Top