Auto-jump

Hi everyone!

I'm starting with RPG Maker by doing little mechanics, but I have lots of problems with jumping. I would like the player jumps automatically when he finds an obstacle. It works if the player arrives into the first event bc I stablish the jump if the player is looking down, but when the player is in the second event I couldn't return to the first position nor jump to the left.
All the info that I founded was related to a common event of jumping but I only want the character jumps in this situation. I hope there isn't necessary any scrip bc I'm learning little by little.
Thanks!

autojump.PNG
it works like in mv as for events related.
except the trigger calls are different (which I dont know so I leave them out)

make events with conditional brach: (dont place all 4 direction where NOT needed,
just the direction it can look too.

if: script: button press UP is triggered (dont have to be a scriptcall, but usefull)
player jumps UP (x += 0, y - =2) (minus can be + if going down)
end
if: script: button press DOWN
same as above, change y - to y +
end

same thing you do with LEFT and RIGHT and change x accordanly.
if you have a script to use more buttons like ASWD you can use those.

I dont know ruby, but the default buttons "RIGHT, LEFT, UP, DOWN, OK, CANCEL"
are there (if not that much different from MV). but this is the very basic
action of button press to jump in hte direction.

NOTE, if you want to use all 4 direction (which is more dynamic)
you can make a splash when they jump into the water and return to its precious
spot of restart from start.
I have reached this point triggering the event like a parallel event (for now I'll only allow to jump in some directions). However, a problem appears in two ways:
- If I don't put a delete event after the jump, the character continues jumping every time.
- If I put a delete event, It works fine only the first time, but if I return to the same tile I couldn't jump again =(

autojump2.PNG
a conditional trigger (specially with input is pressed, it jumps,
and not automatically (unless this is a 1-way path)

why it doesn't work is unknown, but do not use parallel process,
I think you need to set it to event touch or player touch (play with those)

player touch seems fitting, event touch = for player and events around it.
In your conditional branch, which I assume is in an event set to player touch, just use the jump command in the Set Route move command. No need for parallel process etc.
Do you really not need a parallel process? Some time ago I broke my head with this problem and for my solution I had to investigate about the $ game_map.passable? and combined - for my game mechanics - with $ game_map.eventid_xy method and 2 variables via script call.

because when you "land" on the second event (after you've jumped on the first one), it doesn't react to commands.

Correct me if I'm wrong.
Try this.

Put <jump> in the name of each event that's on a hoppable tile, then make a parallel process with the following code:

Code:
if Input.dir4 > 0
  jump_events = $game_map.events.values.select {|event| event.name =~ /<jump>/ }
  x1 = $game_player.x
  y1 = $game_player.y
  direction = Input.dir4
  x_mod = direction == 4 ? -2 : direction == 6 ? 2 : 0
  y_mod = direction == 8 ? -2 : direction == 2 ? 2 : 0
  x2 = $game_player.x + x_mod
  y2 = $game_player.y + y_mod
  event_under_player = $game_map.events_xy(x1, y1).any? {|event|
    jump_events.include?(event) }
  event_in_direction = $game_map.events_xy(x2, y2).any? {|event|
    jump_events.include?(event) }
  if event_under_player && event_in_direction
    $game_player.jump(x_mod, y_mod)
  end
end

Put a wait 10 frames after it to prevent overshooting too much.
@Thefirelion this is exactly my problem, when I land on the second event it doesn't react to any command unless with a parallel event (and the only way I found to stop the parallel event was using the erase event, with the problem that if you erase the event you can't use it again...)

@Trihan like this? Testing the game appears the next error (sorry if it is a basic fail, I'm noob using scripts...)

autojump4.PNG

autojump3.PNG
Yep. Weird that that's showing an error. Are you using any other scripts?
Nope, it is the first script that I try to use.
Is this script for RMVX or RMMV? I'm using RMVXAce (I don't know if this script can be use in both or no...)
It's for VX Ace.
You should be able to do something as simple as
1595622435005.png


Change the conditions for when the player is not able to jump one way or another.
And change the jump numbers for whatever distance you have to go.

If it is a stretch (jump, jump, jump, etc all in one direction for one move)
Then just repeat the jump command, with a wait 10 or higher in between.
You should be able to do something as simple as
View attachment 152583

Change the conditions for when the player is not able to jump one way or another.
And change the jump numbers for whatever distance you have to go.

If it is a stretch (jump, jump, jump, etc all in one direction for one move)
Then just repeat the jump command, with a wait 10 or higher in between.

That works great for a manual jump, but OP was asking for a way to do it automatically.
a way to do it automatically
That's why everyone was suggestion player touch.
I would agree. Player touch and then just do the move route.
It could works... But, instead of using action button trigger (Z), could I use the directional arrows (up, left, down, right) in each case? I don't know how to trigger an event in this way =(
@ShadowDragon mentioned it before, but I don't find that possibility in VX Ace without using scripts
I don't find that possibility
1595626353431.png


But then I think it would need to be parallel process
scratch that. Then it would apply everywhere on the map.
Needs to be player touch, I think
Yep, that's the problem. I don't know how a so simple action it's so difficult to solve natively without scripts ... Is there any native way to do these in RMMV?
I'm still trying to figure out why my code didn't work for you. It works perfectly on my end.
I'm still trying to figure out why my code didn't work for you. It works perfectly on my end.
I have tried with a new project but the same problem appears. Could someone else test it to see if I need to add something? Thanks to all for the help ^^
Did you just copy/paste exactly what I wrote?

BTW just noticed, don't put <jump> in the name of the parallel process event that contains the code. Keep that separate (like at the top left of the map or something) and put the tag in the tiles you want the player to jump from/to (they don't need any code in them, just the tag)

Original thread: https://forums.rpgmakerweb.com/threads/auto-jump.124444/