Pharonix Equipment Restrictions

[SIZE=10.5pt]Introduction[/SIZE]

[SIZE=10.5pt] [/SIZE]

[SIZE=10.5pt]Hey all, Pharonix here.[/SIZE]

[SIZE=10.5pt] [/SIZE]

[SIZE=10.5pt] [/SIZE]

[SIZE=10.5pt]Plugin Name:  [/SIZE][SIZE=10.5pt]Equip Restrictions[/SIZE]

[SIZE=10.5pt]Version[/SIZE][SIZE=10.5pt]: 1.2[/SIZE]

[SIZE=10.5pt]Author:[/SIZE][SIZE=10.5pt] Soul Pharonix[/SIZE]

[SIZE=10.5pt]Category:[/SIZE][SIZE=10.5pt] Equipment[/SIZE]

[SIZE=10.5pt]Sub-Category:[/SIZE]

[SIZE=10.5pt] [/SIZE]

[SIZE=10.5pt]Download Link: [/SIZE][SIZE=10.5pt]You can download this plugin here[/SIZE]

[SIZE=10.5pt] [/SIZE]

[SIZE=10.5pt]Under Development:[/SIZE]

[SIZE=10.5pt]This script is still under development[/SIZE]

[SIZE=10.5pt] [/SIZE]

[SIZE=10.5pt]Notes:[/SIZE]

[SIZE=10.5pt]This plugin will allow you to set a required level for armor and weapons. This will prevent the equipping of armors and weapons unless the actor's level meets the required level[/SIZE]

[SIZE=10.5pt]You can also set a required switch for equipping of weapons and armors. This will prevent the equipping of these equipment types unless the switch's state is "ON"[/SIZE]

[SIZE=10.5pt]You can also set Required Variables, which will prevent the equipping of an armor or weapon unless the variable's value is equal to or greater than the value specified[/SIZE]

[SIZE=10.5pt]You may also specify a required actor, which will allow you to only allow the specified actor to equip a weapon or armor. This is useful if you have multiple users of the same class, but you only want a specific character to use it.[/SIZE]

[SIZE=10.5pt] [/SIZE]

[SIZE=10.5pt]**********NOTE TAGS[/SIZE]

[SIZE=10.5pt]<req_level:x>[/SIZE]

[SIZE=10.5pt]This will allow you to restrict a weapon or armor to be equipped only by characters whose level is greater than or equal to x[/SIZE]

[SIZE=10.5pt]<req_switch:x>[/SIZE]

[SIZE=10.5pt]This will allow you to restrict a weapon or armor to be equipped only when switch x is in the "ON" position.[/SIZE]

[SIZE=10.5pt]<req_switch:x,y,z>[/SIZE]

[SIZE=10.5pt]This will allow you to restrict a weapon or armor to be equipped only when switches x, y and z are all in the "ON" position. [/SIZE]

[SIZE=10.5pt]<req_var:x,y>[/SIZE]

[SIZE=10.5pt]This will allow you to restrict a weapon or armor to be equipped only when the variable x has a value equal to or greater than y.[/SIZE]

[SIZE=10.5pt]<req_var:x,y;a,b;c,d>[/SIZE]

