What are recommended ways to do a dungeon featuring a mine cart?

Phil32

Veteran
Veteran
Joined
May 31, 2016
Messages
77
Reaction score
12
First Language
English
Primarily Uses
RMMV
Hey everyone! I'm wanting to do have a unique gimmick to make each dungeon in my game feeling special instead of just some move here, get to here, which isn't bad design, but for the first dungeon of my game, I want something cool.


I want it so hitting switches will change the direction of the track. It'll start off easy with just switching the mine cart track to go one direction or another (will need help understanding how to do this), and wanting later to have switches that when pull, they switch the other switches adjacent to that switch. 


How would I go about doing these things? Thanks for reading, all!
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,086
Reaction score
2,677
First Language
Greek
Primarily Uses
RMMZ
Nice question you got there. Well this sounds complicated.If we don't have any sceeen shots of what you are up to, it is a really broad question, since such a minecart system can be done with many ways.


For instance you might have an event stopping the user from having any movement, changing the character graphics to character inside a minecart, move the character around, stop on certain crossroads, Show choice left right and according to what will be chosen, things will happen. Then the player will end up to an end point where the graphic will change back to normal and controls will be restored back.


This is just using eventing and it CAN be done, but it is VERY complicated. So I think it is hard for anyone to point you how to do ALL these stuff.


Replying to your Question Title:


If you will use eventing, I would recommend you to make modular pieces of events. The use of Common Events here will probably make your life easier. It will be a very complex system, so if you will approach it using events, I strongly recommend you to consider using them.


Code in Javascript can help things a lot to keep things tidy. Maybe a plugin exists for that, maybe not. Not sure. If a user friendly plugin exists it might help you a lot. Otherwise you will have to know javascript and that might be a problem.
 
Last edited by a moderator:

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,265
Reaction score
1,283
First Language
Spanish
Primarily Uses
RMVXA
this is the VX code to make an event move along a track marked with region ID 1


in custom route, add a script entry


move_forward if $game_map.region_id($game_map.x_with_direction(x,direction),$game_map.y_with_direction(y,direction)) == 1




you can use region ID, terrain tag or tile ID, the structure is the same.


map.scan(x,y) == ID


where x and y have to be defined by _with_direction so that it takes into account the tile right in front of the player, and "direction" is the variable direction from the event itself.


shouldn't be too hard for you to adapt that to MV, a button push, an event touch, or whatever.


I'm using that code to make monsters wander around a specific area in a map.... which I came up with by answering the question "how do I push an event forward?"
 
Last edited by a moderator:

Dullstar

Villager
Member
Joined
Jan 24, 2016
Messages
16
Reaction score
5
First Language
English
Primarily Uses
I'm not sure if any method checking the tile directly in front would perform well. I've not tried it with script calls specifically, but when doing this through eventing you can see choppy movement due to a process of "move forward one tile, check tile, move forward one tile, check tile."


That said, if the OP does not know how to convert that VX code into Javascript, it's useless. Additionally, I'm no programmer, but I don't see any way for that code to handle junctions. Seems to me like it just goes straight forward if it passes a region ID test? What happens if the tile in front doesn't pass, but a different adjacent tile does? Would it recognize the turn? What if there are multiple eligible tiles?


Assuming they are intended to function like the ones in the second dungeon of The Legend of Zelda: The Minish Cap, (meaning you can only get on and off in specific locations) here's something I've found to work after a bit of testing:


IMPORTANT: When using the move routes I mention here, DO NOT WAIT FOR COMPLETION OR THE JUNCTIONS WILL NOT FUNCTION!


I'm assuming you're using a switch to turn the track, but the principle is similar if you're asking the player which way to turn when they get there.


Your first event will be a location you can hop onto the minecart track. Once you take care of whatever animating you want to do to get the player into the vehicle, activate a switch specifying that the player is in a minecart. Next, apply a move route that will take you exactly to the location of the next junction.


Set down an event at the location of the junction. Set it to "Below Characters" and to activate on "Player touch." Use conditional branches and/or different event pages to select which move route you want to use next. I would use one page for each visual state the track will be in; then use a conditional branch to see if the player is in the minecart or not. If so, activate the move route.


