adiktuzmiko

JSItemMax.js

Dec 29th, 2016
504
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*:
  2.  
  3.  * @plugindesc Allows you to set the max number of each item/armor/weapon using numbers or JS codes. Click help for How To Use
  4.  YEP Shop Core compatibility fix by Maliki79
  5.  * @author Adiktuzmiko
  6.  
  7.  *@help To use just add this notetag to your items:
  8.  <maxItems:value>
  9.  value being any static number or a valid JS code
  10.  
  11.  Example:
  12.  
  13.  <maxItems:5> -> Sets that item to have a maximum amount of 5
  14.  <maxItems:$gameVariables.value(1)> -> Sets the item to have a maximum amount
  15.  equal to whatever the current value of Game Variable 001 is
  16.  
  17.  Note: It is important that the file name of this plugin is JSItemMax.js
  18.  
  19.  * @param General Item Max
  20.  * @desc The general maximum amount for each item; you can use either a number or a valid JS code here
  21.  * @default 99
  22.  
  23. */
  24.  
  25. var JSItemMax = {};
  26. JSItemMax.params = PluginManager.parameters('JSItemMax');
  27. JSItemMax.generalItemMax = JSItemMax.params["General Item Max"];
  28.  
  29. Game_Party.prototype.maxItems = function(item) {
  30.   if (!item) return 0; //Fix by Maliki79
  31.   if (item.meta.maxItems) {
  32.     return eval(item.meta.maxItems);
  33.   } else {
  34.       return eval(JSItemMax.generalItemMax);
  35.       }
  36.  
  37. };
Advertisement
Add Comment
Please, Sign In to add comment