Galv’s Jump Ability V.1.6

Demo – Version 1.6 >

#------------------------------------------------------------------------------#
#  Galv's Jump Ability
#------------------------------------------------------------------------------#
#  For: RPGMAKER VX ACE
#  Version 1.6
#------------------------------------------------------------------------------#
#  2013-06-02 - Version 1.6 - fixed a bug with region block jumping
#  2013-03-14 - Version 1.5 - fixed priority bug when jumping behind things
#                           - cleaned up code a bit
#  2013-01-15 - Version 1.4 - added follower jumping
#  2013-01-11 - Version 1.3 - added ability to make event pages block jumping
#  2012-12-05 - Version 1.2 - fixed some more bugs
#  2012-11-30 - Version 1.1 - fixed jumping in vehicles bug
#  2012-11-29 - Version 1.0 - release
#------------------------------------------------------------------------------#
#  This script allows the player to jump with the press of a button. The player
#  will jump as far as their max distance will take them without landing on a
#  blocked tile. Use regions to block players jumping completely to prevent the
#  player from doing things like jumping between rooms.
#------------------------------------------------------------------------------#
#  INSTRUCTIONS:
#  Put script under Materials and above Main
#  Read options and settings below.
#------------------------------------------------------------------------------#
 
#------------------------------------------------------------------------------#
#  COMMENT FOR EVENT (Must be first event command)
#------------------------------------------------------------------------------#
#
#  <block>
#
#  add this comment as the first event command of a page to make it unable to
#  be jumped over. Change the page to a new event page without the comment when
#  you want it to be jumpable.
 
#------------------------------------------------------------------------------#
#  NOTETAG FOR ACTORS, ARMORS, WEAPONS
#------------------------------------------------------------------------------#
#
#  <jump_bonus: x>        # Adds that many tiles to jump distance
#
#------------------------------------------------------------------------------#
#  Only the jump bonus for the party leader and his/her equips are calculated
#------------------------------------------------------------------------------#
#  SCRIPT CALL:
#  You can change an actor's jump bonus (that was set with the notetag) during
#  the game with a script call:
#
#  jump_bonus(actor_id,jump_bonus)
#
#  EXAMPLE:
#  jump_bonus(3,2)         # Changes actor 3's jump bonus to 2
#------------------------------------------------------------------------------#
 
($imported ||= {})["Galvs_Jump_Ability"] = true
module Galv_Jump
   
#------------------------------------------------------------------------------#
#  SCRIPT SETUP OPTIONS
#------------------------------------------------------------------------------#
   
  DISABLE_SWITCH = 1         # Cannot jump when this switch is ON
   
  BUTTON = :X                # Button to press to jump. :X is "a" key.
   
  DEFAULT_DISTANCE = 2       # Distance player can jump with no bonuses
  SPRINT_BONUS = 1           # Distance increased with a running jump
   
  JUMP_SE = ["Jump2", 50, 120]
   
  MAX_JUMP_BONUS = 3         # The maximum bonus you can get from equips/actors
   
  NO_JUMP_REGIONS = [1,2,3]  # Region ID's that the player cannot jump over
 
#------------------------------------------------------------------------------#
#  END SCRIPT SETUP OPTIONS
#------------------------------------------------------------------------------#
 
end
 
class RPG::BaseItem
  def jump_bonus
    if @jump_bonus.nil?
      if @note =~ /<jump_bonus: (.*)>/i
        @jump_bonus = $1.to_i
      else
        @jump_bonus = 0
      end
    end
    @jump_bonus
  end
