How to add actor based on Varaibale?

Bruh99

Villager
Member
Joined
Jul 27, 2020
Messages
10
Reaction score
3
First Language
English
Primarily Uses
N/A
I think I will need script buy I'm not sure.
 
Last edited:

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,968
Reaction score
1,411
First Language
EN
Primarily Uses
RMMZ
You could use Conditional Branch commands, e.g.
Code:
◆Comment:Set variable value (for testing)
◆Control Variables:#0001 Actor ID = 1
◆Comment:Check variable value and add appropriate actor
◆If:Actor ID = 1
  ◆Change Party Member:Add Harold
  ◆
:Else
  ◆If:Actor ID = 2
    ◆Change Party Member:Add Therese
    ◆
  :Else
    ◆If:Actor ID = 3
      ◆Change Party Member:Add Marsha
      ◆
    :Else
      ◆Comment:etc
      ◆
    :End
    ◆
  :End
  ◆
:End

Or a single Script command:
JavaScript:
// Get actor ID = value of game variable 1
var id = $gameVariables.value(1);
// Add that actor to the party!
$gameParty.addActor(id);
Change the 1 to match the ID of your game variable.
 

Bruh99

Villager
Member
Joined
Jul 27, 2020
Messages
10
Reaction score
3
First Language
English
Primarily Uses
N/A
Thank you so much!It works perfectly!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I had lots of fun! Kids loved me, and some took pictures. Unfortunately, the videos didn't send... but you'll see Chica in action when I do a trailer for Fandom Scouts!
Dama wrote on akoniti's profile.
Hi
Thanks for your review.
I was checking the trailer for details and as the woman shut the door at the exact moment the song I was hearing said "you slim the door" and I couldn't resist to add it there. :D And I used this idea one more time on another scene.
Just doing some tileset tinkering again...
rux
Someone please help me make my game.
I need someone to volunteer, I am on my knees man.

Forum statistics

Threads
104,690
Messages
1,008,149
Members
136,183
Latest member
brandini503
Top