I need help finding a way to make a system for my game that allows the player to change classes using Q and W. It would be easy with common events and plugins but I need it to cycle through a set of 4 classes. I cant find this anywhere on the internet.
Class change on the fly system.
RPG Maker MV SupportIf you want to do it purely through eventing:
One thing you could do that would be similar to the above, but get rid of a lot of the monotonous addition of each possible class in that last else block, is use a script call:
Here's an example of the event only with no script:
Somewhere in your game's initialization, create two variables. Let's say currentClassId and changedClassId.
Then create a common event with:
Conditional branch: [Pageup] is pressed down (by default, Q is the pageup button)
Control Variables: changedClassId subtract 1
Conditional branch: changedClassId < 1
Control Variables: changedClassId = 4 (whatever the last class Id is)
End
Else
Conditional Branch: [Pagedown] is pressed down (by default, W)
Control Variables: changedClassId add 1
Conditional Branch: changedClassId > 4 (whatever the last class Id is)
Control Variables: changedClassId = 1
End
End
End
Conditional Branch: currentClassId = changedClassId
// Leave this part blank, we want the else part of this conditional
Else
Control Variables: currentClassId = changedClassId
Conditional branch: changedClassId = 1
Change class: Actor 1, Class 1, check Save Level
End
Conditional branch: changedClassId = 2
Change class: Actor 1, Class 2, check Save Level
End
// Repeat for each class
End
Wait: 5 frames
Then, have a parallel process event on each map that calls this common event. It'll check, every 5 frames, if either the Q or W button is pressed. If Q is pressed, it changes your changedClassId variable by -1. If W is pressed, it's +1. If Q is pressed and it causes the variable to become less than 1, then it changes the variable to the last class Id (looping back around to the end). If W is pressed and it causes the variable to become greater than whatever the last class Id is you want to check, it changes the variable to 1 (looping back around to the beginning).
Then, if currentClassId and changedClassId are not the same value, you know the player must've pressed Q or W to change it. So you set currentClassId to equal changedClassId, so the logic won't continue to fire, then check what the changedClassId is and set the actor's class accordingly.
Unfortunately, the "Change Class" command doesn't allow for dynamic assignment of class, so you'll have to make a new Conditional branch for each possible value.
Then create a common event with:
Conditional branch: [Pageup] is pressed down (by default, Q is the pageup button)
Control Variables: changedClassId subtract 1
Conditional branch: changedClassId < 1
Control Variables: changedClassId = 4 (whatever the last class Id is)
End
Else
Conditional Branch: [Pagedown] is pressed down (by default, W)
Control Variables: changedClassId add 1
Conditional Branch: changedClassId > 4 (whatever the last class Id is)
Control Variables: changedClassId = 1
End
End
End
Conditional Branch: currentClassId = changedClassId
// Leave this part blank, we want the else part of this conditional
Else
Control Variables: currentClassId = changedClassId
Conditional branch: changedClassId = 1
Change class: Actor 1, Class 1, check Save Level
End
Conditional branch: changedClassId = 2
Change class: Actor 1, Class 2, check Save Level
End
// Repeat for each class
End
Wait: 5 frames
Then, have a parallel process event on each map that calls this common event. It'll check, every 5 frames, if either the Q or W button is pressed. If Q is pressed, it changes your changedClassId variable by -1. If W is pressed, it's +1. If Q is pressed and it causes the variable to become less than 1, then it changes the variable to the last class Id (looping back around to the end). If W is pressed and it causes the variable to become greater than whatever the last class Id is you want to check, it changes the variable to 1 (looping back around to the beginning).
Then, if currentClassId and changedClassId are not the same value, you know the player must've pressed Q or W to change it. So you set currentClassId to equal changedClassId, so the logic won't continue to fire, then check what the changedClassId is and set the actor's class accordingly.
Unfortunately, the "Change Class" command doesn't allow for dynamic assignment of class, so you'll have to make a new Conditional branch for each possible value.
One thing you could do that would be similar to the above, but get rid of a lot of the monotonous addition of each possible class in that last else block, is use a script call:
Instead of a Conditional branch for every possible class Id, do:
Where 2 is the variable for your changedClassId variable. If you want experience to reset, change true to false.
Code:
Script: $gameParty.members()[0].changeClass($gameVariables.value(2), true);
Here's an example of the event only with no script:
In the no eventing no script i dont get how you would set classes.
What do you mean? There is no "no eventing" option. If you mean the bottom image that's labeled "Event only, no script," it's right at the bottom of the event, there are two change class event commands. When you're entering the change class event command, you choose from a drop-down box which class it's changing into.
I ment only event no script
Original thread: https://forums.rpgmakerweb.com/threads/class-change-on-the-fly-system.140248/