YEP Item Durability Specific Skills only affect Specific Weapons

Status
Not open for further replies.

Seacliff

RPG Maker Mastermind
Veteran
Joined
Nov 8, 2012
Messages
2,982
Reaction score
1,129
First Language
Yes
Primarily Uses
RM2k
Yanfly Item Durability has the ability to universally affect all weapons when setting the durability lost through physical or magical actions. However, I would like to have a specific weapon type to lose durability when using magical actions.

For example. Using magical attacks when using sword does not affect the durability, but using magical attacks when using staves does affect the durability.

I tried using a few evals in the Magical Action Parameter:
if ($gameActors.actor(this.actorId()).isWtypeEquipped(2) === true) { -1; }

if ($gameActors.actor(this.actorId()).isWtypeEquipped(2) === true) { -1; if (this.actorId().equips()[0].durability <= 0) {this.actorId().durabilityBreakItem(this.actorId().equips()[0]);} }

if ($gameActors.actor(this.actorId()).isWtypeEquipped(2) === true) { return -1; }

However, all of these turns the weapon in question into unbreakable equipment, rather than lowering it.
Are there any issues with the eval, or an alternative way to do this?
 

shockra

Slightly Crazy Programmer
Veteran
Joined
Feb 16, 2016
Messages
444
Reaction score
208
First Language
English
Primarily Uses
RMMV
I don't think evals work in the plugin parameters. This might need to be done through notetags. Each skill will need to address each weapon type to determine durability changes.
 

Seacliff

RPG Maker Mastermind
Veteran
Joined
Nov 8, 2012
Messages
2,982
Reaction score
1,129
First Language
Yes
Primarily Uses
RM2k
Whenever I try to do this with Yanfly Skill core an 'undefined is not a function' error.

This is the note I used for the skill.

<After Eval>
if ($gameActors.actor(this.actorId()).isWtypeEquipped(2) === true)
{
$gameActors.actor(this.actorId()).equips()[0].durability -= 1;
}
</After Eval>

Edit: I found part of the issue. Defining an actor with $gameActors.actor() works, the 'undefined' is probably from the 'this actor id' statement. However, I still need a way to make sure the actor casting the skill is called.
 
Last edited:

shockra

Slightly Crazy Programmer
Veteran
Joined
Feb 16, 2016
Messages
444
Reaction score
208
First Language
English
Primarily Uses
RMMV
Try this:

<After Eval>
if (user.equips()[0].wtypeId === 2)
{
user.equips()[0].durability -= 1;
}
</After Eval>
 

Seacliff

RPG Maker Mastermind
Veteran
Joined
Nov 8, 2012
Messages
2,982
Reaction score
1,129
First Language
Yes
Primarily Uses
RM2k
Apparently, I've been making it more contrived than it needed to be. This works great, but an unintended consequence came up, the skill will break unbreakable weapons.
Is there a way to check this before removing the durability?
Edit: NM, I'll just make sure these are not listed as the WType. This can be closed.
 
Status
Not open for further replies.

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

Latest Threads

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
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.

Forum statistics

Threads
105,868
Messages
1,017,093
Members
137,587
Latest member
Usagiis
Top