Need help editing a plugin

So, I have this plugin, but I need to add a feature. I originally asked the author himself if he could make an edit for me, but he said he was busy and actually gave me permission to edit it myself and ask for help if needed. Here's the segment of the plugin I need to edit (It's my edited version, I don't know why I put "+ 0"):


Now, here's the thing.


What I want to do is define each actor a certain in-game variable. How this will be done is via note tags. For instance, I put <var = 22> in an actor's note tags, and it will use game variable 22 for that actor. When the plugin sets the animation index, it should check the value of the variable defined for each actor, before setting the character index. If the value of the variable is 0, or there is no variable defined for the actor, it sets the character index to the value of "vara". But if the value of the variable is something other then 0, it sets the character index to the value of "varb". The reason I put "varc" is because those should be set to either "vara" or "varb" depending on the value of the actor's defined variable.

Code:
Skurry.CA.setAnimIndex = function(ind) {
	vara = ind + 0;
	varb = ind + 4;
	$gamePlayer._characterIndex = varc;
	$gamePlayer.followers()._data.forEach(function(actor) {
			actor._characterIndex = varc;
		}
	);
};
If you want to add data with note tags to the actors it's very simple. By default the game will store simple tags in an object called "meta". The default code is pretty dumb, it's really only useful for tags like this: 


<variablename: value>
<variableThatIsTrueorFalse>




But example 1 should suffice. So you can just do this (I'll use ai for "animation index"): 


<ai:22>


And in JavaScript you can easily access this through the $dataActors object (not the $gameActors object). It's important to note that this is static data that is part of the $dataActors object because it comes from the actor's note property. That means this cannot be changed permanently in-game, it is not saved into the save file. It's intended for data that would not need to be changed and then saved to the save file later. For that you should probably just use the BOB_CustomStats.js plugin. 


var test = $gameActors[1].meta["ai"]; // Assuming our example note tag was for actor #1, this will return "22".

var testAsNumber = Number(test); // convert test into a Number instead of a String




So really you should have what you need very easily. 


I feel like I'm advertising or something because this is the second post where my plugin has become relevant but I actually wrote a plugin with some generic developer tools and one of the features does greatly extend the power of the meta object and note tags. It might make your life a little easyer. It extends the Game_Actor and Game_Enemy classes so that their note tag values are more easily available and it can process much more complicated note tags. 
I don't understand the request since you didn't provide any context beyond "this is what I want to do, how do I do it?" but presumably 


Skurry.CA.setAnimIndex = function(ind) {
vara = ind + 0;
varb = ind + 4;
$gamePlayer._characterIndex = varc;
$gamePlayer.followers()._data.forEach(function(follower) {
if ($gameVariables.value(follower.actor()._VARIABLE) == 0) {
follower._characterIndex = vara;
}
else {
follower._characterIndex = varb;
}
);
};


This checks the variable and determines what the index should be for each follower.


You will need to figure out how to access that particular variable for each actor, since I don't know what the name of the variable is.


You will also need to do this for the player, which is the leader of the party. You can access the leader's actor using 


$gameParty.leader()


Unless you're using a plugin that changes the actor associated with the leader.

Original thread: https://forums.rpgmakerweb.com/threads/need-help-editing-a-plugin.62196/