Hello,
I'm trying to create a simple teleportation script that allows the player to instantly move a certain amount of tiles into the direction they are facing.
Setup is, I have a common event that keeps listening for the button 'T' to be triggered. When that happens, it calls a plugin command which is supposed to call the teleport function.
The teleport function is
The function for the plugin commands is
When pressing 'T' in the game, it says "ReferenceError - characterTeleport is not defined" and refers to the line I commented. I'm rather certain the syntax is correct. I assume maybe the Game_Interpreter can't call a Game_Character function? Or am I just too stupid to call a function?
I'm trying to create a simple teleportation script that allows the player to instantly move a certain amount of tiles into the direction they are facing.
Setup is, I have a common event that keeps listening for the button 'T' to be triggered. When that happens, it calls a plugin command which is supposed to call the teleport function.
The teleport function is
Code:
Game_Character.prototype.characterTeleport = function(){
this.setThrough(true);
this.setBlendMode(1);
this.setMoveSpeed(6);
this.setMoveFrequency(5);
for(var i=0; i<tpRange; i++){
this.moveStraight(tpDirection);
}
this.setThrough(false);
this.setBlendMode(0);
this.setMoveSpeed(4);
this.setMoveFrequency(3);
}
The function for the plugin commands is
Code:
var _raen_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args){
_raen_Game_Interpreter_pluginCommand.call(this, command, args);
if(command === 'TeleportCharacter') characterTeleport(); //this is where the 'undefined' occurs
}
When pressing 'T' in the game, it says "ReferenceError - characterTeleport is not defined" and refers to the line I commented. I'm rather certain the syntax is correct. I assume maybe the Game_Interpreter can't call a Game_Character function? Or am I just too stupid to call a function?