MV - Chrono Engine ABS: Help with hookshot/boomerang passing through walls etc

● ARCHIVED · READ-ONLY
Started by DTurtle 23 posts Page 1 of 2 View original ↗
  1. Maker version: MV
    Plugin: MOG Hunter Chrono Engine (ABS mode)

    Hello! Been running into this issue with MOG's Chrono Engine ABS where the hookshot and boomerang pass through wall tiles that are marked as impassable and also through regions IDs that are marked as impassable with YEP Region Restrict.

    Projectiles in the engine behaved the same way, but I was able to solve that by adding the following script:

    Code:
    var _mog_toolSys_gevent_updateSelfMovement = Game_Event.prototype.updateSelfMovement;
    Game_Event.prototype.updateSelfMovement = function() {
        if (this._tool.enabled && this.regionId() === 10) this.erase();
        if (this.needStopSelfMovement()) {return};
        _mog_toolSys_gevent_updateSelfMovement.call(this);
    };

    This erases the projectile when it hits region ID 10. Unfortunately, this does nothing to change the behavior of the hookshot and the boomerang.

    I've scoured through the code, and am not super great at JS, so I've been unable to come up with a solution.

    Has anyone else been able to erase/end the hookshot and boomerang when they reach impassable tiles, or can someone help point me in the right direction? thanks!
  2. if you check the demo, it doesn't go through walls but rather stop
    and give the length to go back to the player itself.

    if you build it from scratch with the plugin, you miss some crucial
    event data passing through them.

    most build the game out from the demo, because it works from there
    and not to forget, to reference to go back how its done or expend in
    your main maps where you need them :)
  3. ShadowDragon said:
    if you check the demo, it doesn't go through walls but rather stop
    and give the length to go back to the player itself.

    if you build it from scratch with the plugin, you miss some crucial
    event data passing through them.

    most build the game out from the demo, because it works from there
    and not to forget, to reference to go back how its done or expend in
    your main maps where you need them :)
    I've been building from the demo -- just downloaded a fresh version to test and it goes through walls there, too :/
  4. I test it, and it seems your correct, but also "this.erase()" does not exist,
    you can try to replace it with "return false;" instead and see if that works.
  5. DTurtle said:
    Maker version: MV
    Plugin: MOG Hunter Chrono Engine (ABS mode)

    Hello! Been running into this issue with MOG's Chrono Engine ABS where the hookshot and boomerang pass through wall tiles that are marked as impassable and also through regions IDs that are marked as impassable with YEP Region Restrict.

    Projectiles in the engine behaved the same way, but I was able to solve that by adding the following script:

    Code:
    var _mog_toolSys_gevent_updateSelfMovement = Game_Event.prototype.updateSelfMovement;
    Game_Event.prototype.updateSelfMovement = function() {
        if (this._tool.enabled && this.regionId() === 10) this.erase();
        if (this.needStopSelfMovement()) {return};
        _mog_toolSys_gevent_updateSelfMovement.call(this);
    };

    This erases the projectile when it hits region ID 10. Unfortunately, this does nothing to change the behavior of the hookshot and the boomerang.

    I've scoured through the code, and am not super great at JS, so I've been unable to come up with a solution.

    Has anyone else been able to erase/end the hookshot and boomerang when they reach impassable tiles, or can someone help point me in the right direction? thanks!

    Was this fate or something? I literally just finished accomplishing this for my game.
    Here's what you do:

    JavaScript:
    //==============================
    // * process Move Command Tool
    //==============================
    Game_Character.prototype.processMoveCommandTool = function(command) {
        if (this._tool.boomerang[0]) {
            if (this._tool.boomerang[1] > 0) {
                this._tool.boomerang[1]--;
                this.moveForward();
            } else {
                this.moveTowardCharacter(this._tool.user);
                this._tool.forcingMove = 2;
            };
        } else if (this._tool.hookshot.enabled) {
                  if (this.regionId() === 58) { // THIS HERE!
                      this.erase(); // AND THIS
                      this.moveTowardCharacter(this._tool.user); // AND THIS
            this._tool.forcingMove = 2; // AND THIS
                 } else {
            if (!this._tool.hookshot.locked) {
                this._directionFix = true;
                if (this._tool.hookshot.range > 0) {
                    this._tool.hookshot.range--;
                    this.moveForward();
                } else {
                    this.moveTowardCharacter(this._tool.user);
                    this._tool.forcingMove = 2;
                };
            } else {
                            this._tool.forcingMove = 2;
                    }
            };
        };
    };

    Replace "process Move Command Tool" section to have the commented parts I put in. This will make the hookshot stop in place when it hits a wall and then return to you like nothing happened.

    Oh and change the region ID to be whatever you want, since I use 58 on my maps.
  6. RCXGaming said:
    Was this fate or something? I literally just finished accomplishing this for my game.
    Here's what you do:

    JavaScript:
    //==============================
    // * process Move Command Tool
    //==============================
    Game_Character.prototype.processMoveCommandTool = function(command) {
        if (this._tool.boomerang[0]) {
            if (this._tool.boomerang[1] > 0) {
                this._tool.boomerang[1]--;
                this.moveForward();
            } else {
                this.moveTowardCharacter(this._tool.user);
                this._tool.forcingMove = 2;
            };
        } else if (this._tool.hookshot.enabled) {
                  if (this.regionId() === 58) { // THIS HERE!
                      this.erase(); // AND THIS
                      this.moveTowardCharacter(this._tool.user); // AND THIS
            this._tool.forcingMove = 2; // AND THIS
                 } else {
            if (!this._tool.hookshot.locked) {
                this._directionFix = true;
                if (this._tool.hookshot.range > 0) {
                    this._tool.hookshot.range--;
                    this.moveForward();
                } else {
                    this.moveTowardCharacter(this._tool.user);
                    this._tool.forcingMove = 2;
                };
            } else {
                            this._tool.forcingMove = 2;
                    }
            };
        };
    };

    Replace "process Move Command Tool" section to have the commented parts I put in. This will make the hookshot stop in place when it hits a wall and then return to you like nothing happened.

    Oh and change the region ID to be whatever you want, since I use 58 on my maps.
    beautiful, thank you!

    While I have you, have you managed to get character poses to produce a full animation? I swear it was working before, but now the standard melee attack only ever shows the last frame of the animation, even though the suffix is tagged (f3)(s3). If I start mashing Z it'll show the second frame every now and then :S
  7. DTurtle said:
    beautiful, thank you!

    While I have you, have you managed to get character poses to produce a full animation? I swear it was working before, but now the standard melee attack only ever shows the last frame of the animation, even though the suffix is tagged (f3)(s3). If I start mashing Z it'll show the second frame every now and then :S

    I wouldn't know because I don't use character poses. Currently, at least.
  8. RCXGaming said:
    I wouldn't know because I don't use character poses. Currently, at least.
    Gotcha. I kinda found a workaround where when attacking I set the pose to a transparent image, then have the attack image in the tool map be my chracter's sword swinging frames. It works unless you attack diagonally, in which case the attacking chracter rotates diagonally ;-; So close to making this engine actually usable.
  9. RCXGaming said:
    Was this fate or something? I literally just finished accomplishing this for my game.
    Here's what you do:

    JavaScript:
    //==============================
    // * process Move Command Tool
    //==============================
    Game_Character.prototype.processMoveCommandTool = function(command) {
        if (this._tool.boomerang[0]) {
            if (this._tool.boomerang[1] > 0) {
                this._tool.boomerang[1]--;
                this.moveForward();
            } else {
                this.moveTowardCharacter(this._tool.user);
                this._tool.forcingMove = 2;
            };
        } else if (this._tool.hookshot.enabled) {
                  if (this.regionId() === 58) { // THIS HERE!
                      this.erase(); // AND THIS
                      this.moveTowardCharacter(this._tool.user); // AND THIS
            this._tool.forcingMove = 2; // AND THIS
                 } else {
            if (!this._tool.hookshot.locked) {
                this._directionFix = true;
                if (this._tool.hookshot.range > 0) {
                    this._tool.hookshot.range--;
                    this.moveForward();
                } else {
                    this.moveTowardCharacter(this._tool.user);
                    this._tool.forcingMove = 2;
                };
            } else {
                            this._tool.forcingMove = 2;
                    }
            };
        };
    };

    Replace "process Move Command Tool" section to have the commented parts I put in. This will make the hookshot stop in place when it hits a wall and then return to you like nothing happened.

    Oh and change the region ID to be whatever you want, since I use 58 on my maps.
    So it turns out this doesn't work for me for whatever reason *thinking emoji*

    Would you mind sharing the event setup for your hookshot?
  10. DTurtle said:
    So it turns out this doesn't work for me for whatever reason *thinking emoji*

    Would you mind sharing the event setup for your hookshot?
    bandicam 2023-08-31 18-34-06-005.png

    They're nothing out of the ordinary.

    It's very likely that the code was incorrectly copied. So try to re-copy and replace the ENTIRE section of the code I put up earlier and not just the parts I highlighted.
  11. DTurtle said:
    So it turns out this doesn't work for me for whatever reason *thinking emoji*
    It likely doesn't work as is with CrossEngine/Altimit as that changes how the hookshot works.

    You could try turning off Altimit and CrossEngine to see if that fixes it, in which case it's a plugin incompatibility, or you might have to change the settings on the hookshot tool event page
  12. Yeah -- this fix doesn't work for the Cross Engine. Should have specified I was using that version. I applied the code to a demo Chrono Engine project and it worked, although it's a little jerky. Will have to think of an alternative function instead of the hookshot because it can't be pulling you through walls and the pixel movement is too good to give up.
  13. DTurtle said:
    Yeah -- this fix doesn't work for the Cross Engine. Should have specified I was using that version. I applied the code to a demo Chrono Engine project and it worked, although it's a little jerky. Will have to think of an alternative function instead of the hookshot because it can't be pulling you through walls and the pixel movement is too good to give up.
    I'll look at sometime next week wheb I have time. I'm thinking I could probably modify the arrow into a hookshot event.
  14. AquaEcho said:
    I'll look at sometime next week wheb I have time. I'm thinking I could probably modify the arrow into a hookshot event.
    That would be amazing and probably help so many people! I didn't even realize it was shooting/pulling through things until after building a bunch of test stuff and taking the hookshot onto a different map.
  15. DTurtle said:
    That would be amazing and probably help so many people! I didn't even realize it was shooting/pulling through things until after building a bunch of test stuff and taking the hookshot onto a different map.
    RCXGaming's script actually works when I tested it in Cross Engine in a new plugin file at the end of the plugin list. The only wonkiness is it takes several a couple seconds for the hookshot to return to the player after being blocked by the defined region tile (I'll see if I can fix that). I am using Gabiszon's hookshot settings here

    E: Ok, yeah, so RCXGaming and Cross Engine are both overwriting the same function, so I basically just need to combine them.

    E2: Could you try this in a plugin file at the bottom of your plugin list and see if there are any issues? Change the 58 to the region you want to block
    Code:
    Game_Character.prototype.processMoveCommandTool = function(command) {
        if (this._tool.boomerang[0]) {
            if (this._tool.boomerang[1] > 0) {
                this._tool.boomerang[1]--;
                this.moveForward();
            } else {
                this.moveTowardCharacter(this._tool.user);
                this._tool.forcingMove = 2;
            };
        } else if (this._tool.hookshot.enabled) {
        if(this.regionId() === 58){
          this.hookShotTink();
          this.erase(); // AND THIS
                      this.moveTowardCharacter(this._tool.user); // AND THIS
            this._tool.forcingMove = 2; // AND THIS
        }
            if (!this._tool.hookshot.locked) {
                this._directionFix = true;
                if (this._tool.hookshot.range > 0) {
                    this._tool.hookshot.range--;
                    this.moveForward();
                } else {
                    if (this._tool.forcingMove != 2)
                    {
                        //first time we change to retracting, increase speed
                        this._moveSpeed+=1;
                    }
                   
                    this.moveTowardCharacter(this._tool.user);
                    this._tool.forcingMove = 2;
                };
            } else {
                this._tool.forcingMove = 2;
            };
        };
    };
  16. AquaEcho said:
    RCXGaming's script actually works when I tested it in Cross Engine in a new plugin file at the end of the plugin list. The only wonkiness is it takes several a couple seconds for the hookshot to return to the player after being blocked by the defined region tile (I'll see if I can fix that). I am using Gabiszon's hookshot settings here

    E: Ok, yeah, so RCXGaming and Cross Engine are both overwriting the same function, so I basically just need to combine them.

    E2: Could you try this in a plugin file at the bottom of your plugin list and see if there are any issues? Change the 58 to the region you want to block
    Code:
    Game_Character.prototype.processMoveCommandTool = function(command) {
        if (this._tool.boomerang[0]) {
            if (this._tool.boomerang[1] > 0) {
                this._tool.boomerang[1]--;
                this.moveForward();
            } else {
                this.moveTowardCharacter(this._tool.user);
                this._tool.forcingMove = 2;
            };
        } else if (this._tool.hookshot.enabled) {
        if(this.regionId() === 58){
          this.hookShotTink();
          this.erase(); // AND THIS
                      this.moveTowardCharacter(this._tool.user); // AND THIS
            this._tool.forcingMove = 2; // AND THIS
        }
            if (!this._tool.hookshot.locked) {
                this._directionFix = true;
                if (this._tool.hookshot.range > 0) {
                    this._tool.hookshot.range--;
                    this.moveForward();
                } else {
                    if (this._tool.forcingMove != 2)
                    {
                        //first time we change to retracting, increase speed
                        this._moveSpeed+=1;
                    }
                 
                    this.moveTowardCharacter(this._tool.user);
                    this._tool.forcingMove = 2;
                };
            } else {
                this._tool.forcingMove = 2;
            };
        };
    };
    that works! amazing!

    There is one slight bug I'm noticing if a region has an opened space above it, if you send the hookshot from the bottom half of the tile (pic 1) it'll read the region correctly but if you stand on the top half of the tile (pic 2) it'll pass through the region. In those two pics, the walls are blocked off and the dirt/grass areas around them are open. However, if you're firing it into an area where there's a line of blocked regions (as opposed to a free space on top and a blocked one on bottom) then it'll stop just fine. There's a similar issue with the projectile stopping script in the opening post here where the projectile will stop at the specifed region but it'll pass through the first half of the region first.

    EDIT: Also, if the player sprite is overlapping a restricted region, then the hookshot doesn't fire at all (pic 3)
  17. DTurtle said:
    that works! amazing!

    There is one slight bug I'm noticing if a region has an opened space above it, if you send the hookshot from the bottom half of the tile (pic 1) it'll read the region correctly but if you stand on the top half of the tile (pic 2) it'll pass through the region. In those two pics, the walls are blocked off and the dirt/grass areas around them are open. However, if you're firing it into an area where there's a line of blocked regions (as opposed to a free space on top and a blocked one on bottom) then it'll stop just fine. There's a similar issue with the projectile stopping script in the opening post here where the projectile will stop at the specifed region but it'll pass through the first half of the region first.

    EDIT: Also, if the player sprite is overlapping a restricted region, then the hookshot doesn't fire at all (pic 3)
    These are all issues that have to do with the player's position being read as the top left pixel of a 1x1 square around themselves. I won't be able to look at this until next week as I'm pretty busy this weekend. You basically need to find where in CrossEngine the player's position is being determined and offset it to the center of the square, i.e. add 0.5 to their x and y position.

    E: I ended up offsetting the Hookshot collision box by 0.5 x 0.5 instead
  18. JavaScript:
    // altered hookshot so it retracts faster than it flies out.
    Game_Character.prototype.processMoveCommandTool = function(command) {
        if (this._tool.boomerang[0]) {
            if (this._tool.boomerang[1] > 0) {
                this._tool.boomerang[1]--;
                this.moveForward();
            } else {
                this.moveTowardCharacter(this._tool.user);
                this._tool.forcingMove = 2;
            };
        } else if (this._tool.hookshot.enabled) {
        if($gameMap.regionId(this.x+.5,this.y+.5) === 4 || $gameMap.terrainTag(this.x+.5,this.y+.5)==3){
          this.hookShotTink();
          this.erase(); // AND THIS
                      this.moveTowardCharacter(this._tool.user); // AND THIS
            this._tool.forcingMove = 2; // AND THIS
        }
            if (!this._tool.hookshot.locked) {
                this._directionFix = true;
                if (this._tool.hookshot.range > 0) {
                    this._tool.hookshot.range--;
                    this.moveForward();
                } else {
                    if (this._tool.forcingMove != 2)
                    {
                        //first time we change to retracting, increase speed
                        this._moveSpeed+=1;
                    }
                    
                    this.moveTowardCharacter(this._tool.user);
                    this._tool.forcingMove = 2;
                };
            } else {
                this._tool.forcingMove = 2;
            };
        };
    };

    This works on my end. Change the 4 and 3 to the regionID and/or terrain Tag you want to block
  19. AquaEcho said:
    JavaScript:
    // altered hookshot so it retracts faster than it flies out.
    Game_Character.prototype.processMoveCommandTool = function(command) {
        if (this._tool.boomerang[0]) {
            if (this._tool.boomerang[1] > 0) {
                this._tool.boomerang[1]--;
                this.moveForward();
            } else {
                this.moveTowardCharacter(this._tool.user);
                this._tool.forcingMove = 2;
            };
        } else if (this._tool.hookshot.enabled) {
        if($gameMap.regionId(this.x+.5,this.y+.5) === 4 || $gameMap.terrainTag(this.x+.5,this.y+.5)==3){
          this.hookShotTink();
          this.erase(); // AND THIS
                      this.moveTowardCharacter(this._tool.user); // AND THIS
            this._tool.forcingMove = 2; // AND THIS
        }
            if (!this._tool.hookshot.locked) {
                this._directionFix = true;
                if (this._tool.hookshot.range > 0) {
                    this._tool.hookshot.range--;
                    this.moveForward();
                } else {
                    if (this._tool.forcingMove != 2)
                    {
                        //first time we change to retracting, increase speed
                        this._moveSpeed+=1;
                    }
                   
                    this.moveTowardCharacter(this._tool.user);
                    this._tool.forcingMove = 2;
                };
            } else {
                this._tool.forcingMove = 2;
            };
        };
    };

    This works on my end. Change the 4 and 3 to the regionID and/or terrain Tag you want to block
    This works great, thank you!

    However, there seems to be a small bug when the hookshot drags an enemy back to the player. I can't tell if this is caused by something that was changed here or by something Restart added to the Cross Engine elsewhere: after you drag an enemy to the player's position with the hookshot, the enemy's speed seems to be set to the hookshot's return speed and it carries out its SelfSwitch D moveroute at a super high speed, resulting in the event zig-zagging around the map until SelfSwitch D turns off. Have you encountered this issue before?
  20. DTurtle said:
    This works great, thank you!

    However, there seems to be a small bug when the hookshot drags an enemy back to the player. I can't tell if this is caused by something that was changed here or by something Restart added to the Cross Engine elsewhere: after you drag an enemy to the player's position with the hookshot, the enemy's speed seems to be set to the hookshot's return speed and it carries out its SelfSwitch D moveroute at a super high speed, resulting in the event zig-zagging around the map until SelfSwitch D turns off. Have you encountered this issue before?
    I'll look at it next week but I'm on vacation right now so can't go digging into plugin files