end # RPG::BaseItem
 
 
class Game_Player < Game_Character
  attr_accessor :priority_type
   
  alias galv_jump_player_initialize initialize
  def initialize
    galv_jump_player_initialize
    @jump_equip_bonus = 0
  end
 
  alias galv_jump_player_refresh refresh
  def refresh
    get_jump_equip_bonus
    galv_jump_player_refresh
  end
   
  def get_jump_equip_bonus
    bonus = 0 + $game_party.leader.jump_bonus
    $game_party.leader.equips.each { |eq| bonus += eq.jump_bonus if !eq.nil?}
    @jump_equip_bonus = [bonus,Galv_Jump::MAX_JUMP_BONUS].min
  end
   
  alias galv_jump_move_by_input move_by_input
  def move_by_input
    return if jumping?
    @priority_type = 1 if !jumping?
    galv_jump_move_by_input
    if !$game_switches[Galv_Jump::DISABLE_SWITCH] && Input.trigger?(Galv_Jump::BUTTON)
      do_jump if !$game_map.interpreter.running? && !jumping? && normal_walk?
    end
  end
   
  def do_jump
    get_bonuses
    @distance = Galv_Jump::DEFAULT_DISTANCE + @jump_bonus
    check_region
    check_distance
    if @can_jump
      RPG::SE.new(Galv_Jump::JUMP_SE[0], Galv_Jump::JUMP_SE[1], Galv_Jump::JUMP_SE[2]).play
      jump(@jump_x, @jump_y)
      @followers.each { |f| f.jump(@x - f.x, @y - f.y) }
    end
  end
   
  def get_bonuses
    @jump_bonus = 0 + @jump_equip_bonus
    @jump_bonus += Galv_Jump::SPRINT_BONUS if dash? && moving?
  end
   
  def check_region
    @max_x = 0
    @max_y = 0
    case @direction
    when 2
      @max_y = @distance
      (@distance+1).times { |i| return @max_y = i if stopper?(@x, @y+i+1) }
    when 4
      @max_x = -@distance
      (@distance+1).times { |i| return @max_x = -i if stopper?(@x-i-1, @y) }
    when 6
      @max_x = @distance
      (@distance+1).times { |i| return @max_x = i if stopper?(@x+i+1, @y) }
    when 8
      @max_y = -@distance
      (@distance+1).times { |i| return @max_y = -i if stopper?(@x, @y-i-1) }
    end
  end
   
  def stopper?(x,y)
    Galv_Jump::NO_JUMP_REGIONS.include?($game_map.region_id(x,y)) ||
      !$game_map.stopper_event?(x,y)
  end
   
  def canpass?(x,y)
    map_passable?(x, y, @direction) && 
    $game_map.blocking_event?(x,y) ||
    Galv_Jump::NO_JUMP_REGIONS.include?($game_map.region_id(x,y))
  end
   
  def check_distance
    @jump_x = 0
    @jump_y = 0
    ch = []
    @can_jump = true
 
    case @direction
    when 2
      @jump_y = @distance
      @distance.times { |i| ch << @jump_y - i if canpass?(@x, @y + @jump_y - i) }
      ch.delete_if {|x| x > @max_y }
      @jump_y = ch.max if !ch.empty?
    when 4
      @jump_x = -@distance
      @distance.times { |i| ch << @jump_x + i if canpass?(@x + @jump_x + i, @y) }
      ch.delete_if {|x| x < @max_x }
      @jump_x = ch.min if !ch.empty?
    when 6
      @jump_x = @distance
      @distance.times { |i| ch << @jump_x - i if canpass?(@x + @jump_x - i, @y) }
      ch.delete_if {|x| x > @max_x }
      @jump_x = ch.max if !ch.empty?
    when 8
      @jump_y = -@distance
      @distance.times { |i| ch << @jump_y + i if canpass?(@x, @y + @jump_y + i) }
      ch.delete_if {|x| x < @max_y }
      @jump_y = ch.min if !ch.empty?
    end
    if ch.empty?
      @jump_y = 0
      @jump_x = 0
      @can_jump = false
    end
  end
   
  def jump(x_plus, y_plus)
    @priority_type = 1.5
    super
  end
end # Game_Player < Game_Character
 
 
class Game_Map
  def blocking_event?(x,y)
    events_xy(x,y).each { |e| return false if e.priority_type == 1 }
     return true
   end
 
  def stopper_event?(x,y)
    events_xy(x,y).each { |e|
      next if e.list.nil?
      return false if e.list[0].code == 108 && e.list[0].parameters[0] == "<block>"
    }
     return true
   end
end # Game_Map
 
 
class Game_Actor < Game_Battler
  attr_accessor :jump_bonus
   
  alias galv_jump_actor_initialize initialize
  def initialize(actor_id)
    galv_jump_actor_initialize(actor_id)
    @jump_bonus = $data_actors[actor_id].jump_bonus
  end
