RPG Maker Forums

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.

Latest Threads

Latest Posts

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,470
Members
137,821
Latest member
Capterson
Top