Chaos Project

RPG Maker => Event Systems => Event System Requests => Topic started by: fataXX on February 20, 2015, 08:36:29 am

Title: [RM2k(3)] - Moving hero 'step by step' with events.
Post by: fataXX on February 20, 2015, 08:36:29 am
Hello!
At first - sorry for my english!

I know this is forum mainly for RMXP/VX, but i have problem in RM2k(3), so i have a problem to solve only using events.
How can i move hero only by one step with only once key pressed?
Otherwise:
What i need: When i press ONLY ONCE "right key" on keyboard, hero will move ONLY ONE step to right. When i need two steps to right, i need press key twice. When i press and hold key pressed, hero must move only once and wait for next pressing key.

I'm fighting with "Key Input Processing" and still dont work :/

Please, give some hints. Thank you and once again - sorry for my english ;)
Title: Re: [RM2k(3)] - Moving hero 'step by step' with events.
Post by: KK20 on February 20, 2015, 05:49:41 pm
I can't exactly remember what the interface looked like. But I did a quick Google search and it seems like there are a number of solutions. One is to use an Event as your player object and turn your player object invisible and placed somewhere it can't move (surrounded by impassible tiles). Another was something about using a Move Event and putting in a 'Wait' to prevent moving until another button is triggered. And something else about using an auto-start event, though I'm not sure what they meant.
Title: Re: [RM2k(3)] - Moving hero 'step by step' with events.
Post by: Ranquil on February 21, 2015, 06:32:14 am
Make an event with Auto-Start, set any other conditions you want and put it somewhere on the map. Then, do something like this:

<>Label: 1 (We want this to go on a loop, so let's set a label here)
<>KeyInputProc: [GetKeyPress] (Set some variable to get only the arrow keys, also set to Wait Until Key Pressed)
<>Branch if Var [GetKeyPress] is 1 (Meaning down key pressed)
   <>Move Event: Hero, Move Down
   <>Variable Oper: [GetKeyPress] Set, 0 (This way the game thinks the key isn't pressed anymore and you have to press it again)
   <>
: End
<>Branch if Var [GetKeyPress] is 2 (Meaning left key pressed)
   <>Move Event: Hero, Move Left
   <>Variable Oper: [GetKeyPress] Set, 0
   <>
: End
<>Branch if Var [GetKeyPress] is 3 (Meaning right key pressed)
   <>Move Event: Hero, Move Right
   <>Variable Oper: [GetKeyPress] Set, 0
   <>
: End
<>Branch if Var [GetKeyPress] is 4 (Meaning up key pressed)
   <>Move Event: Hero, Move Up
   <>Variable Oper: [GetKeyPress] Set, 0
   <>
: End
<>Jump to Label: 1 (When we jump to the label, we go back to the beginning and button checking start again)
<>

And there you go!
Just remember that this pretty much fucks everything else up because you can't check other events with Enter/Spacebar/Z or use Esc/Backspace/X/C/V/B/N to go to the menu during this because it's an Auto-Start event. That is, unless you use Paraller Process events to check stuff.

I hope this helped!