Simple Skill Check

forteller

Veteran
Veteran
Joined
Dec 2, 2013
Messages
105
Reaction score
19
First Language
English
Primarily Uses
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
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]

 
 
Last edited by a moderator:

forteller

Veteran
Veteran
Joined
Dec 2, 2013
Messages
105
Reaction score
19
First Language
English
Primarily Uses
Plugin now saves the actor who passed the skill checks name. looking for more ideas to expand this plugin as its only my second one and id like some practice
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Stream will be live shortly! Going to do another art stream tonight so that I can finish my Fauna Focus piece~ Feel free to drop by!
Humans are fallible creatures, we all know that. It's when we're forced to look at ourselves that we start to disagree. :p
Expectation: Working on boss battle.
Reality: "Look at how awful are these code and database organization. Let me clean this mess", *yet, casually adding more modules that I have no idea if I would use it later*
Trying to learn to read Japanese so I read my manga. I like to buy them without all the edits made during translation.
The only thing getting me through today so far is coffee. And lots of it.

Forum statistics

Threads
97,852
Messages
947,384
Members
129,079
Latest member
DerLaPux
Top