Skip to main content

Affection Mechanics in RPG Maker: Gifts.

This is the post where someone says, "Wow, this person made this way too difficult for themselves, even for a rookie solo dev with a garbage workflow." Or even: "That is a lot of stuff I'm definitely not going to read." Well, what can I say? I'm trying to use as few plugins as possible.

Plugins are code inserted by a third party on "top" of the preexisting RPG Maker structure. Don't get me wrong: Plugins are amazing. There are a lot of incredible programmers out there doing even more incredible things with the RPG Maker framework. I think I've paid for 3 or so plugins and used several other free ones. The two big ones are Hakuen Studio's font manager and the Heads-Up Display Maker from Some Random Dude (no, that's his name). But what I'm afraid of is stacking 100 plugins on top of each other and getting to the dreaded point of "something's broken, and I have no idea where or why." This is something that does happen. So I try to critically think my way through as many mechanics as possible before turning to a plugin or "system."

So here is how I am doing gifts.

First, I create an item. It is able to be used in the menu screen, and it is not consumable (so it stays in your inventory when you click on it). It calls a Common Event when you use it. What's that, you say? Common Events sit in a database and are called up at specific times. They are handy if it's a recurring in-game occurrence across multiple maps. This way, you don't have to update every instance individually when you make a small change, or copy-paste 20 lines of commands repeatedly. You just update one Common Event.

A window in RPG Maker detailing the settings of a single item. The name is "Cowboy hat."

Whenever I put the roller derby team together on a map, I have an Autorun event execute and then erase itself when the player arrives (and when the player moves off the map, the inverse happens). In this instance, I first establish what my sprite is wearing on that map, that gifts can now be given, and you cannot make phone calls because everyone's right here. Gifts cannot be handled or given unless I explicitly tell a map to allow it with the GIFT GIVING switch.

A small window with a list of "Contents." It reads: Control Switches: #170, No team jersey = ON. Control switches: #0003 GIFT GIVING = ON. Control switches: #0002 NO CALLS = ON. Erase event. 

So let's walk onto this map and use the item.

Screenshot from the game "Rorasuketo," where the player stands in a skating rink where nearby derby skaters are stretching. The player's sprite is holding a white box with a pink bow, and in the bottom left corner of the screen, it reads "Cowboy hat."

Now it says "Cowboy hat" in the corner and our sprite is holding a box. I could have used a HUD plugin to achieve the text, and I did eventually purchase said HUD Maker later, but to achieve this, I made a little PNG in a free graphics editor. This is all happening because the item triggered the Cowboy hat Common Event, which looks like this.

Image of a large window that reads "General Settings" at the top. The event name is called "Cowboy hat," and the trigger is "none." Within are a list of commands if the switch "GIFT GIVING" is on, with an else statement of "You can't give gifts right now."

First, it checks to see if the GIFT GIVING switch is on. If it is, cool, proceed. If not, tell the player they can't give gifts right now, to avoid the heartbreak of spending 30 minutes carrying a gift box around with nowhere to put it.

Images displayed on screen are manually assigned numbers. Picture #9 is what I allocate for the gift text overlay. Every gift uses slot #9, so I know exactly what I am messing with. Highly recommend you make "rules" for which picture numbers are associated with what types of pictures you use. Next, I turn ALL the gift switches off in case one was on previously, and then turn this gift's switch on. I change the player's sprite to the gift-holding sprite (recall that there was a switch earlier establishing whether or not you were wearing a team jersey).

I make sure that, when you talk to the coach and start practice, I reset everything. This is in case the player is still holding onto a gift and changes their mind about giving it.

A zoom-in of a larger window. Dialogue for character #16 asks if the player wants to begin. Show choices: "Yes, let's start" and "No, wait." When "Yes, let's start," commands run to fade background music, run the common event "Gifts off hoodie," shake screen, and more. 

Coach asks if you're ready. If you say yes, the Common Event "GIFTS OFF HOODIE" (details not shown) erases picture #9, turns off all the gift switches, and changes Kady's sprite to the appropriate default sprite (in this case, she's wearing a green hoodie and not a team uniform).

So what are these gifts switches doing? Well, this is where we turn to our Events, which are in the form of our skaters. Let's back up, and instead of talking to the coach, we'll give that gift.

The player is no longer holding a gift box, and a dialogue window has appeared with a character portrait. A smiling woman wearing a hijab is saying, "This will make a nice decoration. Thank you!"

This is what the screen looks like. And here's why it looks that way:

Image of a large event window for a sprite with a list of commands if the "Cowboy hat" switch is on, contained within Page 5 of the overall event.

I have an event page just for when the "Cowboy hat" switch is on. Nothing has changed about Wreck's sprite from before except that when you interact with her now, you officially lose the item, erase picture #9, change the player sprite back to normal, turn off the switch, and add the appropriate Affection points. Then I give the player some dialogue, a nice little sound, and a heart balloon to know they did something good.

Besides shambling all this together, the hardest part is the copypasta - hopefully without making any mistakes. If you, the dev, are not paying attention, you are turning off the wrong switch, giving Affection to the wrong character, having characters blink in and out of existence, and so on. So you have to be alert when you're doing this. Copy-paste is a wonderful tool (R.I.P. Larry Tesler), but stay frosty and triple-check everything.

Each of 7 characters accepts anywhere from about 4 to 8 gifts. What I decided to do is just have the character ignore gifts that they don't accept. You talk to them, and they just give their default greeting. If I wanted to have them accept but dislike a gift, or make a snide comment, or anything like that, it'd be another bunch of pages. But I decided to take it in this direction, where the player isn't punished and I have less work to do.

Comments