Weapon & Armor Check calls

Fugama

Means well, but messes up sometimes.
Veteran
Joined
Jun 7, 2014
Messages
158
Reaction score
90
First Language
Fake English
Primarily Uses
RMMV
This is Fugama's Weapon and Armors calls plugin 1.0!


 This is my first plugin and as such, it's very basic. But I think it'll get some use. I've noticed a lot of people around here lately want to be able to easily check for things such as armors and weapons. With this plugin it'll be just a bit easier to check for those things. This doesn't do too much for the average consumer since it simply adds some more javascripts calls, but it goes well with for people who are trying out Yanfly's Lunatic Mode! Feel free to use this for anything you want! and please let me know if something isn't working properly


features: Four Javscript calls to check for the existence of weapons and armor (be it specific or just the existence of)


How to use: I haven't seen the location on the plugin list matter yet, so just put it into your games "Base/js/plugins" folder, and add it in rpgmaker's plugin manager! you can use the commands "hasWep()", "hasArmor()", "isEquippedWep(Weapon Id Here)", and "isEquippedArmor(Armor Id Here)". The first two check to see if the user has a weapon or armor equipped (respectively). The last two let you check for specific weapons or armors based on the Id you place in the parentheses. 


The plugin: you can download it HERE! or copy this and paste it into a .js file.


/*:
*
*@plugindesc Some new checks you can access!
*
*@author Fugama
*
*@help
*
* With these new identifiers you can customize
*Yanfly's lunatic mode just a little bit easier,
*or just have an easier time calling these checks for any other
*JS scripting you may be doing.
*
*
*The first command is "isEquippedWep()" it can be used like this
*"user.isEquippedWep(x)" where x is the weapon id You want to check!
*
*The second is "hasWep()". This checks if the Actor was any weapon at all
*(compatable with Dual Wielding) example:
*"user.hasWep()" this needs no paramaters for the parentheses.
*
*The third is "isEquippedArmor()" This checks for a specific Armor equip. example:
*"user.isEquippedArmor(x)" where x is the ID of the armor.
*
*Following the pattern, the fourth is "hasArmor()" This goes through and checks if the actor has any armor equipped!
*
*example: "user.hasArmor()"
*
*I hope you find some use from these ease-of-access addtions!
*/
(function(){


//Actor Checks
Game_Actor.prototype.isEquippedWep = function(WepID) {
var wep = $dataWeapons[WepID];
if (this.isActor() && this.equips().contains(wep)){
return true;
} else {
return false;
}
};


Game_Actor.prototype.hasWep = function() {

var equipList = this._equips;
var wepCount = 0;
for (i = 0; i < equipList.length; i++){
var itemCheck = equipList;
if (itemCheck._dataClass === "weapon"){
wepCount =+ 1;
}
}
if (wepCount != 0){
return true;
} else {
return false;
}
};

Game_Actor.prototype.isEquippedArmor = function(ArmID) {
var armor = $dataArmors[ArmID];
if (this.isActor() && this.equips().contains(armor)){
return true;
} else {
return false;
}
};


Game_Actor.prototype.hasArmor = function() {
var equipList = this._equips;
var ArmCount = 0;
for (i = 0; i < equipList.length; i++){
var itemCheck = equipList;
if (itemCheck._dataClass === "armor"){
ArmCount =+ 1;
}
}
if (ArmCount != 0){
return true;
} else {
return false;
}
};


//prevent crashes from enemy battlers using the same abilities
Game_BattlerBase.prototype.isEquippedWep = function(WepID) {
return false;
};


Game_BattlerBase.prototype.hasWep = function(WepID) {
return false;
};

Game_BattlerBase.prototype.hasArmor = function(WepID) {
return false;
};

Game_BattlerBase.prototype.isEquippedArmor = function(WepID) {
return false;
};



})();


credits: Myself for making the plugin


Yanfly for his tips and tricks videos making JS easier to understand


and SumRndmDde for his making a plugin series!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

40 card deck size, the plugin seems more sluggish.
Village theme I composed for a commission!
Stream will be live shortly with some Haunting Ground! Feel free to drop by!
welp, the stock market went down by 7% because of corona today. Time to buy stocks?

Forum statistics

Threads
94,563
Messages
921,921
Members
124,429
Latest member
sheepman
Top