Switch Primary Actor – An elegant way !

AbhijitK

Warper
Member
Joined
Aug 30, 2017
Messages
3
Reaction score
3
First Language
English
Primarily Uses
RMMV
Switching Actors – An elegant way !

This is a short tutorial for an elegant way to switch from one primary actor to another in games with multiple playable characters.

Requirements: RPGMaker MV, basic mapping and eventing skills

Aim:
In this example, we have a game with three actors Adam, Bob and Cara (A,B & C). You start off as Adam. Whenever you meet Bob, you should be able to make Adam wait there and continue the game with playing character as Bob (Same for Cara).You should be able to change your character any number of times, even if you visit other maps in between changes.


Steps:

We start with a simple test map.
We need to Create two NPC Events called BODY1 and BODY2 to "hold" the two secondary actors. (Ignore sprites for time being)


Create the following Variables:
WhoAmI (the primary playing actor)
BODY1_Actor (actor inside BODY1 event)
BODY2_Actor (actor inside BODY2 event)

Event BODY1
Start with event BODY1. Open the event editor and create two new event pages


Enter the following details [IMPORTANT: FINE DETAILS]

All Event pages
Priority: Same as character Trigger: Player touch

Event page 1
Conditions: Variable: BODY1_Actor ≥ 1 Image: Actor 1 (Adam)
Code:
◆ Change Party Member:Add Adam
◆ Change Party Member:Remove Bob
◆ Change Party Member:Remove Cara

◆ Control Variables:#0003 Body1_Actor = WhoAmI
◆ Control Variables:#0001 WhoAmI = 1
Event page 2
Conditions: Variable: BODY1_Actor ≥ 2 Image: Actor 2 (Bob)
Code:
◆ Change Party Member:Remove Adam
◆ Change Party Member:Add Bob
◆ Change Party Member:Remove Cara

◆ Control Variables:#0003 Body1_Actor = WhoAmI
◆ Control Variables:#0001 WhoAmI = 2
Event page 3
Conditions: Variable: BODY1_Actor ≥ 3 Image: Actor 3 (Cara)
Code:
◆ Change Party Member:Remove Adam
◆ Change Party Member:Remove Bob
◆ Change Party Member:Add Cara


◆ Control Variables:#0003 Body1_Actor = WhoAmI
◆ Control Variables:#0001 WhoAmI = 3
Event BODY1 is now complete !

Number of event pages depend on the total number of actors including player character. Each page decides what to do when the playing character wants to change into the actor that this event presently holds. The image on each event page shows what BODY1 must look like depending on the actor it is supposed to be.

The code consists of two parts (1) Change player character (2) Change NPC event BODY1
To change player character, we simply use the Change Party Member
To change the NPC to look like player character, we simply alter BODY1_Actor variable.
Finally change WhoAmI to keep track of who's the new player character

Event BODY2
Copy-paste event BODY1 to adjacent square and name it BODY2 in the event editor
Edit each event page to change "BODY1_Actor" to "BODY2_Actor"
Total six changes need to be made in our example, three in conditions and three in code
Leave everything else alone.
Event BODY2 is now complete !

INITIALIZE VARIABLES AND START THE GAME
I prefer to set initial settings in a separate map. Create a small map called INITIALIZE (No one will see this map)
Set Starting Position --> Player anywhere in this map
Setup an event with trigger set to autorun (it will run once, you will never visit this map again)
Enter the following code:
Code:
◆Comment:----- INITIALIZE VARIABLES   -----
:       :WhoAmI is active player
:       :Body1_Actor is initial appearance of Body 1
:       :Body2_Actor is initial appearance of Body 2
◆Control Variables:#0001 WhoAmI = 1
◆Control Variables:#0003 Body1_Actor = 2
◆Control Variables:#0004 Body2_Actor = 3
◆Change Party Member:Remove Cara
◆Change Party Member:Remove Bob
◆Transfer Player:TEST (5,4)
Done ! Your game is ready to test !:):thumbsup-left:

ADD SOME DRAMA !
Add an animation before the player change. Make both of them turn away from each other afterwards.
Example code for Event Page 1 of BODY1:
Code:
  ◆Show Animation:Player, Ball of Light (Wait)
    Change Party Member:Add Adam
    Change Party Member:Remove Bob
    Change Party Member:Remove Cara
  ◆Set Movement Route:This Event (Wait)
  :                  :◇Turn 180°
  ◆Set Movement Route:Player (Wait)
  :                  :◇Turn 180°
    Control Variables:#0003 Body1_Actor = WhoAmI
    Control Variables:#0001 WhoAmI = 1
You have to edit every event page of both BODY1 and BODY 2 as shown above

OFFER A CHOICE WHETHER TO CHANGE PLAYER
Place the entire code into a conditional statement to give the player a choice whether or not to change player character
You have to edit every event page of both BODY1 and BODY 2

EVENT PAGE SCREENSHOTS FOR BODY1



DIALOGUE OPTION
Place the entire code into a conditional statement to give the player a choice whether to Talk to NPC or Change player
Trigger a common event for dialogue
Use conditional statements in the common event to carry out dialogue based on value of [WhoAmI] and [BODY1_Actor] or [BODY2_Actor]
Also change Autonomous Movement to Random with low frequency to make NPCs move and give them more authenticity
You have to edit every event page of both BODY1 and BODY 2
 
Last edited:

falken14

Veteran
Veteran
Joined
Dec 6, 2016
Messages
56
Reaction score
21
First Language
English
Primarily Uses
This is an excellent tutorial on just the thing I was looking to do. Thanks!
 

AbhijitK

Warper
Member
Joined
Aug 30, 2017
Messages
3
Reaction score
3
First Language
English
Primarily Uses
RMMV
This is an excellent tutorial on just the thing I was looking to do.
Thanks for reading. Glad it helped you!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Are we allowed to post about non-RPG Maker games. and, if so, would any of you be interested in a short, proof of concept type non-euclidian puzzle game?
I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:

Forum statistics

Threads
105,883
Messages
1,017,232
Members
137,607
Latest member
Maddo
Top