Need Addon for a GALV plugin

Discussion in 'JS Plugin Requests' started by JulioManeiiro, May 18, 2019.

  1. JulioManeiiro

    JulioManeiiro Warper Member

    Messages:
    3
    Likes Received:
    0
    Location:
    Rio de Janeiro
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Hello everyone!

    I'm using a great GALV (Move Route Extras) plugin, but I've noticed some possibilities that can be added (because I'm really needing a lot for my project).

    I wonder if there is a possibility that when an event is in the ID of Region 4, it is moved to the Right or to the Left or Up or Down as many times as necessary.
    Like the random-move script command below:
    this.step_rand (id, id, id);

    Examples of how scripts can be:

    this.step_left (id, id, id, x);
    this.step_right (id, id, id, x);
    this.step_up (id, id, id, x);
    this.step_down (id, id, id, x);

    x = The "x" can refer to the number of times the event will move in that direction.

    id = The "id" refer to REGION ID.

    I talked to Galv through a page from a social network, and he told me he did not have enough time to add these functions as they are busy with work.
    So I talked to him about the possibility of requesting an Addon for the plugin in some forum, and he told me that I can.

    Could someone please please create an Addon from the Galv plugin and add these functions because I really need the addition of these commands because this would make my project more fluid and I would not need to use many and many variables in my project.
     
    Last edited: May 18, 2019
    #1
  2. Magnus0808

    Magnus0808 Software Developer Veteran

    Messages:
    90
    Likes Received:
    87
    First Language:
    Danish
    Primarily Uses:
    RMMV
    Here you go :)
    I changed the script command to be this.step_down (x, id, id, id); (since that made the coding much easier)
    As requested it allows the user to step out of the region, but it will only be triggered if it is in the region.

    If you encounter any problems or it does not work as imagined feel free to message me :)

    Code:
    //=============================================================================
    // GALV Move Route Extras - Step Directions Extension
    // MRP_GALV_MoveRouteExtras_StepDirections.js
    // By Magnus0808 || Magnus Rubin Peterson
    //=============================================================================
    
    /*:
     * @plugindesc Extension to GALV Move Route Extras. Adds directions for the step
     * command
     * @author Magnus0808
     *
     * @help Adds the following options:
     *      * this.step_right(x, id, id, id);
     *      * this.step_left(x, id, id, id);
     *      * this.step_up(x, id, id, id);
     *      * this.step_down(x, id, id, id);
     * Where x = the amount of steps and id = the region id.
     */
    
     var Imported = Imported || {};
     Imported.MRP_GALV_MoveRouteExtras_StepDirections = true;
     
     var MRP = MRP || {};
     MRP.MRP_GALV_MoveRouteExtras_StepDirections = MRP.MRP_GALV_MoveRouteExtras_StepDirections ||{};
     
    (function() {
        
        Game_Character.prototype.step_repeat_start_index = 0;
        
        Game_Character.prototype.step_direction = function(x, d, args) {
            if(!this.step_repeats || this.step_repeats <= 0) {
                var region_test = false;       
                for (var j = 1; j < args.length; j++) {
                    if (args[j] === $gameMap.regionId(this.x, this.y)) {
                        region_test = true;
                        break;
                    };
                };
                if (!region_test) return false;
                this.step_repeat_begin(x+1);
            }
            var x2 = $gameMap.roundXWithDirection(this.x, d);
            var y2 = $gameMap.roundYWithDirection(this.y, d);       
            if (!$gameMap.isValid(x2, y2)) {
                this.step_repeats = 0;
                return false;
            }
            if (this.canPass(this.x, this.y, d)) {
                this.moveStraight(d);
            };
            this.step_repeat_end();
        };
        
        Game_Character.prototype.step_repeat_begin = function(times) {
            this.step_repeats = times - 1;
            console.log(this._moveRouteIndex);
            this.step_repeat_start_index = this._moveRouteIndex - 1;
        };
    
        Game_Character.prototype.step_repeat_end = function() {
            this.step_repeats -= 1;
            if (this.step_repeats > 0) {
                this._moveRouteIndex = this.step_repeat_start_index;
            };
        };
        
        Game_Character.prototype.step_right = function(x) {
            var d = 6;   
            this.step_direction(x, d, arguments);
        };   
        
        Game_Character.prototype.step_left = function(x) {
            var d = 4;
            this.step_direction(x, d, arguments);
        };
        
        Game_Character.prototype.step_up = function(x) {
            var d = 8;
            this.step_direction(x, d, arguments);
        };
        
        Game_Character.prototype.step_down = function(x) {
            var d = 2;
            this.step_direction(x, d, arguments);
        };
            
    })();
     

    Attached Files:

    Last edited: May 18, 2019
    #2
    JulioManeiiro and caethyril like this.
  3. JulioManeiiro

    JulioManeiiro Warper Member

    Messages:
    3
    Likes Received:
    0
    Location:
    Rio de Janeiro
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Magnus !!!
    You're awesome, thank you very much for working on the plugin, soon I'll do the right tests and if there is any problem, I'll send you a message!

    (Please do not close the thread yet, so in case there are future updates to the plugin, it will be posted here so someone else can use it as well).
     
    #3
  4. Magnus0808

    Magnus0808 Software Developer Veteran

    Messages:
    90
    Likes Received:
    87
    First Language:
    Danish
    Primarily Uses:
    RMMV
    Sorry I am actually really tired so it was buggy. I have fixed it now :)
    My original reply have been edited.

    EDIT: BTW I should note that when using step_right etc. it does NOT work with repeat_begin. If you need it to please tell me and I'll make it work.

    EDIT: I decided to make it work with repeat_begin anyway. Edited original reply.
     
    Last edited: May 18, 2019
    #4
    JulioManeiiro likes this.
  5. JulioManeiiro

    JulioManeiiro Warper Member

    Messages:
    3
    Likes Received:
    0
    Location:
    Rio de Janeiro
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Hii Magnus!!

    You're awesome, thank you very much for working on the plugin and your patience!!
    Your plugin work great now, after your make "repeat_begin" option work.
     
    #5

Share This Page