RMDC #1: Dynamically Ordered Choice Selections

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,848
First Language
English

Suppose you have an NPC that displays a list of options for the player to select from. The catch: each option has a condition that must be satisfied to appear, and the order that the options appear is based on the order that the conditions were satisfied.

Introduction

The RMDev Challenge is a series of articles that presents a problem for RPG Maker developers and the objective is to find a solution.

The purpose is to engage RPG Maker developers in some (possibly practical) problem-solving that will allow them to explore more of what the engine has to offer, and also to see how others implement the same solution.

The rules are simple: provide a solution that works in a version of RPG Maker of your choice. You can use anything at your disposal: events, pictures,  ruby scripts, external libraries, etc.

You may present your solution however you wish (comment, blog post, video, etc) and wherever you wish, but I ask that you leave a link back to this article if you are sharing a solution on external sites. I also recommend sharing the solution on external sites and leaving a link in the comments because the comment section is too small for details. Remember: you want to share with others your solution.

Challenge

Suppose you have three villages in your world creatively named Village A, Village B, and Village C. I will refer to these villages as A, B, and C for brevity.

To make traveling around the world faster, you have a teleportation device in your castle that allows you to teleport to a village that you have visited. Initially, none of the villages are available.



Once you visit a village and record its position, you may now teleport to that village using the device.

The order that the villages appear in the teleport menu is based on the order that you visited the villages. For example, if you visited A, then B, then C, the options would appear in that order.



On the other hand, if you visited A, then C, the A would appear first, followed by C.



You can see that Village B isn’t available. This is because you haven’t visited it yet.
Finally, after you visit B, you would now see A, followed by C, followed by B.



This reflects the order that the villages were visited during your game.

Note that the solution does not strictly need to be presented as the default choice selection (these images were generated for illustration purposes only)

How would you accomplish this?

(originally posted at HimeWorks)
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,517
Reaction score
3,221
First Language
Binary
Primarily Uses
RMMZ
I would just script a teleportation scene (as i did in the past) ^_^

Although, that doesn't really order them dynamically, it just checks whether or not to display them.
Hmm...
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,848
First Language
English
Although, that doesn't really order them dynamically, it just checks whether or not to display them.


Hmm...
Yes, I was about to ask how you would handle the dynamic ordering lol
 

Venka

Veteran
Veteran
Joined
Jun 20, 2012
Messages
945
Reaction score
365
First Language
English
Primarily Uses
I must be missing something cause doesn't the sort method do this already? I know in one of my scripts it adds stuff into a array/hash when things are discovered and the dev can decide how they want to sort that list, by levels, alphabetically or order discovered.
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,517
Reaction score
3,221
First Language
Binary
Primarily Uses
RMMZ
ok, if i was adding a dynamic ordering into my script i would just remember the order the entries where added and then dispay in the same order...

Not really given it much thought about how to do it using normal game choices :p
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,848
First Language
English
Eventing is a core component of RM and so a solution that uses the choice command would be preferred.
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,517
Reaction score
3,221
First Language
Binary
Primarily Uses
RMMZ
So just to be sure, it should use the event choice command thing, but doesnt necessarily need to be an evented solution?
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,848
First Language
English
So just to be sure, it should use the event choice command thing, but doesnt necessarily need to be an evented solution?
Yes, it doesn't need to be a completely evented solution. It would be nice if you used the event choice command thing (entirely up to you. You could just use a custom scene with a configuration section for input).


But integrating it with the event system is cooler right?
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,517
Reaction score
3,221
First Language
Binary
Primarily Uses
RMMZ
Not necessarily 'cooler' cause who knows what you might come up with for a fully scripted scene - flying saucers abducting the player and placing him at a new location for example... But it would certainly open it up for more possibilities due to allowing the dev's imagination to maintain control over things. :p

Will see what I think of (if anything) and let you know.
 
Last edited by a moderator:

Ralpf

Veteran
Veteran
Joined
Jun 5, 2014
Messages
590
Reaction score
152
First Language
English
Ok, got it working, had some issues reusing an old project (may have been scripts interfering) so I had to start over. Didn't take long, though any more then 3 locations would make everything much more difficult to keep straight using this method.

First we need to set the order of when/if you visited a place:

RMDC 1.jpgRMDC 3.jpgRMDC 4.jpg

And Make sure that only happens once:

RMDC 2.jpg The ones for B and C are the same, didn't bother taking a picture.

Then set a switch corresponding to the order when you enter the room (All one event page):

RMDC 5.jpgRMDC 6.jpgRMDC 7.jpgRMDC 8.jpg

Then you need to show the choices (I only did the ones starting in A, but it is a simple process to show the rest):

RMDC 9.jpgRMDC 10.jpgRMDC 11.jpgRMDC 12.jpgRMDC 13.jpgRMDC 14.jpg
 
Last edited by a moderator:

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,374
Reaction score
8,536
First Language
English
Primarily Uses
RMMV
I actally got this working quite nicely with events. Probably similar to Ralpf's but I've not delved into all of his event pages.

With the specific scenario you've put forth, it's not too messy. Any more towns and it starts getting complicated real quick.

When I'm home on my computer again, I will post video and screenshots.

Back to add:

Okay, here is my solution in action:

