function.call doesn't work in my plugin

rpg_objects:
===========================================================================
Game_CharacterBase.prototype.isMapPassable = function(x, y, d) {
var x2 = $gameMap.roundXWithDirection(x, d);
var y2 = $gameMap.roundYWithDirection(y, d);
var d2 = this.reverseDir(d);
return $gameMap.isPassable(x, y, d) && $gameMap.isPassable(x2, y2, d2);
};
===========================================================================



my plugin :
===========================================================================
var _Game_CharacterBase_prototype_isMapPassable = Game_CharacterBase.prototype.isMapPassable;
Game_CharacterBase.prototype.isMapPassable = function(x, y, d){
_Game_CharacterBase_prototype_isMapPassable.call(this, x, y, d);
};
===========================================================================
it doesn't work!
player character can't move.




but if I change to this in my plugin :
===========================================================================
Game_CharacterBase.prototype.isMapPassable = function(x,y,d){
var x2 = $ gameMap.roundXWithDirection(x,d);
var y2 = $ gameMap.roundYWithDirection(y,d);
var d2 = this.reverseDir(d);
return $gameMap.isPassable(x,y,d)&& $gameMap.isPassable(x2,y2,d2);
};
===========================================================================
now it work...
player character is movable.
Hi!
This happens because the original function is returning a value.
And in your first attempt, you are not returning anything.

You have to do this:

JavaScript:
var _Game_CharacterBase_prototype_isMapPassable = Game_CharacterBase.prototype.isMapPassable;
Game_CharacterBase.prototype.isMapPassable = function(x, y, d){
const alias = _Game_CharacterBase_prototype_isMapPassable.call(this, x, y, d); // Here you are saving the original value
    // do your thing;
    return alias; // And here you are returning it :)
};
thank it work!

Original thread: https://forums.rpgmakerweb.com/threads/function-call-doesnt-work-in-my-plugin.122182/