When starting out in RPG Maker, all of the options available to you can feel overwhelming. Instead of fancy plugins, custom code, or Rube Goldberg-esque Actor State contraptions, let's learn how to make a simple weight gain system using only Common Events and Game Variables. We will be taking advantage of a new feature in RPG Maker MZ; the new “Last” section in Game Data (specifically the Last Target Actor ID game data).
For every actor in your video game, you'll need to set aside variables that store their current weight. You can use any you wish but I like to keep mine grouped by function so mine are all right next to each other. You'll also want to make some different sprites for each actor so we can see their growth. Different sprites are technically optional; different weight stages could instead apply different effects to the actors.
Let's create our items. For this tutorial we will create two items, Apple, and Cheese. Set most of the effects and such as you like. But for this tutorial to work as designed, the food items must have a Scope: of “1 Ally”. No group feasts here.
To get the items to actually cause weight gain, we'll need to give them a Common Event effect. But we don't have any of those designed yet! After you have created your Apple item and Cheese item, press Apply (and possibly close the Database window and go save). Then in the Database, navigate to the Common Events section.
What are common events? Common Events are sequences of Event Commands that can be shared and reused between different items and events. To allow for different items granting more or less weight gain, we will create common events for all of our weight gaining items.
These events are simple so I will explain them in text only. The first command is Control Variables which we use to set a Variable for later use. The Apple Gaining Effect sets the “wg from item” variable to 5. The Cheese Gaining Effect sets the “wg from item” variable to 30.
The second command is Control Variables: actor to gain weight = Last Target Actor ID. Last Target Actor ID is accessible from the Game Data operand in Control Variables. By setting it here we could, in the future, make a skill or item that makes the user gain weight instead. Modularity is handy! Last Target Actor ID means “the last actor that was selected as a target of a skill or item.” So when you use a Cheese or an Apple on an actor, this Game Data will hold the actor ID of the character you selected to eat the Cheese or Apple.
The third command is Common Event. Yes its true, you can indeed run common event from anywhere even other common events. We will do most of the work in the WG Effect common event.
The WG Effect common event is where the magic happens. We'll use conditional branches to figure out which actor we need to target, add ‘wg from item’ to the character's weight variable to adjust their sprite or apply other effects.
View the common event's code below, then we'll summarize it line-by-line
◆If:actor to gain weight = 1
◆Comment:this is Reid's weight gain code.
◆Control Variables:#0012 Reid's weight += wg from item
◆If:Reid's weight > 50
◆Comment:chubby check; if weight is even higher, future checks will get them.
◆Change Actor Images:Reid, Actor1(0), Actor1_chubby(0), Actor1_1_chubby
◆
:Else
◆Comment:if we get here our weight is less than 50. normal.
◆Change Actor Images:Reid, Actor1(0), Actor1(0), Actor1_1
◆
:End
◆If:Reid's weight > 1000
◆Comment:fat check; if weight is even higher, future checks will get them.
◆Change Actor Images:Reid, Actor1(0), Actor1_fat(0), Actor1_1_fat
◆
:End
◆If:Reid's weight > 3000
◆Comment:obese check; there's nothing higher than this.
◆Change Actor Images:Reid, Actor1(0), Actor1_obese(0), Actor1_1_obese
◆
:End
◆
:End
◆If:actor to gain weight = 2
◆Comment:this is Priscilla's weight gain code.
◆Control Variables:#0013 Priscilla's weight += wg from item
◆If:Priscilla's weight > 50
◆Comment:chubby check; if weight is even higher, future checks will get them.
◆Change Actor Images:Priscilla, Actor1(1), Actor1_chubby(1), Actor1_2_chubby
◆
:Else
◆Comment:if we get here our weight is less than 50. normal.
◆Change Actor Images:Priscilla, Actor1(1), Actor1(1), Actor1_2
◆
:End
◆If:Priscilla's weight > 1000
◆Comment:fat check; if weight is even higher, future checks will get them.
◆Change Actor Images:Priscilla, Actor1(1), Actor1_fat(1), Actor1_2_fat
◆
:End
◆If:Priscilla's weight > 3000
◆Comment:obese check; there's nothing higher than this.
◆Change Actor Images:Priscilla, Actor1(1), Actor1_obese(1), Actor1_2_obese
◆
:End
◆
:End
< summary to be provided… >
Now that we have our common events designed, all that's left to do it assign the common events to each item as a Common Event Effect. In the Effect panel, select the Other tab, and Common event option. For the Apple item, select Apple Gaining Effect. For the Cheese item, select Cheese Gaining Effect.
You should now have a working weight gain system in RPG Maker MZ using only common events and variables.