Is there a way to change the jump speed?

● ARCHIVED · READ-ONLY
Started by JDevain 2 posts View original ↗
  1. To be clear, I'm talking about the speed that the player or event moves while jumping, so that the jump takes less or more time. The speed and frequency in Autonomous Movement doesn't seem to affect it.

    Thanks!

    EDIT: OK, so I messed around and came up with this a little plugin based on some code from rpg_objects.js:

    Code:
    Game_CharacterBase.prototype.jump = function(xPlus, yPlus) {
        if (Math.abs(xPlus) > Math.abs(yPlus)) {
            if (xPlus !== 0) {
                this.setDirection(xPlus < 0 ? 4 : 6);
            }
        } else {
            if (yPlus !== 0) {
                this.setDirection(yPlus < 0 ? 8 : 2);
            }
        }
        this._x += xPlus;
        this._y += yPlus;
        var distance = Math.round(Math.sqrt(xPlus * xPlus + yPlus * yPlus));
    //  this._jumpPeak = 10 + distance - this._moveSpeed; //original line
        this._jumpPeak = -10 + distance - this._moveSpeed; //my change
    
    //  this._jumpCount = this._jumpPeak * 2; //original line
        this._jumpCount = this._jumpPeak * 1.5; //my change
        this.resetStopCount();
        this.straighten();
    };

    Which seems to work for the most part. I mean the event will just SHOOT to its destination in a straight line, but sometimes the it sort of "overshoots" and lands a few pixels further out than usual, but then it slowly makes its way back, so I don't know what that's all about.

    EDIT #2: I've been messing around some more, and there is another issue, which is that if it's a long jump, it moves really fast, but with shorter jumps of 3 or 4 tiles, it moves really slowly.
  2. Yea, jumpPeak is the height and jumpCount is the duration (frames); if jumpCount is negative (i.e. if rectilinear distance is less than 10 + move speed) then you'll get teleportation. :kaoswt2:

    Try this instead (save as .js, import as plugin), just edit the 0.75 value as needed~
    Code:
    (function(alias) {
    
    	Game_CharacterBase.prototype.updateJump = function() {
    		this._jumpCount += 0.75;	// slow down by 75%
    		alias.call(this);		// do default stuff
    	};	
    
    })(Game_CharacterBase.prototype.updateJump);
    If you want the jump to go faster, change the plus to a minus, e.g.
    Code:
    		this._jumpCount -= 0.40;	// speed up by 40%
    Note this speed change, as-is, will stay constant throughout gameplay. :)