Defining Plot Progress with Variables

Faherya

The Knight of the Sad Figure
Veteran
Joined
Jul 25, 2013
Messages
234
Reaction score
528
First Language
Portuguese
Primarily Uses
RMVXA
@bgillisp has raised a very interesting point in his status: How to use variables to define the course of a script? Explain your methods here, I'll start with mine:

I often use variables as score. Certain actions (missions / progress in the game / Level) increase the value of the variable. That way I never need to worry if the player is going in a certain place before the time, because nothing is going to happen. Nor do I have to worry about manipulating playing time so that progress is neither too fast nor too slow. This template allows the player to make their own time.

Let's say the player is locked in a puzzle. He just needed to do extra missions, kill monsters and level up to get past that part of the game, right? Wrong, in these situations you can simply lock the value of the variable, preventing the player from mocking this part of the game. For extra missions, secret scenes and the like, it is enough to limit some restrictions. For example, the player will only receive the special weapon if he goes to a certain place while his score is greater than or equal to X or while it is between Y and Z.

This model allows me not to have to use switches everywhere. As I started with RM 2003, there were no local switches, we needed to save as much as possible. I ended up with the habit until today and still seems reasonable.
 

Eurritimia

Villager
Member
Joined
Aug 27, 2017
Messages
23
Reaction score
22
First Language
Portuguese
Primarily Uses
RMMV
I literally use a variable called history to keep track of my game. It makes my game linearish but i know easier how everything is going on.
 

Milennin

"With a bang and a boom!"
Veteran
Joined
Feb 7, 2013
Messages
2,270
Reaction score
1,372
First Language
English
Primarily Uses
RMMV
I like to use a variable to mark progress within a smaller slice of the story, but then use a new variable for the next main step. It lets me still give relevant names variable names and look up easily what part of the game the variable is used for, but at the same doesn't require a switch for every little new thing that happens. It also prevents getting lost in a large number of possible values within a single variable.
 

Matseb2611

Innovate, don't emulate
Veteran
Joined
Oct 15, 2012
Messages
4,604
Reaction score
6,482
First Language
English
Primarily Uses
RMMV
I use variables in this manner in several situations:

