- Joined
- May 30, 2023
- Messages
- 400
- Reaction score
- 227
- First Language
- EN/JP/NL
- Primarily Uses
- RMMZ
Hi,
Sorry for the unintelligible title. I'm trying to make a battle trigger when a Goblin jumps you. In trying to achieve this I have an event with a Goblin sprite that triggers a battle upon event touch. The movement part is scripted, as below (yes this is all crammed into the single line field).
It works very nicely in that the goblin jumps you when you are within range... and if you happen to run away it will resume its random routine... The only thing that doesn't work as intended is the trigger for the battle. Right after the goblin jumps (and the player is not moving away at the time of the jump), it will occupy the same space as the player. Funnily enough, the battle event will not trigger, and the goblin will just continue hopping in place.
Is there any way to have the battle trigger when the goblin successfully lands on the player? I've thought about having the goblin back-step and then moveStraight() to the player, but that's... slightly less aesthetically pleasing.
Any suggestions highly appreciated.
Sorry for the unintelligible title. I'm trying to make a battle trigger when a Goblin jumps you. In trying to achieve this I have an event with a Goblin sprite that triggers a battle upon event touch. The movement part is scripted, as below (yes this is all crammed into the single line field).
JavaScript:
const DivX = $gamePlayer.x - this.x;
const DivY = $gamePlayer.y - this.y;
if(Math.abs(DivX) + Math.abs(DivY) < 6){
this._waitCount = 59;
$gameTemp.requestBalloon(this,5);
this.jump(DivX,DivY);
this.setMoveSpeed(4);
} else {
this.moveRandom();this.setMoveSpeed(3);
}
It works very nicely in that the goblin jumps you when you are within range... and if you happen to run away it will resume its random routine... The only thing that doesn't work as intended is the trigger for the battle. Right after the goblin jumps (and the player is not moving away at the time of the jump), it will occupy the same space as the player. Funnily enough, the battle event will not trigger, and the goblin will just continue hopping in place.
Is there any way to have the battle trigger when the goblin successfully lands on the player? I've thought about having the goblin back-step and then moveStraight() to the player, but that's... slightly less aesthetically pleasing.
Any suggestions highly appreciated.