You'll keep repeating this at every junction until you reach the end of the track. It's okay to use "Wait for Completion" at the final portion of track.


This method is a pain to set up over a long area, but it runs cleanly and is relatively simple to understand.


A flaw in this setup is the fact that it will only flow in one direction. To fix this, at junctions you can use a variable to store which direction you'll be going when you arrive at the junction. If you set them manually you can do whatever makes sense to you; if you use Control Variables -> Game Data -> Character -> Player -> Direction to set the direction variable, I think the numbers it will use correspond to the arrow keys on the numpad (8 up, 4 left, 6 right, 2 down). When you activate the move route at the junction, use a conditional branch with the directional information to specify which way to move. The setup is kinda like this:


Say you have a track with this setup


  ______________________


/


|


|


Upon arrival at the junction:


    If player is facing up, turn right.


    If player is facing left, turn down.


I'd recommend common events for the boarding animation and the exit animation, including changing the player's speed in each (I assume the player should be moving faster in the minecart, yes? Set it up in the common event so you don't forget to change it/change it back) To clarify, when I set this up, I hid the minecart you see on the map as part of my boarding animation and replaced the player sprite with the minecart. In getting off, you would make the minecart reappear and change the player's sprite back.


As for setting up the junctions; switches and variables are your friend. You will probably need a lot of them.
 
Last edited by a moderator:

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,265
Reaction score
1,283
First Language
Spanish
Primarily Uses
RMVXA
I'm not sure if any method checking the tile directly in front would perform well. I've not tried it with script calls specifically, but when doing this through eventing you can see choppy movement due to a process of "move forward one tile, check tile, move forward one tile, check tile."
yes, that is the main downside.


I don't see how it would be fixable without any scripting, since he would need to fix the refresh rate, or manually edit the coordinates through eventing (which is much harder), OR manually direct the player while simultaneously changing the player graphic (which is the hardest)


what I posted is not hard to convert, at all.


it's basic interpreter functions that he can find by reading the code, just called up in a different way.


that's what the interpreter runs whenever it detects a "change route" entry in the event code.


for turns and loopbacks, you just change the region ID, or force the event to look the other way.


whatever direction you send it in, it'll keep moving in that direction until you stop it.


(of course, this is a basic concept.... you need planning to decide what the final track would look like, and adjust accordingly)
 
Last edited by a moderator:

Dullstar

Villager
Member
Joined
Jan 24, 2016
Messages
16
Reaction score
5
First Language
English
Primarily Uses
The only way I know of to fix choppy movement is to hardcode the entire movement route.


That said, I've been intending to look into what the syntax would be to make a script call for, say, "move forward 6 times." I imagine using that, and some variables you could probably make a setup to do all the slow steps ahead of time so that the actual movement will occur smoothly. Unless it involves a loop. Then it might be slow just like the evented version of it.


One thing I tested was parellel processing events not set to wait for completion. It ran somewhat smoothly but it couldn't really effectively be interrupted for things like turns and stopping. But I didn't spend much time testing it. I can think of a few possible improvements to make, but I don't know if they'd do anything or not.
 

Phil32

Veteran
Veteran
Joined
May 31, 2016
Messages
77
Reaction score
12
First Language
English
Primarily Uses
RMMV
Hey all. Thanks for all of this stuff to think about.


I'm thinking more of the player entering a mine cart and moving along the track automatically. If a switch (an actual physical switch and not an RPG Maker one) is pulled one way, the track will make the player in the mine cart go one way while if it's pulled another, the player in the mine cart will move that way. I'm thinking that wouldn't be too complicated, but it might be more so when things like multiple switches turning different sections of track in one room of the dungeon occurs. For instance:




Switch A changes which direction A makes the player go. Switch B does the same for B, and so forth. If A is pulled, and B is not, how can I use switches (the RPG Maker kind) to make sure the player automatically moves in the mine cart to the proper end of the track? Hopefully that helps clarify the direction I'm interested in going, as all this scripting and coding stuff goes way above my head and out of my comfort zone.
 

Dad3353

Veteran
Veteran
Joined
Mar 9, 2016
Messages
421
Reaction score
110
First Language
English
Primarily Uses
In the configuration above, there are only 4 possibilities: A-B1, A1-B2, A2-C1 and A2 C2. Have an Event Page for each of these possibilities, each with the appropriate Move Route. Each Event Page conditioned by the relevant pair of Switches. Once the Event triggered, it is the Page with the corresponding Switches which will set off the Move Route for the Cart.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,265
Reaction score
1,283
First Language
Spanish
Primarily Uses
RMVXA
If a switch (an actual physical switch and not an RPG Maker one) is pulled one way, the track will make the player in the mine cart go one way while if it's pulled another, the player in the mine cart will move that way.


Half-Life's chapter "On a rail" comes to mind.


or the entrance to the temple of Bu, in Twinsen's Odyssey


there's an area that is a closed loop track, and you have to change rails to open alternate routes, that will eventually take you out.


is change A a three-way change or a two-way?


can you loop back from B to C or only go back to A and then bounce back?


I have a couple ideas in mind, but that's a system-defining question..... if you make it a one-way track all the way, then you have to ping-pong all the way to the end, and then redirect the track.


if not, you can loop around anywhere you want, but the code would be way different.


I'm thinking it could probably be just a cinematic between switches, and then a choice event.


in HL, you had to do it on the fly, shooting the levers.... if you missed, you had to wait for the cart to loop back around.
 
Last edited by a moderator:

Dr. Delibird

Also known as HRforges
Veteran
Joined
May 16, 2014
Messages
283
Reaction score
176
First Language
English
Primarily Uses
RMMZ
You can do it quite easily with events. Easy meaning not difficuilt, it will be tedious as.


You can use a muffin ton of conditional branches within conditional branches to check which of the levers (imma call them levers so I don't confuse them with switches xD) are pulled so that the event can move the player/mine cart in the appropiate direction. It will be fairly messy doing it this way as you are basically hard programming all possibilities using quite a few conditional branches.


Example:


If lever A = ON


    Set move route (a couple of rights and then left then just following the track until the next junction)


Else (meaning the player didn't pull the lever)


    Set move route (right until reaching the next junction)


If you are wanting the player to be able to flip the switches whilst the cart is moving (sort of like an action sequence in that if you miss it you miss it) all of these move routes will need to have the wait for completion box unchecked. You could set each event to be on the tile where the split in the junction takes place and have it set to bellow the character and on player touch (since an evented system that keeps track of the exact location of the cart and runs events based on its location is note only more difficuilt but is also unnecessary for a basic version of this system).


Instead of using switches you could use a variable or two but unless you want to add extra things to this mine cart system (a system where you must make the cart jump over boulders that hurt you if you don't, a speed up/down system that could be used with a cinematic sequence of a big monster/boulder chancing the player) the switches are the more linear way of doing things. 


That being said you can use a variable called levers and on lever A itself would set the variable to 1. Then at the first junction you can check the value of the variable for the conditional branch and if it does equal 1 you do what happens if you have flipped the lever, if not then you do what happens if the lever was not flipped. You just keep setting the variable to a different number for each lever and checking for the corrorsponding number at each junction. Variables are more flexible than switches (after all a switch is for all intense and purposes a variable with only two possible states) however switches are more linear and so if a bug is created you can figure out what was causing it much easier as each lever has its own switch rather than shareing a variable with ever other lever.


If there are any bugs with my solution please let me know as I did this all in my head and did not have the program in front of me to test if it works. Also if you have any follower up question do not hesitate :D
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Oh wow, just got word the police are looking for an armed suspect within a 2 block radius of my office. Super glad I'm not there right now. :kaoswt:
Sheila Nagase

same caption as before. :3
"Be as honest as you possibly can as often as you can. It makes your lies much easier to believe."
Each new game means new ways to survive and you need to adapt when you have 10 different stores with lots of items for your adventure

Forum statistics

Threads
107,376
Messages
1,029,211
Members
139,474
Latest member
neotek7
Top