(note: by default, items that cannot be used are hidden. This is a modified project that simply grays them out)
This script allows you to define custom use conditions for your items and skills. The default use conditions are only available for skills, and is limited to specifying up to two weapon types.
This script allows you to define requirements based on things like
- actor’s class
- equipped weapons
- equipped armors
- equipped weapon types
- equipped armor types
- learned skills
- active states
- formulas, for anything else
You can create conditions to require multiple conditions to be met, or require at least one condition to be met.
Script: download here
In the script editor, place this script below Materials and above Main
Specifying Use Conditions
Note-tag your skills or items with the following
<use conditions> TYPE1: VALUE1 TYPE2: VALUE2 </use conditions>
Refer to the reference section for a list of available use conditions.
There is a special “formula” type that allows you to evaluate any arbitrary formula. The following formula variables are available
a - current actor p - game party t - game troop s - game switches v - game variables
Use Condition Groups
All use conditions are organized into separate “use condition groups”. The notetag that you see above describes a single condition group. You can have multiple condition groups by simply defining multiple notetags.
A skill is said to be “usable” if at least one condition group is satisfied. A condition group is satisfied only if all conditions within the group are satisfied. That is, they evaluate to true. Therefore, if you have multiple condition groups, you are only required to satisfy one group in order to use the skill. See the example to understand how condition groups are used.
Suppose you have a Fire Slash skill that can be used under two different conditions as follows
- Have the “fire enchant” state (state 7), and equip a sword type weapon (wtype 2), OR
- Equip the “Fire Dragon Sword” (weapon 21)
To accomplish this, you will define two use condition groups by notetagging
your skill with
<use conditions> state: 7 wtype: 2 </use conditions> <use conditions> weapon: 21 </use conditions>
The following condition types are available
desc: requires the weapon to be equipped
desc: requires the armor to be equipped
desc: requires the weapon type to be equipped
desc: requires the armor type to be equipped
desc: requires the user to be a specific actor
desc: requires the actor to have the given class
desc: requires the state to be currently applied to the actor
desc: requires the actor to have learned the specified skill
value: ruby formula
desc: requires the formula to evaluate to true