- Joined
- Mar 11, 2017
- Messages
- 10
- Reaction score
- 1
- First Language
- German
- Primarily Uses
- RMMV
Hi again,
I want to Alias "Game_CharacterBase.prototype.canPass", but doing so prevents the player from moving at all.
Original code:
Aliased version that doesn't work:
It seems to automatically return false, so the player can't move at all. The player can still turn around and everything but moving works.
I want to avoid overwriting. Any ideas?
I want to Alias "Game_CharacterBase.prototype.canPass", but doing so prevents the player from moving at all.
Original code:
PHP:
Game_CharacterBase.prototype.canPass = function(x, y, d) {
var x2 = $gameMap.roundXWithDirection(x, d);
var y2 = $gameMap.roundYWithDirection(y, d);
if (!$gameMap.isValid(x2, y2)) {
return false;
}
if (this.isThrough() || this.isDebugThrough()) {
return true;
}
if (!this.isMapPassable(x, y, d)) {
return false;
}
if (this.isCollidedWithCharacters(x2, y2)) {
return false;
}
return true;
};
Aliased version that doesn't work:
PHP:
var alias_Game_CharacterBase_canPass = Game_CharacterBase.prototype.canPass;
Game_CharacterBase.prototype.canPass = function(x, y, d) {
alias_Game_CharacterBase_canPass.call(this,x,y,d);
};
It seems to automatically return false, so the player can't move at all. The player can still turn around and everything but moving works.
I want to avoid overwriting. Any ideas?