Hi Rpg Maker Community. Ive got only a couple of months under my belt of c# programming with Unity. Things is i've used rpg maker vx ace 1-2 years ago to try up sideview battle poses and things alike but now i am into trying to get a hack and slash game going with Quasi's pluggins. Also I am trying to jump right into scripting but it's different than what I am used to do in Unity. Is it possible to pass an argument to another function just like we do in Unity C#? for example in Unity I would do:
Vector3 playerPos;
Vector3 enemyPos;
Vector3 distanceToEnemy;
public Transform Player;
public Transform Enemy;
void Start()
{
playerPos = transform.position;
getDistance(playerPos);
}
void getDistance(Vector3 playerPos)
{
enemyPos = Enemy.transform.position;
Vector3 distanceToEnemy = playerPos - enemyPos ;
Debug.Log(distanceToEnemy);
}
How do I translate that do Rpg Maker MV Javascript Scripting lol
(function () {
Game_Player.prototype.locate = function (x, y) {
Game_Character.prototype.locate.call(this, x, y);
var actorX = $gamePlayer.x;
var actorY = $gamePlayer.y;
getPos(actorX,ActorY);
};
})();
(function getPos(actorX, ActorY) {
Game_Event.prototype.initialize = function (mapId, eventId, actorX, ActorY) {
Game_Character.prototype.initialize.call(this, actorX, ActorY);
this._mapId = mapId;
this._eventId = eventId;
var array = [];
array.push(eventId);
if ((eventX - actorX) <= 1 && (eventX - actorX) >= -1 && (eventY - actorY) <= 1 && (eventY - actorY) >= -1) {
console.log(this._eventId);
};
}
})();
The thing is I don't know how to pass an argument from function to function so in this example I cant access actorX and ActorY from the getPosfunction and can't access this._eventId from the first function. I am a bit confused here. In Unity C# it is so easy to do.