So I'm using SumRndmDde's HudMaker plugin, and I am trying to figure out how to show a specific characters head icon depending on what slot of the party they are in. Actor 1 will always be in slot 1, so there is no need to ever change that, but the other 3 slots is where I am confused. I'm not sure how to make the condition be "if(partyslot2=actor3){show actor3 image}". I provided a rough concept on how I want it to look if it helps give a better idea.
SumRndmDde HudMaker: Party List/Current Turn Help
RPG Maker MV Supportyou mostly show image and set the condition to
"$gameActors.actor(ID).isBattleMember()" (change ID to the actorID database).
if you need need the formation order, it need to be different.
especially if you can move them around mid battle.
"$gameActors.actor(ID).isBattleMember()" (change ID to the actorID database).
if you need need the formation order, it need to be different.
especially if you can move them around mid battle.
How would I show the icons in their specified slot though? Say actor 3 is in slot 2, what would I use for the condition to show it's icon in slot 2?
use the different actorID.
if you can rotate formation on the map, it and want to alter that in battle
as well in that order (which I think you use a plugin for lock 1st actor)
always first that cannot be changed.
anotherway for that is to check party members using one of the following:
$gameParty.leader() - Party Leader
$gameParty.members()[0] - 1st Member or Leader
$gameParty.members()[1] - 2nd Member
$gameParty.members()[2] - 3rd member
$gameParty.members()[3] - 4th Membe
keep in mind, that the member MUST exist, and that this call:
$gameActors.actor(ID).isBattleMember() check if the member is inside battle.
or it would not draw (this should also set the HP/MP and name check.)
if it always has 4 members without anyone leave, the gameParty can do the trick.
if you can rotate formation on the map, it and want to alter that in battle
as well in that order (which I think you use a plugin for lock 1st actor)
always first that cannot be changed.
anotherway for that is to check party members using one of the following:
$gameParty.leader() - Party Leader
$gameParty.members()[0] - 1st Member or Leader
$gameParty.members()[1] - 2nd Member
$gameParty.members()[2] - 3rd member
$gameParty.members()[3] - 4th Membe
keep in mind, that the member MUST exist, and that this call:
$gameActors.actor(ID).isBattleMember() check if the member is inside battle.
or it would not draw (this should also set the HP/MP and name check.)
if it always has 4 members without anyone leave, the gameParty can do the trick.
I believe I got it to work! For the condition I put "$gameParty.members()[1] = $gameActors.actor(2).isBattleMember()" which checks if actor 2 is in position 2. I will run a few more tests to see if it is 100% correct just to be sure.
keep also in mind that 2 can be empty if actor is not presented, so you
need multiple checks.
but I hope you get it to work how you want it to be 🙂.
need multiple checks.
but I hope you get it to work how you want it to be 🙂.
So the condition does work! It only ever doesn't work the way I want it to through very specific actions which the normal player will never do. Now, I want to create some sort of turn indicator. I found "BattleManager.actor()", which should find the actor whose turn it is. I tried using "BattleManager.actor() = ($gameParty.members()[1] = $gameActors.actor(2).isBattleMember())"
, but I am assuming I am either using it incorrectly or I have incorrect syntax.
, but I am assuming I am either using it incorrectly or I have incorrect syntax.
I lied! "$gameParty.members()[n] = $gameActors.actor(n).isBattleMember()" only checks if the actor is in battle...
There is actually a lot of stuff wrong with your condition. = is an assignment, == is a comparison.
The next thing is that even when you use the correct syntax for comparison, your condition would still be wrong.
1.
This is comparing apples with pears.
I believe since an existing Game_Actor object counts as a truthy value in javascript this condition will always be true.
2.
This is again the same thing.
JavaScript:
let x = 0;
//always true, because the assignment x = 5 will not fail
// x is now no longer 0 but 5
if(x = 5){
//this coide will always be executed
}
//compares the value in x to 5
//will be true if x is 5 and false otherwise
if(x == 5){
//this code will only be executed if x is 5
}
The next thing is that even when you use the correct syntax for comparison, your condition would still be wrong.
1.
$gameParty.members()[1] == $gameActors.actor(2).isBattleMember()This is comparing apples with pears.
$gameParty.members()[1] returns the Game_Actor object of the actor who is in the second place in the formation. $gameActors.actor(2).isBattleMember() returns true if actor 2 is in the first 4 members of the party formation or false otherwise.I believe since an existing Game_Actor object counts as a truthy value in javascript this condition will always be true.
2.
BattleManager.actor() == (some other comparison)This is again the same thing.
BattleManager.actor() returns a Game_Actor object (or null if currently no actor is inputting their action). Any comparison will either return true or false. Since null is a falsey value and the first comparison is always true, this comparison will be true as long as any actor is currently inputting their action.So when I was using "=" I was telling the condition that [n] slot had to be a specific character? That would explain quite a bit. I have little to no javascript knowledge so a lot of stuff doesn't make complete sense. I would assume the condition "$gameParty.members()[1] === 4" would mean that the condition would check if the index is equal to 4?
No,
Since you are comparing some complex data structure to a simple number while explicitly telling javascript to respect data types during this comparison, the result will always be false.
$gameParty.members()[1] === 4 will compare a Game_Actor object to the number 4 while respecting data types (that is the difference between == and === : 5 == '5' will be true, while 5 === '5' will be false).Since you are comparing some complex data structure to a simple number while explicitly telling javascript to respect data types during this comparison, the result will always be false.
Also I don't really know what you are getting at here. The index of
$gameParty.members()[1] is 1 (meaning the second member as arrays start indexing at 0). $gameParty.members() is an array of all actors in the game party (or only of the first 4 if you are currently in battle) and by putting [1] behind it you are explicitly telling javascript to access the object at index 1 in this array. There is no need to check which index this object has. And checking if the index of that object is also 4 is downright nonsense if you don't have some kind of plugin that allows you to have the same actor at multiple positions in the party. Unless you mean something else by "index" in which case please do explain further what you mean.Sorry if my use of terms is awful. By index I meant the actor the command gave. I was trying to find a condition that would show an image if the 2nd party slot had the 4th actor in the database in that slot.
Ah, so by "index" you meant the actor's ID? That is easy. Game_Actor objects have a function to access their ID (you can check all their functions and properties here: https://kinoar.github.io/rmmv-doc-web/classes/game_actor.html )
Try the following:
Try the following:
JavaScript:
$gameParty.members()[1].actorId() === 4
That worked! I tried changing the 1 to a 2 to see if it would work as well despite Actor 4 being in Slot 2 and got an error. I'm assuming since the actor isn't in the specified slot it produces an error?
No, you shouldn't get an error. it should simply return false if your third party member is any other actor than the one with ID 4.
However if you have no actor in your third slot this will indeed produce an error because we can't call a function of an undefined object. This was what @ShadowDragon was going on about in their post here:
However we can simply expand our current check to first check if there actually is any actor in the slot we are looking at and only then check their ID like this:
&& is the logical AND-operator, connecting two sub-statements which must both be true for the whole statement to be true. As explained above, if the party member at that index exists it will count as a truthy value and the whole statement will be evaluated. However if they don't exist it will count as a falsey value. And since that means the whole statement can no longer be true, but must be false the rest of the statement does not get evaluated and does not produce an error.
However if you have no actor in your third slot this will indeed produce an error because we can't call a function of an undefined object. This was what @ShadowDragon was going on about in their post here:
However we can simply expand our current check to first check if there actually is any actor in the slot we are looking at and only then check their ID like this:
JavaScript:
$gameParty.members()[1] && $gameParty.members()[1].actorId() === 4
That seemed to fix it! Now all I need to do is properly create a turn indicator. I found one on an older post, but with Yanfly's Battle System plugin it doesn't work 100% right. "BattleManager.actor() && BattleManager.actor().actorId() === 1" does what I want it to do, it shows a new image when it's that actor's turn, but since the Yanfly Battle System I use isn't the default, the new image stays until the next actor's turn.
Edit: I also now realize that this wouldn't apply the new slots either.
Edit 2: Using the "&&" I managed to combine both conditions so now it does exactly what I want it to EXCEPT for the part where the new image still stays until the next actors turn.
Edit: I also now realize that this wouldn't apply the new slots either.
Edit 2: Using the "&&" I managed to combine both conditions so now it does exactly what I want it to EXCEPT for the part where the new image still stays until the next actors turn.
Can you please provide a link to which of Yanfly's "Battle System" plugins you are actually talking about? Maybe then I can take a quick look and see what the problem is.
Here's the link:
www.yanfly.moe
And I also attached a screenshot of my battle system and other possibly helpful info.
Battle Engine Core (YEP) - Yanfly.moe Wiki
I might have found a temporary solution, and that is to just put a State on the actor when their turn starts, and remove it when they perform their action.
Ok, so from a quick glance the CTB system indeed indirectly modifies how
BattleManager.actor() works and it seems to me that the battle system actually needs it to be that way. So changing that does not seem to be an option. I think your solution with the invisible state is probably the best we can get.Original thread: https://forums.rpgmakerweb.com/threads/sumrndmdde-hudmaker-party-list-current-turn-help.151068/