Push to Move
Version: 1.0
Type: Event Behavior
IntroductionThis is a fairly simple system, but some people might bother with more complicated ways to achieve this while it's actually so easy to make.
Features
- pressing in an event's direction will move the event
- additional conditional branch to prevent any movement if there's a wall
ScreenshotsN/A
DemoN/A
InstructionsPut this event code in any event.
@>Play SE: '045-Push01', 80, 100
@>Set Move Route: Player
: $>Change Speed: 3
@>Set Move Route: Player
: $>1 Step forward
@>Set Move Route: This event
: $>Turn away from Player
: $>1 Step forward
@>Wait: 8 frames
@>Set Move Route: Player
: $>Change Speed: 4
A possible improvement is to prevent moving at all if the event can't move. In this case you need a scripted Conditional branch wrapping the event code above. This is the altered event code:
@>Conditional Branch: Script: $game_map.events[@event_id].passable?($game_map.events[@event_id].x, $game_map.events[@event_id].y, $game_player.direction)
@>Play SE: '045-Push01', 80, 100
@>Set Move Route: Player
: $>Change Speed: 3
@>Set Move Route: Player
: $>1 Step forward
@>Set Move Route: This event
: $>Turn away from Player
: $>1 Step forward
@>Wait: 8 frames
@>Set Move Route: Player
: $>Change Speed: 4
: Branch End
If you don't use a speed change, be sure to set the "Wait" command appropriately to 1, 2, 4, 8, 16 or 32 for the player speeds 6, 5, 4, 3, 2 and 1 respectively. (i.e. the speed was changed to 3, to a time of 8 frames is required)
Credits and Thanks
Author's NotesYou can use this code in a common event and simply call that common event from an actual event.
N-Joy! =D
It's simple and does the trick. Now, I've got to check other event systems to see what you mean (really, I've NEVER checked a push-event system before >.<)
:D Wow, awesome - I love it. Thanks so much for this!
There's a script that does this too.
I remember I did this before but it was long and no script piece was involved.
I AM TRULY SORRY FOR THIS KIND OF A NECRO POST THING! But there´s one thing i don´t get, and that is why do you need to use a script snipplet to check if you can move the event? Wouldn´t it be simpler and simpler to check the ingore if can´t move box in the set move route?
That way it could be used unmodified in 2k/3...
I remember having some problems with that, that's why.
Ok. Sorry to bring this up...
Oh, I hadn't noticed that this was even here, Lol.
Good job instructing though.
Quote from: Calintz on June 30, 2009, 04:02:32 pm
Oh, I hadn't noticed that this was even here, Lol.
Good job instructing though.
what do you mean! have you never looked at the database guide I posted? I updated it by the way, but then again you know that.
lol to think that this was one of the very first things i learned to do with events, i did it the exact same way to