Help with Board-Game Style Movement

● ARCHIVED · READ-ONLY
Started by harveywth 10 posts View original ↗
  1. I'm working on a game which uses a movement system akin to aboard game. You roll a number and are able to move that many spaces. Currently I have the roll saved as a variable and each space removes 1 from that variable and at first glance it was working well.

    The problem that I've run into is that nothing stop you from moving back and forth between two spaces and I would prefer it if in in a single turn you were only able to move one direction, but on subsequent turns you could move in either direction. This is further complicated by the fact that the map has "loops" (Similar to Dokapon Kingdom) which can put the player back on a space they've already walked on this turn. I've been unable to figure out a solution for this by manipulating variables, switches or conditional branches so far so I'm asking for help. It feels like this should be possible through eventing, but I can't seem to put my finger on how to do it.

    Hopefully I explained this well, I know it's kind of confusing. Thanks for any help anyone can offer.
  2. I wrote this script for my game that allowed me to run a common event after x steps were taken. Maybe it can help you? Its not a public script yet as it will need debugging but it has worked for my purposes. If it works for you, feel free to use it: Just set it up to call the common event to run when the turns ends when the steps are over, and it should work.

    http://pastebin.com/VL9w7Aj3

    I don't have any official terms of use in the script yet, but the terms of use are free to use for commercial and non-commercial games with credit given. Just so you know (and we are clear from the get-go).
  3. Thanks for the reply bgillisp. I looked through your script and it looks like if the number of steps taken could be converted to a variable it would work, however the primary issue I'm having isn't the counting of steps, but preventing back-tracking. I'm going to upload some screenshots to show the current events as well as a video showing my problem more accurately.



    is a link to the youtube video. It shows first me taking a turn as expected. Second me abusing the fact that I can move back and forth which I do not want and third me moving around in a circle and being able to move over tile's I've already walked on as long as I'm still moving a single direction in a turn.
    Here is an imgur link showing the events used. http://imgur.com/a/FkGsQ
  4. Hmmm....yeah, mine does allow you to still wander back and forth, though you would use up your moves that way, as it does take away a step every time you move (for example, if it rolls 5 you could move one forward one back one forward one back one forward, and that would be the end of the turn). I think to fix it to prevent backtracking at all will require more than I have at the moment.

    Maybe you could handle this with events this way though. Set it up so that turn one is automatic based on the roll (since they can only go forward I assume). On turn two, prompt the player for which direction to move in. Also, any time they hit a loop or place where a direction choice can occur, prompt the player. Otherwise, movement is forced forward (or backwards). Might take a lot of conditional loops to pull it off, but I think it can work...what do you think?
  5. Here's what you need to do.

    Firstly, I suggest capturing the keys presses before they move the player. You can accomplish this with an Autorun event which contains a loop, a wait 1, and a conditional branch that checks for button press. Inside the button press conditional, do any further checks necessary to see if the player can move, followed by a move route that moves the game piece.

    This will limit movement to the direction you want. You also will want to save the position moved from, to disallow movement back in that direction. Then, compare it to the players new position. To check if a game piece has successfully moved just determine if the last position is the same as the current position. All of this requires simple, basic 2D geometry.

    Hopefully you can design the system from this explanation, otherwise it may take a rather indepth explanation and tutorial.
  6. Thanks for the reply Titanhex. It's a bit late in the evening to try that out now but I will mess with it tomorrow and see if I can figure it out.
  7. Titanhex's idea might get you what you need, but it seems like it would be rather cumbersome and would also make it harder for you to run normal events in your game while the game expects movement processing to occur.

    I think it would be so much easier to do with some simple scripting in the move_by_input method (part of Game_Player).  Have a switch (I'm using switch 11 in this example) that controls whether the player is restricted from "moving normally" or not, and turn switch 11 ON whenever you don't want them freely moving around.  To implement this in the script editor, just alias the move_by_input method as such:

    class Game_Player < Game_Character  alias :move_by_input_if_possible :move_by_input  def move_by_input    return if ($game_switches[11] == true)    move_by_input_if_possible endendNote that this modification will turn off the normal player movement when Switch 11 is ON; it will NOT, however, prevent the game from reading that the player is hitting a directional arrow, which is a good thing.

    And whatever spaces you want the player to choose a direction, just have an event (Touch Event MIGHT work depending on how you set up the forced movement; otherwise you'll need a Parallel Process that checks the player's current X and y) on the space where the player will need to pick a direction, and then either run Conditional Branches to check which directional button the player is holding, or simply give the player choices ("Show Choices...") about which direction to continue.

    By the way, I think your idea is very neat.  Mario Party and Culdcept and Dokapon and the like are cool games, but I've seen so few attempts to convert the idea to RPG Maker, where I feel it would actually work brilliantly.
  8. While I appreciate the help from both of you very much I don't seem to be able to implement either into something functional. Titanhex's solution proved too complicated for me. For reasons I don't understand when using wavelength's solution despite the script making it so the button presses still work I cannot make the conditional branch for button presses work while the script is running.

    I was hoping there was a simple solution for my problem out there, but it looks like it's more complicated than I'd hoped for. I appreciate the effort you guys have put forth in typing long, detailed help, but I'm not very experienced and it seems this project may be beyond me without more outside help than I'm comfortable asking for.
  9. If you want, post screenshots of the entire event you're using to check for player input when they choose direction, and we can figure out why it's not working.
  10. Moving to RGSSx Script Requests