Condition events based on players direction of movement

youngwolf0

Warper
Member
Joined
Jul 24, 2013
Messages
3
Reaction score
0
First Language
English
Primarily Uses
Hi all,

This is my first post and I've only had rpg maker for a few days so please forgive any lack of knowledge on my part.

I have created a common event that is running as a parallel process, it checks if the user is pressing the z button and if they are enables the characters ability to glide over chasms.

I already have the glide event working, all I need is help triggering it properly.

I want this ability to require that the user be moving at the time the z button is pressed.  If they are standing still then nothing will happen.  If they are moving in any direction then they will glide forward for 5 blocks in the direction they were traveling.  This is why I can't have the event trigger on player touch at the chasms edge, I need it to be usable anywhere.

It would be even nicer if I could pick up if they were sprinting or not to make the glide go farther but that is not really required just now.

If this can only be done with scripting I'll need some help implementing it.  I am a php/java developer but I have never coded in ruby before so it is currently unfamiliar to me.

Any help you guys can offer would be great, thanks :)
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
You can use a script call in a condition (on the last tab).  You would be interested in these:

$game_player.moving?

$game_player.dash?

And you don't even need to detect their direction, as you can use a move route to move "forward".

So it might look something like this (untested, so you may need to tinker a bit):

Conditional Branch: Z button is pressed  Conditional Branch: Script: $game_player.moving?    Conditional Branch: Script: $game_player.dash?      Set Move Route (Player) (Skip if Can't Move) (Wait for Completion): Move forward                     Move forward                     Move forward                     Move forward                     Move forward                     Move forward                     Move forward                     Move forward    Else (not dashing)      Set Move Route (Player) (Skip if Can't Move) (Wait for Completion): Move forward                     Move forward                     Move forward                     Move forward                     Move forward    Branch End  Branch EndBranch EndWait 5 frames (to avoid lag - you don't need to check for the button being pressed 60 times a second)Note, though - this could cause an issue if you have cutscenes or any event that does a player move route - one move route will cancel out another that's running on the same character at the same time. It could also cause events to not trigger - if you have a 'player touch' event and the move route above makes the player go over that event and past it, the event will not trigger.Oh, and if you want them to 'glide' forward, you might want to add a Turn Walking Animation OFF at the start of the move routes, and Turn Walking Animation ON at the end of each one.
 
Last edited by a moderator:

youngwolf0

Warper
Member
Joined
Jul 24, 2013
Messages
3
Reaction score
0
First Language
English
Primarily Uses
Wow, thanks for replying so fast.  This solution worked perfectly :) .

The good thing is that I have a switch that I can use whenever I need to disable the ability so if there is any point it's interfering with things I can turn it off.

As for the walking animation thing I made a custom animation that appearers over the character that has him moving appropriately and I changed his sprite to a blank one during the animation.  The result looks pretty good though not perfect.

I have two more questions to do with this event but not sure if they should go in another post.  If so I'l move them.

1. The animation I use to replace my character for the duration of the glide seems to have some opacity and I want it to be solid.  I don't see this as an option in the animation creator and the sprite itself is defiantly solid.  Is this something I can fix?

2. I am also having trouble making the chasm only traversable while the glide is in progress.  My plan is that while gliding is in progress a switch is turned on, this is also used to trigger the animation and movement of the glide.  I wanted to put events at every edge of the chasm and have them going as auto run events.  

Page 1 has them set to priority same as player with a conditional switch set to flick self switch a when my glide switch is on.

Page 2 is the opposite and sets self switch a off when glide switch is off.

The thing is I cannot seem to make the chasm itself traversable at all so I get stuck on it no matter what.  I have tried to change it in the tile set editor where you can set the arrows to allow travel over tiles in certain directions with the arrows but they are only appearing over some tiles and the chasm is not one of them.  What am I doing wrong here?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
1. If the sprite itself is solid, then it should appear as solid, unless you've included something in the move route to change opacity. Since you didn't ask about it, I'm assuming you've done something elsewhere to change the sprite. Did you know that you can change the player's graphic (or that of any event) within the move route itself? So you could add a Change Graphic at the start and again at the end of each of those move routes, instead of relying on something else to do it for you. However, if you want to keep it the way you currently have it, post a screenshot of the event where you change the graphic, and we can see if there's anything that stands out there.


2. Having events along the edges of the chasm and having them as autorun events is really bad design. For one, you should only have ONE autorun event active on a map at once. Secondly, an autorun event will take control away from the player. Even parallel process events would not be suitable for this, as they don't require the player to touch them in order to activate, and again, having too many running at once will cause lag on your map. So I think you need to reconsider your design for this one. Post a screenshot of that part of the map, and edit it to add comments saying what you want to happen. I'm assuming you want something like, if the player approaches the chasm and is gliding at the time, they will glide to the other edge of the chasm and stop? If that's not it, you'll have to be a bit more descriptive, using images if possible. I'm thinking something like a single parallel process event, using regions, might be the way to go, but really need to know the exact details first.
 

youngwolf0

Warper
Member
Joined
Jul 24, 2013
Messages
3
Reaction score
0
First Language
English
Primarily Uses
I'm assuming you want something like, if the player approaches the chasm and is gliding at the time, they will glide to the other edge of the chasm and stop?
Yeah that's almost right though I would prefer it if the glide length is fixed and if the player misjudges it they fall in the chasm and re-spawn at it's edge (I can make an animation for this).

I will record a video of what's going on and put it up here later.  I'm at work just now so it won't be until the end of the day.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,083
Members
137,583
Latest member
write2dgray
Top