Need help editing a plugin

coolperez8

Veteran
Veteran
Joined
Mar 23, 2016
Messages
159
Reaction score
12
First Language
English
Primarily Uses
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;
		}
	);
};
 

sagebrushfire

Villager
Member
Joined
Jun 12, 2016
Messages
25
Reaction score
12
First Language
English
Primarily Uses
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. 
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,848
First Language
English
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.
 

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

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,035
Messages
1,018,454
Members
137,821
Latest member
Capterson
Top