- Joined
- Jul 18, 2016
- Messages
- 157
- Reaction score
- 27
- First Language
- English
- Primarily Uses
- RMMV
I'm creating a game with a weight system for equipment, where each actor has a certain amount of Power, and each piece of equipment has Weight. The actors can only equip items as long as the total Weight does not exceed Power.
To do this, the Max HP parameter has been changed to Power and the Max MP parameter has been changed to Weight. Then by using Yanfly's Equip Core and Equip Requirements I can use note tags to make this effect work.
First, each actor's Max HP (Power) is set to x amount. Then, each piece of equipment has a Weight value by setting the Max MP in the editor. Finally, a note tag is used so that if the actor tries to equip that item and it's weight value exceeds remaining Power, the item cannot be equipped. Here is the note tag that I use:
<Custom Equip Requirement Condition>
var output = user.mhp;
var weight = user.mmp;
var power = output - weight; //Sets the amount of available power
if (Math.floor(user.equips()[1].params[1] - 87) >= 0) { //Check if the item to be equipped is lighter than what is currently equipped. If so...
condition = true; //Can be equipped
} else { //If not...
var diff = Math.abs(user.equips()[1].params[1] - 87); //Since the item to be equipped is heavier, get the absolute value of the difference in weight
if (diff <= power) { //If the difference in weight is less than or equal to the amount of available power...
condition = true; //Can be equipped
} else {
condition = false; //Cannot be equipped
}
}
</Custom Equip Requirement Condition>
EDIT: I had the note tag wrong initially, but it seems to be fixed now. Everything is working now except for the problem of empty equip slots, where the weight in that slot is 0 (nothing equipped), but the actual value is undefined.
To do this, the Max HP parameter has been changed to Power and the Max MP parameter has been changed to Weight. Then by using Yanfly's Equip Core and Equip Requirements I can use note tags to make this effect work.
First, each actor's Max HP (Power) is set to x amount. Then, each piece of equipment has a Weight value by setting the Max MP in the editor. Finally, a note tag is used so that if the actor tries to equip that item and it's weight value exceeds remaining Power, the item cannot be equipped. Here is the note tag that I use:
<Custom Equip Requirement Condition>
var output = user.mhp;
var weight = user.mmp;
var power = output - weight; //Sets the amount of available power
if (Math.floor(user.equips()[1].params[1] - 87) >= 0) { //Check if the item to be equipped is lighter than what is currently equipped. If so...
condition = true; //Can be equipped
} else { //If not...
var diff = Math.abs(user.equips()[1].params[1] - 87); //Since the item to be equipped is heavier, get the absolute value of the difference in weight
if (diff <= power) { //If the difference in weight is less than or equal to the amount of available power...
condition = true; //Can be equipped
} else {
condition = false; //Cannot be equipped
}
}
</Custom Equip Requirement Condition>
EDIT: I had the note tag wrong initially, but it seems to be fixed now. Everything is working now except for the problem of empty equip slots, where the weight in that slot is 0 (nothing equipped), but the actual value is undefined.
Last edited:

