Equipment Durability

Selchar

Veteran
Veteran
Joined
Dec 28, 2012
Messages
299
Reaction score
78
First Language
English
Primarily Uses
Turns out it was as simple as I initially thought, I just didn't take everything into consideration. The following will allow both the skill durability cost mod and the actual skill costs to be decimals. I haven't had any issues so far. If you need anything else changed to floats let me know, the only thing left I can think of atm would be max durability.

Code:
class RPG::Weapon  def skill_durability_mod(skill_id)    if @skill_durability_mod.nil?      @skill_durability_mod = []      $data_skills.each do |i|        next unless i        if @note =~ /<skill[-_ ]?durability[-_ ]?mod[-_ ]?#{i.id.to_s}:\s*(.*)\s*>/i          @skill_durability_mod[i.id] = $1.to_f        else          @skill_durability_mod[i.id] = 0.0        end      end    end    @skill_durability_mod[skill_id]  endendclass RPG::Skill  def weapon_durability_cost    @note =~ /<durability[-_ ]?cost:\s*(.*)\s*>/i ? @durability_cost = $1.to_f : @durability_cost = TH_Instance::Weapon::Default_Durability_Cost.to_f if @durability_cost.nil?    @durability_cost  endend
 
Joined
Jan 24, 2014
Messages
3
Reaction score
0
First Language
Portuguese
Primarily Uses
Everything is great! To make the max durability a decimal would only show bigger settings, it's the opposite of what I'm wanting. Thank you very much, Selchar!
 

BloodletterQ

Chaotic Neutral Assassin
Veteran
Joined
Aug 15, 2012
Messages
1,462
Reaction score
1,065
First Language
English
Primarily Uses
N/A
Have you considered something like Fire Emblem Awakening's Armthrift skill where a passive skill or even an accessory can sometimes prevent equipment from losing durability?
 

Selchar

Veteran
Veteran
Joined
Dec 28, 2012
Messages
299
Reaction score
78
First Language
English
Primarily Uses
Awakening... haven't played that one.  Equipment that can add a chance to avoid reducing Weapon Durability can easily be done I think.  A passive skill that does the same?  It's possible(makes a note to look at how passive skills can be done)

Edit: And done, check the 1st post, or just click the following.

https://drive.google.com/file/d/0BywhvOtY4_H9X0E4WTBaaU1pVzA/edit?usp=sharing
 
Last edited by a moderator:

TwilightKnight1

Veteran
Veteran
Joined
Apr 6, 2014
Messages
31
Reaction score
2
First Language
English
Primarily Uses
So, I'm having issues with the script...

No, it works, durability works as it should, all items are counted as different entries in the inventory, but my issue is: the script keeps crashing the game I'm working on whenever I'm going to sell items with the Galv Shopping script.

Is there a patch I'm missing? Is it an compatibility issue? Is there an simple fix I haven't seen?

Edit: Also, every single time I use an item(like a potion or something) it crashes the game.
 
Last edited by a moderator:

ErifOnaclov

Warper
Member
Joined
Apr 14, 2014
Messages
1
Reaction score
0
First Language
French
Primarily Uses
I've look at your Armthrift script, and it seems you forgot to add a method in the skills class which you call in Game_Battler.
 

Rink27

Veteran
Veteran
Joined
Jul 18, 2014
Messages
222
Reaction score
12
First Language
English
Primarily Uses
RMMV
Sorry for reviving this, but does anyone know how to make the broken weapon change occur within battle?

You can set an item whose durability has reached 0 to change to another weapon (such as a broken sword), but I've set it up so that a sword switches between three forms whenever the durability runs out. However, when it reaches 0 in battle, the battler has no weapon in combat. (The next form in line does appear in the inventory though, but not equipped)
 

hassanzass

Villager
Member
Joined
Apr 4, 2013
Messages
16
Reaction score
0
First Language
swedish
Primarily Uses
When i try to use  Tsukihime's Item Instance i get this message: Script 'Game_Party' line103: NoMethodError occured. undefined method '+' for nil:NilClass

How do i fix this?
 

Roundpitt

Villager
Member
Joined
May 15, 2013
Messages
7
Reaction score
1
First Language
English
Primarily Uses
Hey this is an awesome script, way to go! I was just wondering if there was any way to use an armor's durability in and if statement inside of an event.

For example If body slot armor is 5 then display an image.

Basicly, I have an image of the main character and when they're armor gets damaged I want to use an event to change thier picture to reflect the look of damaged armor
 
Joined
Jan 23, 2014
Messages
159
Reaction score
19
First Language
English
Hi Selchar,

You sir are amazing. I can totally rely on you to make awesome scripts!

I found a possible bug, Seems like Armor Durability doesn't work for anything but the default slots, (i.e. Yanfly's Equip Engine)

When I add more than the default slots it doesn't register it. (It might be an instance item issue too)

Anyway here is some screenshots of my database:

http://i.imgur.com/ysP3f6S.png <-- an example of notetagged correctly.

http://i.imgur.com/carPiso.png < -- another example of notetagged correctly

http://i.imgur.com/HoNgaf2.png <-- yet another example of notetagged correctly (but with a yanfly equip notetag)

Equip Screen:

http://i.imgur.com/NqteV5G.png 

As you can see in the equip screen the bronze gauntlets (along with the sabatons and cloak) doesn't have a durability even though I set it to have some. yet the other ones have durability.

Any ideas how to fix this? Even if you don't have the time to fix it, if you point me in the right direction I can try my hand at "franken-coding" :D
 
Last edited by a moderator:

Selchar

