Script call for checking which character is being selected?

Pearsona

Trash Goblin
Veteran
Joined
Nov 12, 2013
Messages
101
Reaction score
52
First Language
English
Primarily Uses
RMMV
Hiya! I'm currently making a new HUD for battles (and later menus as well) using SRD's supertools, and I need a way to check which actor is being selected for their turn so I can add an indicator so the player can tell who's turn it is.

My current idea is to have an arrow animation above every party slot and a 'condition' checking who is being selected and triggering the arrow to appear.

But, well, I can't figure out what script call to put in the 'conditions'. I think it might be "BattleManager.actor()", but I can't figure out how exactly to set that up or if that's even right. What script corresponds to checking whether it's a character's turn or not?

(Putting this here instead of plugin support because technically the part I'm confused about is part of the base MV engine, it's just that the context of the supertools may help you all understand the issue better)
 

Pearsona

Trash Goblin
Veteran
Joined
Nov 12, 2013
Messages
101
Reaction score
52
First Language
English
Primarily Uses
RMMV
Additional info since I found some solutions that don't quite work for me: My game will have a party that (aside from the main character) can be altered at the player's will. I found a solution but it only works for specific actor IDs, while I'd like to access characters currently in the active party based on their actor order.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,978
Reaction score
2,302
First Language
EN
Primarily Uses
RMMZ
Maybe something like:
  • BattleManager.actor().index() === 0
I.e. "is the index of the currently-inputting actor equal to 0?" The party leader is index 0, the next member is index 1, etc.

[Edit: see follow-up post.]
 
Last edited:

Pearsona

Trash Goblin
Veteran
Joined
Nov 12, 2013
Messages
101
Reaction score
52
First Language
English
Primarily Uses
RMMV
Maybe something like:
  • BattleManager.actor().index() === 0
I.e. "is the index of the currently-inputting actor equal to 0?" The party leader is index 0, the next member is index 1, etc.
Well... weirdly enough, despite the fact that it seems to work, I keep getting error messages like 'there's an error with "BattleManager.actor().index() === 0", press f8 to see more!' but then the battle continues as normal, functioning roughly how I want it to, but error messages pop up every time I start or end a turn.

Wait, I disabled Yanfly's Battle Engine Core and now the errors have stopped but... I need that plugin for other things D: Does anyone know how to sort out this compatibility issue?
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,978
Reaction score
2,302
First Language
EN
Primarily Uses
RMMZ
Oh, whoops. :kaoswt2:

I'm guessing the error occurs when there is no actor inputting. Try this instead?
  • BattleManager.actor() ? BattleManager.actor().index() === 0 : false
I.e. "if there is an actor inputting, return true iff their index equals 0; else return false".
 

Pearsona

Trash Goblin
Veteran
Joined
Nov 12, 2013
Messages
101
Reaction score
52
First Language
English
Primarily Uses
RMMV
Oh, whoops. :kaoswt2:

I'm guessing the error occurs when there is no actor inputting. Try this instead?
  • BattleManager.actor() ? BattleManager.actor().index() === 0 : false
I.e. "if there is an actor inputting, return true iff their index equals 0; else return false".
IT WORKS!!! Thank you so much!!!

If you wouldn't mind, could I ask how to do this with the status menu? Just because I know I'm gonna need to know soon enough and I wouldn't want to bother the forums more than necessary ^^'
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,978
Reaction score
2,302
First Language
EN
Primarily Uses
RMMZ
Yay! :kaojoy:
If you wouldn't mind, could I ask how to do this with the status menu?
Without plugins, when selecting an actor as a target in battle, it shows a Window_BattleActor instance (looks like the battle status window, but behaves differently). I'm guessing that's the window you mean? If so, you could try a condition like this:
  • SceneManager._scene._actorWindow ? SceneManager._scene._actorWindow.index() === 0 : false
Looks like this might also work on the item scene (pause menu -> inventory) since the target window is given the same identifier there.
 

Latest Threads

Latest Posts

Latest Profile Posts

Nightmare... Dreamt I posted a GFX resource post. With a work in progress glove icon that tinted to different colors. In the wrong forum. And I was in such a panic. I saw people writing posts in response, those "..." you see in discord and such. So I frantically tried to report my post as wrong forum, editing to say it's the wrong forum and that I "accidentally" posted it too early... Very odd dream to be honest...
The youngest photo of you is also the oldest photo of you.
People need to stop submitting their game to every single game jam without even reading the jam rules (╯°□°)╯︵ ┻━┻
Mom tested positive for COVID thanks to a single stupid coworker of hers not taking sh*t serious.
I'll prolly won't be on here for a while as we deal with this.
So before I inevitably start a new project to reorganize myself (I will make sure to save important info dw), I will make an external list of what I want in the final database.

Forum statistics

Threads
117,195
Messages
1,105,386
Members
153,332
Latest member
diorpancakes
Top