Code:
SkillCheck v1.30 Dark Confidant *You can now also save the name of the actor the did the skill check for you. [SIZE=26px]Introduction[/SIZE] A Simple Plugin to Check a certain stat among actors and set the largest of them to a variable. it can be used for so many cool things like to see if a player can sneak pass a guard or to see if i player can find extra loot in a chest or find a hidden room. [SIZE=26px]Features[/SIZE] Find out who has the highest of each stat in your party Current Supported Stats (ATK, DEF, MDF, AGI, LUK. MAT) Save the largest Value as a variable of your choosing Add a Variance like -/+ 30% to add some random chance save the actor that did the skill check name as a variable. [SIZE=26px]How to Use[/SIZE] To use this Script you use a single Plugin Command Which is Chk_Stat, where stat can be atk, def, mat, mdf, agi, or luk. This will set the variable you have selected (Default 45) to the Highest value among your party to that Stat. Also if you wanna add some variance just add a number to the end of the command. ie Chk_atk 45 will give you the highest atk stat in your party +/- 45% and save it to the selected variable. [SIZE=28px]Demo[/SIZE] Dont think this needs one but i will put if it becomes needed Script 复制代码
Spoiler Code:
var params = PluginManager.parameters("SkillCheck"); /*: *@param Varsav *@desc The Variable to Save the Stat Check to *@default 45 * * *@param NameSav *@desc The Vaiable to save the name of the actor who attempted the skill check. *@default 46 */ var aliasPluginCommand = Game_Interpreter.prototype.pluginCommand; var Varsav = Number(params["Varsav"]|| 45); var NameSav = Number(params["NameSav"]|| 46); Game_Interpreter.prototype.pluginCommand = function(command, args){ aliasPluginCommand.call(this,command, args); var Size = $gameParty.members().length; var m =0; var x = 0; var name = null; if(command == "Chk_atk"){ while(x<Size){ if($gameParty.members()[x].atk>m){ m=$gameParty.members()[x].atk; name = $gameParty.members()[x].actorId(); } x++ } } if(command == "Chk_def"){ while(x<Size){ if($gameParty.members()[x].def>m){ m=$gameParty.members()[x].def; name = $gameParty.members()[x].actorId(); } x++ } } if(command == "Chk_mat"){ while(x<Size){ if($gameParty.members()[x].mat>m){ m=$gameParty.members()[x].mat; name = $gameParty.members()[x].actorId(); } x++ } } if(command == "Chk_mdf"){ while(x<Size){ if($gameParty.members()[x].mdf>m){ m=$gameParty.members()[x].mdf; name = $gameParty.members()[x].actorId(); } x++ } } if(command == "Chk_agi"){ while(x<Size){ if($gameParty.members()[x].agi>m){ m=$gameParty.members()[x].agi; name = $gameParty.members()[x].actorId(); } x++ }} if(command == "Chk_luk"){ while(x<Size){ if($gameParty.members()[x].luk>m){ m=$gameParty.members()[x].luk; name = $gameParty.members()[x].actorId(); } x++ }} if(args[0]>0){ var High = Math.floor((args[0]/100)*m); var Low = Math.floor((args[0]/100)*-m); m += Math.floor(Math.random()*((High)-(Low)+1)+(Low));} console.log(name) $gameVariables.setValue(Varsav, m); $gameVariables.setValue(NameSav, $gameActors.actor(name).name()); } 复制代码
Code:
[SIZE=28px]FAQ [/SIZE][SIZE=12px]Q: A am getting a cannot read the property of null error A: The plugin command is case sensitive please insure that the command read "Chk_stat" where stat is the 3 letter abbreviation for the stat in all lower case letters. [/SIZE] 复制代码
本贴来自国际rpgmaker官方论坛作者:forteller处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/simple-skill-check.68564/