Calling an Actors Class via Variable

Xzalander

Villager
Member
Joined
May 30, 2014
Messages
7
Reaction score
3
First Language
English
Primarily Uses
Hi I apologise if this has been asked before, I have seen a couple of threads where they can call an actors class by using a combination of Conditional Branches and Control Variables, but I dont quite understand it and I dont think they fit my purpose.

To start explaining:

I have a Conditional Branch which leads into a choice of Martial, Caster, Hybrid and from there a sub choice in each of three classes.

For example Martial > Paladin, Barbarian, Fighter.
When [Fighter] as the example; the following are triggered;

@>Change Actor Class: [NAME], [Fighter]
@>Control Variables: [7:Class] = 1
@>Text: -,-, Dark, Bottom
: : There can be only one.
: : You are \N[1] the \v[7]

Now naturally this changes the active actor, to the fighter class (in my case this is 1st in the list), then sets Variable 7 to 1.
The text box correctly outputs as You are [NAME] the 1.

I am curious as to how I can get that 1 to be looked up against a list and output the correct class name. ie instead of outputting
You are [NAME] the 1, it out puts [NAME] the [Fighter].

I am trying to do this via variables as this is primarily a practice route for me to see how to convert variables into strings etc,
However doing it this way to me vs using a script to call on the actors class directly, means I can modify the variable for RNG purposes. (Was thinking I could have an NPC incorrectly call someone the wrong class by using the Variable 7 + Rand(5))

I hope this is clear enough to help me further?
 

A-Moonless-Night

WINTER IS COMING
Veteran
Joined
Mar 17, 2012
Messages
542
Reaction score
380
First Language
English
Primarily Uses
RMVXA
You could use a message script, like Yanfly's here or Modern Algebra's here, and then you can use the additional special message codes to write the name of class with ID x.

Alternatively, you can set an additional variable to the name of the class in a script call, like so:
Code:
$game_variables[8] = $data_classes[$game_variables[7]].name
Then it will appear when you use \v[8] in the message box.

EDIT: Or, if you don't want to worry about using lots of variables, you can just do:
Code:
$game_variables[8] = $data_classes[$game_actors[1].class_id].name
 

Xzalander

Villager
Member
Joined
May 30, 2014
Messages
7
Reaction score
3
First Language
English
Primarily Uses
That first scriptcall worked excellently thankyou!

So you can see how I used it in my 'test room';

@>Control Variables [0009:1d10] = Random No. (1...10)
@>Script: $game_variables[8] = $data_classes[$game_variables[9]].name
@>Text: -, -, Dark, Bottom

You are \N[1] the \v[8]
REAL Class No. is: \v[7]
Random No. is: \v[9]
Random Class is: \v[8]

@>Script: $game_variables[8] = $data_classes[$game_variables[7]].name
@>Exit Event Processing

Could you for see any potential issues doing it this way later?

Is it essential that I run the Script Call the second time with the correct name variable?
As I imagine without doing so, it will keep Variable 8 stored as what was given in Variable 9 earlier, even if the event ended?
 

A-Moonless-Night

WINTER IS COMING
Veteran
Joined
Mar 17, 2012
Messages
542
Reaction score
380
First Language
English
Primarily Uses
RMVXA
It depends on what you are using it for. You could use one variable to hold the correct class name and another to hold the random class name if you didn't want to accidentally mix them up.
 

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

Latest Threads

Latest Profile Posts

Look, I get that it's illegal, but...
It just happen we got P7 as booth number, so i draw Girls Frontline's P7 in this
Stream will be live shortly! Going to start with some Minecraft spriting, and might switch mid-stream. Depends~ Feel free to drop by!
MushroomCake28 wrote on Finnuval's profile.
Glad to see you're back! I was wondering what you've become! It's been a while since we spoke to each other!
zachb wrote on Human_Male's profile.
I know this was months ago, but I don't completely understand the lunatic states program (how you set it up). I just want to apply a stone state (and death) to a character after x amount of time. Can you show me an example of how to set it up?

Forum statistics

Threads
93,468
Messages
912,744
Members
123,004
Latest member
Lysenthe
Top