Cleric, script kiddie and fudanshi
- May 6, 2017
- Reaction score
- First Language
- Primarily Uses
Tutorial topic: how to let the player customize their character (hence the title)
Even if I'm not into tutorials about something an extension/studying documentation could do just fine, I've recieved an offer for doing this, so… here comes nothing. Check this tutorial if you'd like the player to choose their character's name/gender (much like in an RPG).Template used for this tutorial: Sample Scripted-based UI, 720 x 1280 (my patron wants to develop a mobile game)
- Having read the Beginner's Guide. I can't help you either otherwise.
- Gender selection (in new scene)
- First of all, we need to ask the player about their gender. Here's a possible set up:
- Next is the player's choice. Since the we are considering only binary genders (he and she), the player has only two choices: switches are the perfect type of variable in these cases (just consider OFF = "Boy" and ON = "Girl"). Also, we want the game to remember this piece of information for the entire duration on the game (you may need the player's gender anytime during the story), but still having a different copy of it for each save file (no every save file's character may have the same gender); because of that, we are going to use a global switch. I named it "Gender". Please note that while the second choice switches on the desired switch in my example, I haven't set up an action for the first one instead. While it apparently should switch OFF "Gender", all of the switches are automatically initialized at OFF at the start of the game. If you find this coding style too obscure or simply desire to use this scene more than once in your game, just switch it OFF manually at some point before "Show Choices".
- All done! Of course, memorizing the player's gender is pointless, if you don't use it later at some point of the game. Here's an example:
- Please keep in mind that if your otome is not one of those that never show the MC on screen (like Doki Doki Literature Club for example), you'll need to use this tecnique every time you need to choose your MC's expression, since VNM doesn't let you calculate an expression without scripting (up to 1.0.1077). If you do so, it is higly recommended that you shorten your code using command events.
- Name input (either in the same scene or not)
- First of all, we need to ask the player their name. Here's a possible set up (in a new scene):
- Next is the player's input. We need to save it in a text variable before transferring it to our character. Since we won't need this variable again later, we should use a local text variable. Please notice how the default text input popup window is not optimized for our current resolution. You can fix this using either a better resolution (which will end up making the message box smaller though) or a custom interface which is more suited for our custom resolution.
- It is now time to create our MC: let us move to the database and work on it!
- After saving your project (so that VN Maker can notice there's a new character), it's finally time to transfer the player's input where we really want it to be.
- All done! I'm testing to see if it really worked.