end # Game_Actor < Game_Battler
 
 
class Scene_Menu < Scene_MenuBase
  def return_scene
    $game_player.refresh
    super
  end
end # Scene_Menu < Scene_MenuBase
 
class Game_Interpreter
  def jump_bonus(actor,bonus)
    $game_actors[actor].jump_bonus = bonus
    $game_player.refresh
  end
end # Game_Interpreter
Advertisements

105 thoughts on “Galv’s Jump Ability V.1.6

  1. Andrian Is the Best says:

    Why it says “invalid octal digit:008 # 2012-11-30 – Version 1.1…” i don’t understand it

    • Galv says:

      You are copying the line numbers from the script. When you mouse-over the script box, some buttons will appear in the top right. One of them allows you to copy the script when you click it.

      • poopoppooppooppoewopsdop says:

        hey galv i need your help i keep getting line 242 type error occurred undefined superclass scene_menubase

      • poopoppooppooppoewopsdop says:

        the link you give me did not fix the error i copy all of the script. in i did not copy the numbers line. the script keep getting line 242 type error occurred undefined superclass scene_menubase

      • Galv says:

        One of the steps in the link I gave you was to test for other script incompatibilities. I believe another script you are using with this one is causing the error.

      • poopoppooppooppoewopsdop says:

        I have no special script in my game all i have is regular script for the game

      • Galv says:

        The script is working fine in a default project for me.
        Checking the steps in that error trapping list I sent you should have lead you to the problem if you followed them.

        As you are saying it did not solve your problem, I am sorry I have no idea how to help you.

      • poopoppooppooppoewopsdop says:

        Is this script for rpgmaker vx or rpgmaker vx ace

      • Galv says:

        Are you serious?

        You told me you checked everything on the list I sent you. One of the points on the list is (copy pasted here)
        2. Is the script for the correct RPGMaker?
        Most of the time a script will say if it was written for a certain RPGMaker. For example, there’s a good chance a script written for RPGMaker VX will not work in RPGMaker VX Ace.

        Now, if you REALLY checked the list – you would have answered this question already.
        At the top of my site and every page, it says “My RPGMaker VX Ace script archive”.
        At the top of every script I have written under the script name it says “For: RPGMAKER VX ACE”.

        I’m sorry to sound rude but I tried to help you and you obviously ignored my help. I can not help you if you lie to me and don’t follow my suggestions.

      • poopoppooppooppoewopsdop says:

        OH I sorry man i did not no i was act very stupid i did not read the script….. but thx for help me bro you are the best and i will sorry

      • Is it possible to change the character graphic while they jump? I’m doing a Mario game, so it would make all the difference if you could.

      • Galv says:

        Not without a change to the script and I don’t have time to do requests at the moment

      • Please update me when you are taking requests again. :) I’m patient.

      • Sorry Galv, for bothering you again, but as I’ve said before, I am making a Mario fan game and I currently have chests’ sprites set as “?” Blocks from Mario. I was wondering if there was a way of jump under them to open them rather than normally interacting with it.

      • Galv says:

        Not with this script without modifications. It is written for rpgmaker engine and not a 2D sidescroller. Sorry, I don’t have time to do requests

  2. zalerinian says:

    When you jump, followers in your party won’t follow you and will only catch up to you if you move. Is there any way to fix that?

    Example: http://i.imgur.com/XivpB.png

    • Galv says:

      I can’t think of and don’t know how to make followers jump effectively with the player. It was designed for no followers I’m afraid.

      • zalerinian says:

        Alright, well, thanks for the response. I love your scripts, using a few for a game I’m putting together.

  3. Galv says:

    I added ability for followers to jump now

  4. Galv says:

    Why do you want to add a pause between jumps? I feel adding a pause would be clunky

    • zalerinian says:

      because holding onto the jump button just continuously jumps :/ I was hoping to add a pause before you’re allowed to jump again, not pause the whole game.

      • Galv says:

        Oh? Maybe you have conflicting script somewhere as it shouldn’t continuously jump. I just double checked and it doesn’t for me.

  5. zalerinian says:

    I fixed it. I’m using Fomar’s keyboard input script and I had trouble getting it to work at first, so I had replaced the Input.trigger? with his custom call (Keyboard.trigger?) which just kept jumping continuously. I should have tried looking at that :/, sorry. All is well now.

  6. Yayapipi Goh says:

    how to see the effect of ability for followers to jump?

  7. Gamrad says:

    I’m so sorry for not completely understanding the script or instructions, but I have a scene in where I have a bridge and I have events that call up so that when you are walking up stairs to reach the bridge, you can’t fall of off the tiles and when you go down the stairs, you are able to walk underneath it. My problem is that I want to add an event that would change the script so that you can still jump, but not off the bridge, in the case, up or down the tiles.

    • Galv says:

      Well, I don’t know how you have set that up, but the script offers two ways to block the player jumping.
      Regions. And events with a comment in them.

      If you can use events with the comment to do the blocking, you can change the event’s page to one that doesn’t block and back to one that does.

      • Preston Feagan says:

        Hi Galv! Loving the script so far, but I’m running into an issue – blocking with comments isn’t working and I really have no idea how to use regions. Halfway done with my game (5 hours of gameplay so far) and haven’t needed them, so… Found this and thought it would be a super cool feature and was going to work it into prior levels. However, I can’t seem to make it so you CAN’T jump over things, even with your instructions.

        But maybe I’m an idiot. Totally possible.

        Just to clarify, to make something “unjumpable” you add a single event on a black with the comment , correct? Because if I’m not doing it wrong, I’m kinda frustrated. And I suppose I’ll have to learn regions.

      • Preston Feagan says:

        Hey! I really am an idiot. I see you put in certain regions that players can’t jump over!

        Except that doesn’t work for me either. He still hops right over. :(

      • Galv says:

        Take a look at the demo to see if you are doing it right.
        Also here’s a list of error trapping things you can do:
        https://galvs-scripts.com/errors-using-scripts/

  8. Gamrad says:

    Yes! The comment eventing will be great! I would most likely do that one! Except… how would I do it with this script? Sorry once again, I am clueless (for now) ;D Thanks too!

    • Galv says:

      How to do it is in the script instructions. If they don’t make sense to you, please download the demo (I just uploaded the most recent version into the demo) and look at the top right npc event.

  9. Gamrad says:

    Ok, I have already tried looking in the instructions but go confused (probably because it’s a late night), but I will make sure to check out the demo! I also just thought of another cool eventing solution. Thank you so much! Kind regards.

  10. Ellen says:

    Too bad this isn’t compatible with Victor’s Pixel Movement script >< wah. Do you have any plans for compatibility?

  11. Ellen says:

    He has one, but not one that allows jumping “over” gaps like yours. :\ That’s a pity. Thanks anyway.

  12. Brandon says:

    Sorry for bothering today but i cant get the jump working. Line 111: NoMethodError
    undefined method ‘jump_bonus’ for nil: NilClass

  13. kibagami says:

    hello Galvs, i used your script but can’t find a way to correctly disable jump by the function “DISABLE_SWITCH = 1” when i am walking in differents map could you advise me ?

    here is what i tried :
    1 – add “DISABLE_SWITCH = 1” on map notes
    2 – create an event on the concerned map with a script inside contening “DISABLE_SWITCH = 1”
    3 – try to figure out how to create an instance “Jump” then “No Jump”

    but i believe that i should be wrong somewhere, would you give me some help ?

    • Galv says:

      DISABLE_SWITCH = 1 is the settings. You choose which switch you want to use.
      In an event you would use ‘Control Switches’ and turn the switch you set ON there.

  14. kibagami says:

    hi, thank you for your answer, i spent all yesterday evening and night to find out how to disable switches as you said, but unfortunatly i didn’t succeed. hope to find a way this week end.

  15. kibagami says:

    sorry but i still don’t get it, would you update your demo by inserting a way to disable jump maybe ? that should help me and others

    • Galv says:

      Sorry, I don’t have time to do that. I recommend looking up some rpgmaker tutorials on how to use switches.
      It’s an event command. ‘Control Switches’. Turn switch ON.

  16. Kira Kira says:

    chrome says the demos are malicious…

  17. kibagami says:

    in fact the way looks really simple to do, but i’ve not been able to make it work, still searching, also i understand your point about time, it’s ok i will try to find it by myself

  18. Mireneye says:

    Galv I’m using Falcao’s ABS scripts. If a player that is not the main party member it seems any in the party (followers) dead bodies follow you and kind of magnetically jump all the way to you whenever you jump. I’m thinking of how to patch this because it really does not make sense at all. The dead party character should stay in place on ground until he/she/it regain it’s hp.

    Any ideas?

    • Galv says:

      The script wasn’t written for ABS so a patch will be needed. I don’t have time to do patches, though, sorry – could ask in a forum to see if someone else will

  19. Mireneye says:

    Thanks for the fast reply tho! much appreciated. I will turn to the awesome forum community to see if I can get some direction on the matter.

    Thanks for your time and I wish you luck!

  20. How do I change the keys, say to the space bar?

    • Galv says:

      Press F1 while playing your game. Go to keyboard controls. See which buttons relate to which keys you can use by default.

      Spacebar is the interact button so that might not work well

  21. yekim says:

    setting regions doesn’t work my character jumps on tiles set as region 1 and also walking on them evan tho they’re set to x

  22. yekim says:

    well i tried setting the tiles with regions 1, 2, and 3 and it did nothing.

  23. yekim says:

    is there another way to prevent character from jumping on tiles

  24. Rich says:

    It’s a shame you can’t do compatibility with ABS! I plugged in the script but it seems that I can jump past blocked off areas and even into things (like trees and buildings) — weird
    :\

    • Galv says:

      ABS’ rewrite a lot of how the game works. I made this script for the default maker without a script I have never seen before that someone else I never met before wrote.
      I don’t know why you think it’s weird or why you feel the need to tell me what I can’t do.

      I give my scripts to people for free and don’t take kindly to people such as yourself thinking I should do something more for them when I don’t get paid for this.

      Doesn’t work for you? Please don’t use it.

  25. Hypnotic Paradox says:

    Actually I tried this with XAS v0.6 plus Moghunter’s Simple Anti Lag v2.0, and it worked fine. Thanks Galv, for this awesome script!

  26. I’m getting the error unexpected tIDENTIFIER, expecting keyword_end
    …ABLE_SWITCH = 0 #cannot jump when this swit…
    What do I do?

  27. Hi, the scrip work fine thanks but I have a problem the jum bonus only work after player with the equip, change to second and put it at first party member again. how can i change that?

  28. Saro0fdemons says:

    Script ‘Galv jump’ line 111: TypeError occurred.
    nil can’t be coerced into fixnum
    I hit the jump button, I dash forward. I hit the menu button and this error pops up and the game crashes. I don’t know if it is a bug or if I am just an idiot. it is probably because I am an idiot.

    • Galv says:

      Make sure you start a new game after adding the script. I believe that error is appearing because your lead actor doesn’t have jump bonus defined (which happens when starting a new game with the script installed)

  29. Hafizh says:

    How to jump with animation?

  30. KaiSSeR_SK says:

    Hi!

    The script works perfectly, but I want to make a request… Can you modify it so to jump in one direction need to press the key of that direction, but, if only press the jump button, jump on site (x0, y0)??

    Thanks so much and excuse my terrible english.

  31. KaiSSeR_SK says:

    Ok, thanks :)

  32. KaiSSeR_SK says:

    Hi again! Escuse for doble post but i can´t find edit option… :S

    Although I´m not scripter, i´ve made the modification…

    Starts at line 179. Replace the case @direction with this one if you want my request:

    case @direction
    when 2
    if Input.press?(:DOWN)
    @jump_y = @distance
    else
    @jump_y = 0
    end
    @distance.times { |i| ch < @max_y }
    @jump_y = ch.max if !ch.empty?
    when 4
    if Input.press?(:LEFT)
    @jump_x = -@distance
    else
    @jump_x = 0
    end
    @distance.times { |i| ch << @jump_x + i if canpass?(@x + @jump_x + i, @y) }
    ch.delete_if {|x| x < @max_x }
    @jump_x = ch.min if !ch.empty?
    when 6
    if Input.press?(:RIGHT)
    @jump_x = @distance
    else
    @jump_x = 0
    end
    @distance.times { |i| ch < @max_x }
    @jump_x = ch.max if !ch.empty?
    when 8
    if Input.press?(:UP)
    @jump_y = -@distance
    else
    @jump_y = 0
    end
    @distance.times { |i| ch << @jump_y + i if canpass?(@x, @y + @jump_y + i) }
    ch.delete_if {|x| x < @max_y }
    @jump_y = ch.min if !ch.empty?
    end

  33. Hey there your demo say use ‘a’ to jump but its the ‘v’ key to jump, if you mean a as in the a input this should be made more clear for new comers.

    • Also what is your rules on this script ? is it free for all to use for free and communal games ?

    • Galv says:

      This confuses me. Have changed your controls via the F1 command? As it is the ‘a’ key by default in the demo. Newcomers also have a help file that teaches them the input and buttons, I don’t see why I ‘should’ teach newcomers everything in a script I don’t charge anything for? :(

  34. Júnior says:

    Galv’s, it would be possible to allow this script jump only on certain maps? If yes, how could I do that?

  35. Yu says:

    Not to bother you, I’ve seen other comment about it.
    Im still getting the
    Script “JUMP” line 111: NoMethodError occured
    undefined method ‘jump_bonus’ for nil:NillClas

    I’ve installed it in my previous game and it worked.
    but now Im trying to reinstall it, nothing happens, just that error
    (I’ve done everything you said..)

  36. Arieko says:

    Im so srry to bother u but…
    It says
    Script “line 95: NameError occured
    unintialized constant Object::Game_Character

  37. kevin zimmerman says:

    Character jumps great for two maps after starting a new game, but after an event where i have the character automatically jumping backwards, I can no longer jump using the the A key as it did before.

    • Galv says:

      The script has a switch that when turned ON disables jumping. I think you used that switch in game. See the script settings, change it to a different switch.

  38. Davis says:

    So I notice in the test map you cant jump over the tree and scarecrows yet when I try that it doesn’t work for me. Why is that?

    • Galv says:

      In the script settings:
      NO_JUMP_REGIONS = [1,2,3] # Region ID’s that the player cannot jump over

      The tree and scarecrow in the demo have region 2 and 3 applied to them, preventing jumping over.

  39. anonymoose says:

    how do you put two actors in the bonus?

  40. Jeter says:

    Hi Galv, is there anyway to make the function “dash + jump = jump farther” more efficient and consistent? This is such a great, great function for gameplay. I’m testing it for half a hour now and if I’m playing a real game I would be having a hard time jumping farther to advance the game. Some time it’s works, some time it’s not.

    • Galv says:

      The reason why it doesn’t seem consistent currently is that RPG Maker is tile-based and the jump happens from the tile the character is on when they press the button.

      As soon as the character stops moving (hits impassible object/terrain) then they are no longer counted as sprinting for the sprint-jump. That’s usually where the odd bit is.

      Unfortunately I don’t have any plans to update this, though – but I imagine to fix I’d have to add a little timer that made the jump still count as sprinting for a short time after they stop.

  41. Porkate42 says:

    Hello.
    I got this script a long time ago and it worked wonders.
    However it seems it’s not compatible for Effectus. Sprint jump doesn’t function and the jump button sometimes does not work when standing still. I tried multiple things like tinkering with Effectus’ settings, however nothing seems to work.
    Here’s the script page http://rpgmakersource.com/ourproducts/effectus/
    However the script itself is $20 so I will understand if you cannot help me.
    Thank you and have a nice day.

  42. Where can you download the demo of this script?

  43. Darksoma says:

    I must say that I really like this script, but is it possible to make it so that whenever your character jumps, it turns On a switch, but when you land, it turns that switch back Off?

    • Galv says:

      Not without modifying the script. You could, however, if you want it for conditional branches use inside the conditional branch script:
      $game_player.jumping?
      To check if player is currently in the middle of a jump.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s