Veteran
Veteran
Joined
Dec 28, 2012
Messages
299
Reaction score
78
First Language
English
Primarily Uses
Yanfly's Equip Engine correct?  Also you're equipping them using the notetag <starting gear: x>?  If so then it looks like a slight compatibility problem between it and Tsukihime's Instance Items.  If you unequip/reequip them you'll see the durability.  My guess is that at first you are seeing actual Template Items(non-instances).  Unequipping hides them and adds an instance into your inventory(I think).  There are two ways to solve it.

1: Eventing: manually add them to your inventory and equip them.

2: Slightly modify the method used by Yanfly's script.  You can add the following below Yanfly's script and it should fix the problem.

Code:
class Game_Actor < Game_Battler  def equip_extra_starting_equips    for equip_id in actor.extra_starting_equips      armour = $data_armors[equip_id]      next if armour.nil?      etype_id = armour.etype_id      next unless equip_slots.include?(etype_id)      slot_id = empty_slot(etype_id)      #@equips[slot_id].set_equip(etype_id == 0, armour.id) #Original Line, the following is new      $game_party.gain_item(armour, 1)      change_equip(slot_id, armour)    end    refresh  endend
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,230
Reaction score
3,071
First Language
English
For the line you commented out, you could say

@equips[slot_id].set_equip(etype_id == 0, InstanceManager.get_instance(armour).id)Or, instead of replacing the code, I would do the same as what I did with my "check instances"

Code:
class Game_Actor < Game_Battler    alias :th_instance_items_equip_extra_starting_equips :equip_extra_starting_equips  def equip_extra_starting_equips    check_extra_instance_equips    th_instance_items_equip_extra_starting_equips  end    def check_extra_instance_equips    new_equips = []    actor.extra_starting_equips.each do |equip_id|      armour = $data_armors[equip_id]      next if armour.nil?      etype_id = armour.etype_id      next unless equip_slots.include?(etype_id)      new_armour = InstanceManager.get_instance(armour)            new_equips << new_armour.id    end    actor.extra_starting_equips = new_equips  endend
You're replacing the extra starting equips...but that SHOULDN'T be too much of a problem I think.I will include one of these fixes as a patch on the instance items page as well.

The first approach is correct (the one you used and my alternative) since you're just creating an instance out of a template. The second approach requires further testing.
 
Last edited by a moderator:
Joined
Jan 23, 2014
Messages
159
Reaction score
19
First Language
English
Related but unrelated to this script, I sent you a PM Selchar. Tell me what you think about it.
 

Arsist

Veteran
Veteran
Joined
May 16, 2014
Messages
140
Reaction score
10
Primarily Uses
If you were hit by a low sweep or mid slash, how would that affect your iron helm's durability, just as how would a punch affect your iron boots' durability?

What if there were an inclusion/exclusion list, where you specify, say, what attacks do affect the armor's durability, say if you're using a high/low/mid/all system?

Wait, there's the element rate for this script.
 
Last edited by a moderator:
Joined
Jan 23, 2014
Messages
159
Reaction score
19
First Language
English
If you were hit by a low sweep or mid slash, how would that affect your iron helm's durability, just as how would a punch affect your iron boots' durability?

What if there were an inclusion/exclusion list, where you specify, say, what attacks do affect the armor's durability, say if you're using a high/low/mid/all system?

Wait, there's the element rate for this script.
It still is a good idea. Having different hit places, instead of a random mechanism. What do you mean element rate for this script?
 

Arsist

Veteran
Veteran
Joined
May 16, 2014
Messages
140
Reaction score
10
Primarily Uses
Meaning that you can affect percentage chance at which a skill damages your durability. So you could set the chance to have your helm's durability damaged by skills of the "Low" element to zero. I am not sure how this function works with the multiple-element scripts (which I do use), but I will be testing it out.
 

megamageiii

Warper
Member
Joined
Jun 6, 2014
Messages
3
Reaction score
0
First Language
English
Primarily Uses
I've been looking at this script, and it seems to work pretty well, but would it be possible to damage a weapon outside of combat somehow (probably with a script call)? I have been trying to find a way, but I can't seem to get it to work.

EDIT: I got it to work with this:

equip = $game_actors[1].equips[0]equip.durability -= 1But it doesn't update the suffix in the menu. It updates after I go into battle, however, and by setting a variable to equip.durability I figured out that it is working. Also, the weapon won't break. If I add:

if equip.durability <= 0 equip.durability = 0 equip.break_by_durability($game_actors[1])endIt gives a no mothod error, saying "undefined method 'log_window'". I'm guessing this is because it's not in battle, but I'm not sure.
 
Last edited by a moderator:

CriticalRPG

Necromancer
Veteran
Joined
Aug 1, 2015
Messages
91
Reaction score
5
First Language
English
Primarily Uses
RMMV
How would you use the <skill durability mod> tag? I think I'm doing something wrong.

Do I put the tag in the weapon or the skill?
 

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

Latest Threads

Latest Profile Posts

Look, I get that it's illegal, but...
It just happen we got P7 as booth number, so i draw Girls Frontline's P7 in this
Stream will be live shortly! Going to start with some Minecraft spriting, and might switch mid-stream. Depends~ Feel free to drop by!
MushroomCake28 wrote on Finnuval's profile.
Glad to see you're back! I was wondering what you've become! It's been a while since we spoke to each other!
zachb wrote on Human_Male's profile.
I know this was months ago, but I don't completely understand the lunatic states program (how you set it up). I just want to apply a stone state (and death) to a character after x amount of time. Can you show me an example of how to set it up?

Forum statistics

Threads
93,469
Messages
912,756
Members
123,005
Latest member
Digimanthan
Top