Jump to content
  • 0

Item degrigation


Tyler

Question

Hi all trying create weapon/armour degrigation, i think i have the created it but having an issue diplaying the current varabe amount..was looking at one of two ways, 1 in the item description text  or 2 upon hit in a chat windpw, neither of which i seem to be able to get to work, which make it hard to test if it works, it has a contition to remove item use if condition is 0 or less, (not unequip which would cause another issue but can test it yet.

 the simplest way to show that im trying to do is to link a google doc .

https://docs.google.com/document/d/1NOxqdJRhk9bAKeh_lPxewDkEIiuTnzcDzlWSqm_Rzxs/edit?usp=sharing

any help would be appreciated

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi, What you are trying to do is possible but will be a lot of work overall and wont be that efficient. Doing a source edit would be better to make this an actual function.

 

Here are some issues you will come across using events to do this:

  • You cant use \pv{variable} inside the descriptions of items/spells and such (I might raise this as a feature request as could be useful)
  • You will need to create a variable for each item you want durability
  • Need to consider what happens if the player has two of the same weapon/armour, using player variables will mean same items will have the same durability
  • Setting the durability on pickup randomly: this will allow players to just drop the item and pick it back up for new durability? unless you make the items non droppable
Link to comment
Share on other sites

  • -1

Hi there!

I took a look at your logic. Since you are using variables to track durability, the issue with displaying it usually comes down to how the engine refreshes text or how the variable is being called.

Here are a few solutions to help you test and display the values:

1. The Quickest Way to Test (Console Log) If you just want to know if your math is working (i.e., is the weapon actually degrading?), the best way is to use the Console instead of the chat window. In your code/script section where you decrease the variable, add this line immediately after:

JavaScript

console.log("Current Durability: " + $gameVariables.value(YOUR_VARIABLE_ID));

(Replace YOUR_VARIABLE_ID with the ID number of your durability variable). Then, while playtesting, press F8 (or F12) to open the console. Every time you hit, you will see the number update in real-time.

2. Displaying in the Chat/Battle Log If you want the player to see it in the chat window upon impact, you need to push a message to the game's message handler inside your damage formula or script call:

JavaScript

// Example for RPG Maker script call $gameMessage.add("Durability remaining: " + $gameVariables.value(YOUR_VARIABLE_ID));

Note: Depending on your battle system (CTB/ATB), pop-ups might be better, but this will force text to the window.

3. Displaying in Item Description To show the variable in the item description, you usually use the standard text code: \V[x] (where x is the variable ID).

Example: Durability: \V[15]/100

Important Note on Variables vs. Independent Items: If you are using a single Variable (e.g., Variable 15) to track durability, keep in mind that every weapon of that type will share that health. If you equip a second sword, it will have the same damage as the first one.

If the description isn't updating: Item descriptions are often cached. You might need to exit and re-enter the menu to see the \V[x] number change, or use a plugin like YEP_MessageCore to ensure text codes work in descriptions.

4. Regarding the "0 Durability" Logic You mentioned you want to remove the item use without unequipping to avoid crashes. A safer alternative to "removing use" is to apply a "Broken" State.

Create a State called "Broken Weapon" (Seal Attack, or set Parameters to 0).

In your conditional branch: If Variable <= 0:

Add State "Broken Weapon" to the user.

Play a "Break" sound effect.

(Optional) Change the weapon's icon or name if you are using an Independent Items plugin.

Hope this helps you debug it!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...