- Scene sprite management: Need complex stuff to happen or for a character sprite present in the scene to go to the next page? Just add +1 to a variable assigned to that scene. E.g. Make a variable called Level 1 entry scene. Then as each new things is needed, keep adding +1 to it (or just set the variable to a higher value) as the scene goes on and give conditions to the event pages associated with this variable's values. Saves you up on a lot of switches.
- Cumulative tasks needed to accomplish for something to unlock. E.g. Speak to all ally NPCs before leaving the area or Find all X number of keys to unlock a door. Every time you do one, add a value to the variable (just remember to have a self switch or a new event page so that consecutive interaction with the same NPC doesn't keep adding to this variable). Lastly, have a conditional branch. Once variable X reaches value Y, do the so and so action.
- Developing relationships. Need something to keep track of an ally's level of trust in your or maybe even a romance score, well, variables are perfect for it. Later you can use conditional branches for different outcomes depending on someone's trust/romance score with you.
 

CleanWater

Independent Developer
Veteran
Joined
Apr 8, 2017
Messages
638
Reaction score
739
First Language
PT-BR
Primarily Uses
Other
I divide the main quest into sections and use each section's variable to track the progress of the game.
Like you do, certain things only are accessible after the "score" is higher than x, or between x and y.
 

GuanyuMaker

Veteran
Veteran
Joined
Mar 9, 2015
Messages
63
Reaction score
74
First Language
Portuguese
Primarily Uses
RMMV
I use vars for everything that needs to be tracked. Same way one would do while programming. Score values, plot progress , evaluations and calculations. Everything and everywhere. In the end the editor is just a visual Tool for programming your game.

Edits: For the plot progress itself I usually do something like @CleanWater does . An history var that gets a +1 for each cutscene passed and another if needed for each stage in a cutscene. If my game does have multiple storylines I do use one for each endline. If the history is somekind of history tree that we have a couple of forks I just stop using the current var and create new ones for each branch of a fork.

But Im not afraid of using switches If something can be done easier that way. After all switches are just boolean or logical variables .
 
Last edited:

M.I.A.

Goofball Extraordinaire
Veteran
Joined
Jul 13, 2012
Messages
869
Reaction score
711
First Language
English
Primarily Uses
Bingo!

I use variable "Score" for Progression in my main project. I also assign that "Score" a dialogue that any of the 'fortune tellers' can iterate, in case a player has taken a break for too long and forgot what they were doing. I'm not a fan of quest logs. :)

-MIA
 

fallenlorelei

Veteran
Veteran
Joined
Jul 8, 2013
Messages
295
Reaction score
336
First Language
English
Primarily Uses
I love this conversation! I am taking notes like a fiend.

I also use a ton of variables in my game for various plot-related mechanics, although I'm concerned about doing a "+1" for every story element passed. What if you wanted to add an important story element mid-game yet post-production? You can try as you might to make the perfect story prior to development (we all have our rough drafts), but when alpha testers get in and notice an incongruency - what do then? All of your events are set to particular numbers that will need to be changed, and depending on how long your game is, that can be a lot of work. All great writers need to edit their work and the same is true of game development.

Meanwhile Switches don't work incrementally - just by name (well - ID). If you added a new story plot (talking to a new required NPC in between going to the dungeon), you'd only have to change a Switch or two for the proceeding story elements. If you used Variable #s, you'd have to change the # for ALL events afterward. If opening the dungeon needed var 25, defeating the dungeon set it 26, then talking to the mayor for a reward needed 26, receiving the reward setting it to 27, and giving the reward to your mother required a 28..... you'd have to manually go in and change all those numbers up until the end of the game. For a switch, you'd just have to change the switch ID for one or two events, and then everything will work as intended from thereon out.

But maybe I misunderstood what everyone was saying here! I'm still drinking my morning coffee! :D
 

CleanWater

Independent Developer
Veteran
Joined
Apr 8, 2017
Messages
638
Reaction score
739
First Language
PT-BR
Primarily Uses
Other
@fallenlorelei when you need to change something mid game, you can simply create a extra switch for that part and add a comment to not forget. :wink:

Actually, there's no easy way in game development. Even when you try to optimize things, you need to do a lot of work to achieve this.
 

GuanyuMaker

Veteran
Veteran
Joined
Mar 9, 2015
Messages
63
Reaction score
74
First Language
Portuguese
Primarily Uses
RMMV
@fallenlorelei . Thats why people sometimes divides the vars in multiple ones for parts of game history or history branches. But it is still good to have one to keep track of the whole history as if it where a index or a summary. When you change something you may only need to change the var tha tracks that small block of history instead of everything. If you do something that needs to change the big index it will be ok as it will recieve a +1 less frequent so it will be checked in a lower frequency too.

But I wont be too worried about it. I do use alot of switches and the tool( RPG MAKER) is supposed to make things easier for you, not harder. If theres something you can do that works better on switches long or short terms, why not using it?
 

fallenlorelei

Veteran
Veteran
Joined
Jul 8, 2013
Messages
295
Reaction score
336
First Language
English
Primarily Uses
@CleanWater and @GuanyuMaker Very good points! I sat back and thought about it, and you could probably get away with using a combination of switches and variables to make life a lot easier when +1'ing story events, or just having different story variables per "chapter" or even per "scene" (or heck, per "map" would work too, and save a lot of headache tracking down events tied to your variable when updating the story).
 

Matseb2611

Innovate, don't emulate
Veteran
Joined
Oct 15, 2012
Messages
4,604
Reaction score
6,482
First Language
English
Primarily Uses
RMMV
although I'm concerned about doing a "+1" for every story element passed. What if you wanted to add an important story element mid-game yet post-production?
Yeah, this is why I prefer to keep separate variables for different scenes. Having one variable for the entire game is going to get very messy and hard to keep track of. For organization's sake, it's better, in my opinion, to keep each variable assigned to a much smaller scale in the game.
 

Neka Music

Veteran
Veteran
Joined
Dec 29, 2012
Messages
277
Reaction score
102
First Language
Empty
Primarily Uses
N/A
I use a variable called the "Story" variable, which adds +10 for each event,
and I also have the "additional story" variable, in which I will use it whenever I need to add a new event without modifying / altering the normal story variable amounts.

For debug testing purposes, I even add the story variable as a view-able currency on the main menu. So, I don't have to search for the latest events through the game editor.

For Chapter purposes, I use Switches, such as : Chapter 1, Chapter 2, and so on.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I friend of mine insisted on practicing dubbing things with him... and its quite funny, yet, it really takes a huge amount of practice!
Gotta save this for my next thread later...
Finsh all of the walking dead game in a week, such an amazing emotional trip
I really need to stop sidetracking sometimes
Take THREE seconds to watch my freakin plugin video clip and just be proud of me, forum/Dad!

Forum statistics

Threads
97,871
Messages
947,507
Members
129,105
Latest member
Gestsuka-P
Top