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!
本贴来自国际rpgmaker官方论坛作者:Fugama处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/weapon-armor-check-calls.70887/