MV Tool Region Block for Chrono Engine

Hello, everyone.

So, I was going full steam ahead on my game earlier in the year and had a person or 2 helping out with some of the things I couldn't do (MANY things, lol) but then ran into some financial/personal issues and kinda put it all aside. I'm now back and working on the game and I don't really want to bother the people that did some work for me plus don't really have the money for it right now so I was hoping someone could help me with a quick update.

I'm using the tools from Chrono Engine in my game and a friend had made me a JS file called "ToolRegionBlock.js" to make it so the boomerang and hookshot would bounce off Region 1. However, at the time I didn't even think to ask them to also include the arrows from the bow.

This is the complete JS file, would it be possible for someone to put in a block of code that also includes the arrows? (They are tool item id : 7) Looking at the code I can kind of put together what needs to GENERALLY be done but I can't come anywhere close to figuring out all the particulars.

This is the code:

//ChronoEngine Make hookshot and boomerang bounce against terrain 2
// altered hookshot so it retracts faster than it flies out.
Game_Character.prototype.processMoveCommandTool = function(command) {
if (this._tool.boomerang[0]) {
if($gameMap.regionId(this.x,this.y)==2){
AudioManager.playSe({name: 'hammer', pan: 0, pitch: 100, volume: 100});
this.moveTowardCharacter(this._tool.user);
this._tool.forcingMove = 2;
}
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,this.y)==2){
this.hookShotTink();
this.erase();
this.moveTowardCharacter(this._tool.user);
this._tool.forcingMove = 2;
}
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;
};
};
};

// when a hookshot hits something that should stop its movement forward,
// this will play a 'tink' sound, speed up, and reverse.
// note that the speed up stacks with retraction speeding up by itself
// so it reverses at 4x normal hookshot speed. This feels right.
ToolEvent.prototype.hookShotTink = function(){
this._tool.hookshot.range = 0;
this._moveSpeed+=1;
AudioManager.playSe({name: 'hammer', pan: 0, pitch: 100, volume: 100});
}
The hookshot and boomerang tools in Chrono Engine have special functions that need to be modified through plugin code, the arrows do not. You can actually do this in the arrow's (or any other tool's) move route with an if statement after each move forward command.

It'll look something like

if($gameMap.regionId(this.x,this.y)==2){this.erase()}
The hookshot and boomerang tools in Chrono Engine have special functions that need to be modified through plugin code, the arrows do not. You can actually do this in the arrow's (or any other tool's) move route with an if statement after each move forward command.

It'll look something like

if($gameMap.regionId(this.x,this.y)==2){this.erase()}
Ah, thank you, Aqua!

We must have spoke of this before, actually, because I already had that code in the custom move route, i presume from you.

However, we must have made a change because everything is set to Region 2, even the notes in the JS file, whereas we ended up using 1 instead. So, I simply changed the 2 to a 1 and it works now.

Thank you so much.

I hope you are well.
Yep, I'm doing just fine although I've been working on a game in another engine (GDevelop) lately. I still come here and help people out, or get assets (you can use RPG Maker assets in any engine as long as you own the engine they came from).

Moghunter also came back and made a big Chrono Engine guide on top of my own one here.


Original thread: https://forums.rpgmakerweb.com/threads/tool-region-block-for-chrono-engine.180975/