I made the assumption that Village A will always be listed first, since it is the village you start in and therefore the first town visited. Also, I made it so that when only one town has been visited, it simply asks if you want to go to the other town. I may amend this as I want to go back and try it with 4 towns to see how I can get it best to work.
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,848
First Language
English
Here's my solution. I've also included a demo.


Similar to other event solutions, I used events to track village order and set up the teleportation device.


For tracking villages, I condensed it down to just variable incrementing and didn't bother checking what the values are (except for whether this is the initial visit or not, which is done as a page condition)





I used a script to hide choices and sort the choices based on the order that the villages were visited.


All the script does is allow me to make a script call to handle all the different combinations of choices rather than having to create a dozen different cases.


 
Last edited by a moderator:
  • Like
Reactions: Kes

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I'd probably just make an array or hash that saves which villages can already be teleported to and use that to determine the choiceslist, that way I could easily keep it based on the order your found them. Just like what happens in the item list if we remove the sorting part from the default script.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,848
First Language
English
I'd probably just make an array or hash that saves which villages can already be teleported to and use that to determine the choiceslist, that way I could easily keep it based on the order your found them. Just like what happens in the item list if we remove the sorting part from the default script.
Using an array to keep track of the choices would work, but what about actual displaying the choices?
 

Sarlecc

Veteran
Veteran
Joined
Sep 16, 2012
Messages
453
Reaction score
211
First Language
English
Primarily Uses
RMMV
By setting $game_variables to the id's in the array then using \v[n] in the choice commands would be one way. :)

Was actually similar to the way I was trying but didn't have the commitment to finish it.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
@Hime - display them in the same order as in the array. Since you'd put them inside the array in the order of how they've been unlocked, then they will have that same order on the choices. and of course we'd be using something else or edit the default choices window so that we could correctly link it to which place it should teleport into.


@Sarlecc - though if we're using the default choice window, the names alone won't be enough as we need to specify in the event command what each choice will do. So we still need to edit how the choices would work.
 
Last edited by a moderator:

Sarlecc

Veteran
Veteran
Joined
Sep 16, 2012
Messages
453
Reaction score
211
First Language
English
Primarily Uses
RMMV
@Adiktuzmiko Conditional branches inside the choice commands would work for that.

Code:
 choice \v[1]  if $game_variables[1] == "a"   transfer location a  else    if $game_variables[1] == "b"      transfer location b  else     transfer location cchoice \v[2]  if $game_variables[2] == "a"   transfer location a  else    if $game_variables[2] == "b"      transfer location b  else     transfer location cchoice \v[3]  if $game_variables[3] == "a"   transfer location a  else    if $game_variables[3] == "b"      transfer location b  else     transfer location c
 

Venka

Veteran
Veteran
Joined
Jun 20, 2012
Messages
945
Reaction score
365
First Language
English
Primarily Uses
I've been trying to work up a script for this but having a hard time focusing on it and finding the time to finish it. But I have it so the dev can set up choice options in the script and they can set conditions for the choices to appear in the list.. like if a switch is on/off, if a variable is atleast x, or they can set it to true/false to start out with and use script calls to update the display toggle. Then they can link a common event to run when a choice is picked.(or not).

Then in the script is when the choices are saved off. If the check value in the set up is met at the start of a new game then the choice will get saved into a list. More choices will get added to the viewable list as script calls are used to turn them on or as conditions are met. I'm debating on letting the player sort the list..but I think it'd be too many options then and it'd become annoying for all the choices.

I'm about 80% done with it.. I think I spend the first couple of days just setting up a demo and only the last day or so working on the script... yeah I know that's a bit backwards. I should write the script and then the demo ;)
 

Ralpf

Veteran
Veteran
Joined
Jun 5, 2014
Messages
590
Reaction score
152
First Language
English
Here's my solution. I've also included a demo.

Similar to other event solutions, I used events to track village order and set up the teleportation device.

For tracking villages, I condensed it down to just variable incrementing and didn't bother checking what the values are (except for whether this is the initial visit or not, which is done as a page condition)
Can't believe I missed that, used a very similar method in my farming system.

I don't know any Ruby, but this is definitely one that is better to script, but if it is just 3 places it's not too bad to event.
 
Last edited by a moderator:

Venka

Veteran
Veteran
Joined
Jun 20, 2012
Messages
945
Reaction score
365
First Language
English
Primarily Uses
ok.. had a ton of bugs I had to work out and think it's all working now. Of course it's the middle of the night so.. sorry if I missed a few.

updated demo link: https://www.dropbox.com/s/c4mk19rl70b9qn7/Dynamic%20Choices.exe?dl=0

note: I used some of PandaMaru's tiles and and edit of Mack's tent stand in the demo. So if any resources get reused, credit and terms must be followed for those resources :)

edit: Ok now that I've had some sleep, here's some screen shots and I found a couple of things I forgot to check.. like I didn't put the script call in for the final list when talking to the girl in the lower right corner of the map. I also forgot to put limits on the choice window size when the list is bigger then the area it should be drawn to. I'll fix that when I get a chance.

You can set up multiple lists though and they take message codes so here's some screen shots of the list change, a long list and some icons in the choices:

screenshot.png

shot.png
Dynamic Choices.rar
 

Attachments

Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,035
Messages
1,018,456
Members
137,821
Latest member
Capterson
Top