Script command to get the name of an enemy troop?

Status
Not open for further replies.

ACECORP

Founder & Entrepreneur
Veteran
Joined
Apr 6, 2016
Messages
257
Reaction score
40
First Language
English
Primarily Uses
RMMV
Is there a script command that I can use to get the name of an enemy troop outside of battle processing mode and put it in a variable?

For example, I have an enemy troop named Lunar Party that sits at enemy troop slot 0061.

It contains 3 members but I don't care about the names of the members.

I want the name of the troop, because I want to stick it in a variable.

I tried a bunch of stuff with $gameTroop.members()[61] but that doesn't work.

If I try $gameTroop.members()[61].name I get an error

Any help with this would be greatly appreciated.
 

shockra

Bored Code Guy
Veteran
Joined
Feb 16, 2016
Messages
472
Reaction score
220
First Language
English
Primarily Uses
RMMZ
Outside battle, you'll likely need the data; $gameTroop refers to a troop currently in battle. Try this:

$dataTroops[61].name

I'm half guessing, but it could work.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,640
Reaction score
15,726
First Language
English
Primarily Uses
RMMV
In a battle, you should be able to use $gameTroop.troop().name to get the name for the current troop.
Outside battle, it'll be as above.

$gameTroop.members() is looking at the individual members, which is what you said you didn't want.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,510
Reaction score
12,012
First Language
English
Primarily Uses
RMVXA
To avoid the confusion of people answering in 2 places, I am going to close this thread as it is a continuation of your other thread.
 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

Hi everyone! Enjoying this nice long weekend. How are you all doing? :)
I just successfully tested having events check if specific actors are in a particular party slot and then changing image to match. This will let me make scenes take into account who is in the party at the time and arrange them accordingly - this is important since I'll have extra actors beyond current party. The script used is the same from MV and is compatible with my current core plugin setup in MZ. Thank goodness.
That awkward moment when you're talking about thinking about writing a limited shop stock plugin for MZ and then find out you already wrote one...last May. My memory is so bad.
When I open my project and I'm like, hell yeah.
Some drawings I made in Lapis, one day I intend to involve them in some RPG Maker project.
* maybe two wall frames
*or some sprite flower tiara, or maybe it inspires someone to do something.
bdd19b62e539d17b3b00cc3d63034f7d.jpg

fcca5c8471b34483da8e032cfe579275.jpg

Forum statistics

Threads
118,426
Messages
1,115,869
Members
155,380
Latest member
Jairowind
Top