[SIZE=10.5pt]You may specify multiple variable requirements by separating each variable,value pair with a semicolon( 😉 . This will allow you to restrict a [/SIZE]

weapon or armor to be equipped only when each variable (x,y,z) has a value equal to or greater than their respective values.

[SIZE=10.5pt]<req_actors:x> [/SIZE]

[SIZE=10.5pt]This will allow you to restrict the equipping of a weapon or armor to the actor whose id is equal to x.[/SIZE]

[SIZE=10.5pt]<req_actors:x,y> [/SIZE]

[SIZE=10.5pt]This will allow you to restrict the equipping of a weapon or armor to only the actors whose ids are equal to x or y.[/SIZE]

[SIZE=10.5pt] [/SIZE]

[SIZE=10.5pt]**********Terms of Use[/SIZE]

[SIZE=10.5pt]This Script is free to use non-commercially, or commercially.[/SIZE]

[SIZE=10.5pt]If using commercially, please credit me[/SIZE]
Marvelous! I need this for my project!

Thanks!
Can you make this require a variable to be at a certain number as well? Like you may only equip a Scimitar if variable "Sword Skill" is at 25 or higher? Awesome plugin 😀
I most likely will be using this, thanks for your contribution.
Not sure if you had this in mind already, but this script would be perfect if you added notetags for stats (Attack, Defense, etc) as well!
Can you make this require a variable to be at a certain number as well? Like you may only equip a Scimitar if variable "Sword Skill" is at 25 or higher? Awesome plugin 😀
This shouldn't be too difficult.

I don't actually know how to do something like <var_req:x,y> yet, but I can probably make something along the lines of:

<var_req:xx> required variable

<var_req_lv:yy> required value for the variable above

-Unfortunately this would prevent something like:

<var_req:5,50> which would require variable 5 to have a value of 50.

--But I'll see what I can do. It might take a little time, but I'm sure I can get that working sometime this weekend.

--If I manage to get the support for variables working, I'll probably go a step further and add support for switches.

Not sure if you had this in mind already, but this script would be perfect if you added notetags for stats (Attack, Defense, etc) as well!
Do you mean like:

<attack:+500> which adds 500 attack to the actor if equipped?

or

<req_attack:500> Which requires the actor to have 500+ attack in order to equip?

I do plan on adding support for skills, items, accessories, and consumables.

If you create a skill tome called "Ice Wave" but Ice Wave is a lv 33 skill,

It would only be usable on actors that are lv 33 or higher.

For the Skills, if you are one of many users who are using limit break scripts (like allowing characters to level past 99)

Then adding support for skills to have required levels should help y'all out.
Definitely keeping an eye on this. Will use for sure when items have level support, as I'm gonna want it for skill books.
<req_attack:500> Which requires the actor to have 500+ attack in order to equip?
This one. Kind of similar to how Runescape's equipment prerequisites are, in a way.
Script has been updated.  Please follow the v1.01 link under the 10/31 update.

Or follow THIS LINK

Support for variables has been added. These requirements are universal - meaning no character can equip it unless variable value is met.

Coming Soon:

Switch Support

Actor Parameter Support
I looked a bit into your code and I noticed that you're overwriting canEquipArmor() and canEquipWeapon().

It's not a good pratice at all. You need to "alias" them, like on RGSS3. ( No, in fact you must 😛 )
I looked a bit into your code and I noticed that you're overwriting canEquipArmor() and canEquipWeapon().

It's not a good pratice at all. You need to "alias" them, like on RGSS3.
I'm afraid I'm not too familiar yet with aliasing the core functions

I did have a feeling that I'd get called out on this sooner or later  😛

If you wouldn't mind providing insight into aliasing, It'd me most appreciated, as I'm sure I'll need to do so going forward.
Something like this:

Code:
var oldInitialize_function = Window_Selectable.prototype.initialize;Window_Selectable.prototype.initialize = function(x, y, width, height) {    //-- Before    oldInitialize_function.call(this,x,y,width,height); //-- Call original function    //-- After};// Example 2var oldUpdate_function = Window_Selectable.prototype.update;Window_Selectable.prototype.update = function() {    //....    oldUpdate_function.call(this);   //....};
Please forgive my ignoreance, but were would I put <req_level:40> to have the restriction kick in (I have the plug-in activated)

Nevermind, I see that this isn't the MV forums lol
Any chance of getting plugin documentation integrated into the .js file itself, so I can see it via Plugin Manager?
Please forgive my ignoreance, but were would I put <req_level:40> to have the restriction kick in (I have the plug-in activated)

Nevermind, I see that this isn't the MV forums lol
In the Notes section of the armor or weapon

Any chance of getting plugin documentation integrated into the .js file itself, so I can see it via Plugin Manager?
Once I can figure out how exactly that works I will.

I am currently working on modifying the code to use Aliasing (as per Lecode's suggestion) as opposed to overriding the functions.

I'm busy with work during the weekdays, so evenings and weekends are my best times to work on this.
So I finally got the aliasing working

Spent a week trying to figure out that I was missing a () somewhere.

I should have some updates for you this weekend.

What you can probably expect:

Switch Support:

I'm thinking of adding <switch_req:x>  So if switch x is on, can equip

Stat Support

Thinking of either

<stat_req,stat:x> requires "stat" to be greater than or equal to x

or

<req_attack:x> requires attack to be greater than or equal to x

(not sure which one I'm going to do yet)

_______________________

In a much later update:

<req_actor:x> - Only actor x can equip

or possibly:

<req_actors:x,y,z> only actors x,y,z can equip

<req_armor:x> requires armor x to be equipped first

<req_state:x> requires actor to be in state x first

If anyone has any other suggestions, I'd be happy to hear them
Script has been updated:

Version 1.2:

Support for multiple Variable restrictions

Support for restricting equipment to an Actor, or multiple actors

Support for restricting equipment based on switches (multiple switch support added as well)

Coming soon to a plugin near you:

Skill Support (Will allow you to set restrictions on skills - including level, states, and equipped items)

State Support (Based on if a certain state is inflicted)

Equipment support (Based on whether certain pieces of equipment are equipped first).

Original thread: https://forums.rpgmakerweb.com/threads/pharonix-equipment-restrictions.48482/