Hey guys, How do I stop a scripted Jump from landing on the roof?

Status
Not open for further replies.

Vixxth

Veteran
Veteran
Joined
Jan 18, 2022
Messages
30
Reaction score
18
First Language
English
Primarily Uses
RMMZ
This is the script i am using

I set Var's 320 and 319 to randomly pick a value.
Then run this.
$gameMap.event(this._eventId).jump($gameVariables.value(320),$gameVariables.value(319));
This works fine 90% of the time, except for when the entity jumps onto the water or off the edge or onto a roof, is there a way to stop the jump from accessing such areas?

First time using RMMZ and like maybe 2 weeks in? so idk if im being a newb or not..
 

Spaske

Veteran
Veteran
Joined
Nov 6, 2021
Messages
275
Reaction score
140
First Language
German
Primarily Uses
RMMZ
Hmm, maybe adding region variable to the mix?
Dunno if it would work but you could try to make a 3rd variable, 321 wich calls the region ID, and then its jump on X = 320 / Y = 319 / REGION ID 1 = 321....
Youd need to map it out where its possible to jump ofc... should work, not sure tho.

Edit: forgot to mention, if that code uses the same "jump" mechanic like in the programm, then it wont jump to those coordinates from the variable but rather it will jump so many blocks.
lets say if the variable says x5 and y6, then the event wont jump to bloc x5y6 but it will jump 5 blocks to the right (x) and 6 down (y).
 
Last edited:

Nolonar

Veteran
Veteran
Joined
Feb 18, 2018
Messages
421
Reaction score
576
First Language
French, German
Primarily Uses
RMMZ
You could try and check if the target coordinates are passable or not:
JavaScript:
const x = $gameVariables.value(320);
const y = $gameVariables.value(319);
if ([2, 4, 6, 8].some(direction => $gameMap.isPassable(x, y, direction))) {
    $gameMap.event(this._eventId).jump(x, y);
}

This checks if the target is passable from any of the 4 possible directions. If it is, the jump is executed. At the very least, this will stop your event from jumping into the water (assuming water is not passable). Whether it can still jump onto a roof depends on whether the roof is passable, of course.
 

Arthran

Veteran
Veteran
Joined
Jun 25, 2021
Messages
350
Reaction score
319
First Language
English
Primarily Uses
RMMZ
I could be wrong, since I just kinda skimmed over it, but I think that Eli Jump System is supposed to help with these types of situations. Otherwise, I'd bet that Yanfly's Smart Jump would work with FOSSIL.

But the snippet that Nolonar posted would likely work for what you're trying to do, and if not, it'd be easy to modify to behave the way you want.
 

Vixxth

Veteran
Veteran
Joined
Jan 18, 2022
Messages
30
Reaction score
18
First Language
English
Primarily Uses
RMMZ
The problem i'm having is I'm using JABS
which works flawlessly, I set a slime boss up to spawn smaller slimes with
Again that works flawlessly, but i wanted them to jump out from the boss to random coordinates.. the boss dies and sets his event ID into 2 vars..

I tried the above idea, but I imagine since my jump vars are randomed from -3/+3 for x and y
that may be why the above suggestion isnt working, they still jump onto the roof of the dungeon..

Smart jump 100% probably would help but the only version avail is MV

I 'm trying to manipulate Eli's jump, I set the event to parallel process to run the Plugin command:
"0 - he says is for 'this event'"
"Coordinates allow for \v[] for x,y, so i use that... but sticking a static number is yields the same error"
"jump peak 1"


*Edit* also I noticed with Eli's that if i setup an event in map, Label his ID with the event ID, hard set the coordinates, and height, it works but the mob jumps into the blocked region still... and this wont support what I was needing, since the coordinates and event ID have to be hardset.
 

Vixxth

Veteran
Veteran
Joined
Jan 18, 2022
Messages
30
Reaction score
18
First Language
English
Primarily Uses
RMMZ
I could be wrong, since I just kinda skimmed over it, but I think that Eli Jump System is supposed to help with these types of situations. Otherwise, I'd bet that Yanfly's Smart Jump would work with FOSSIL.

But the snippet that Nolonar posted would likely work for what you're trying to do, and if not, it'd be easy to modify to behave the way you want.
You could try and check if the target coordinates are passable or not:
JavaScript:
const x = $gameVariables.value(320);
const y = $gameVariables.value(319);
if ([2, 4, 6, 8].some(direction => $gameMap.isPassable(x, y, direction))) {
    $gameMap.event(this._eventId).jump(x, y);
}

This checks if the target is passable from any of the 4 possible directions. If it is, the jump is executed. At the very least, this will stop your event from jumping into the water (assuming water is not passable). Whether it can still jump onto a roof depends on whether the roof is passable, of course.
Thank-you for your suggestions guys! anything else would be appreciated as I try to manipulate Elis futher, but idk if this will work lol
 

Vixxth

Veteran
Veteran
Joined
Jan 18, 2022
Messages
30
Reaction score
18
First Language
English
Primarily Uses
RMMZ
Hmm, maybe adding region variable to the mix?
Dunno if it would work but you could try to make a 3rd variable, 321 wich calls the region ID, and then its jump on X = 320 / Y = 319 / REGION ID 1 = 321....
Youd need to map it out where its possible to jump ofc... should work, not sure tho.

Edit: forgot to mention, if that code uses the same "jump" mechanic like in the programm, then it wont jump to those coordinates from the variable but rather it will jump so many blocks.
lets say if the variable says x5 and y6, then the event wont jump to bloc x5y6 but it will jump 5 blocks to the right (x) and 6 down (y).
I cant believe I missed this, this post is marked as solved...
and Thankyou to all 3 of you!
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
9,730
Reaction score
6,178
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Profile Posts

:v I "unlearn" how to use the forum.
I've made and moved to a THIRD spreadsheet document to reorganize my thoughts and better plot out my RPG.

halp
Today, we got "The ancient Forest"

Map042.png


And here's a little ingame view:
Clipboard01.png

New Boss Attacks for Soul Hero Adventure:
1,Aim and shoot
2,Boulders falling frenzy
3,Throwing Fireballs
4,Chasing Magical Traps
5,Lasers attack of 360-degree

Forum statistics

Threads
123,291
Messages
1,155,537
Members
161,706
Latest member
Imxbor
Top