RPG Maker Forums

Hi everyone,

I've tried really really hard to figure this one out on my own, but I am not proficient in code. I'm trying a rather ambitious task of getting an animation to play on a particular event via a common event that gets executed when certain conditions are met.

The condition is a timed period that is determined by a random number chosen between 1 and 4.

1 = 60 frames
2 = 120 frames
3 = 180 frames
4 = 240 frames

Additionally, I also need to make sure that the player isn't standing on the same tile of the event that the script is executed in.

If they are, the event continues past this script and uses other scripts instead (which work).

Here's what I tried to come up with - this is only the latest iteration of it, so there's probably a lot of double-handling as I was trying to figure out why I couldn't get it to work.

Code:
var ani = Math.random() * (5 - 1) + 1; var wait = 0; var px = $gamePlayer.x; var py = $gamePlayer.y; var ex = $gameMap.event(this._eventId).x; var ey = $gameMap.event(this._eventId).y;
if (ani == 1){
while ((px!== ex) && (py !== ey) && (wait < 61)){
if (wait >= 60){
$gameTemp.reserveCommonEvent(40);
}
if (wait >= 61){
break;
}
wait + 1;
}
}
if (ani == 2){
while ((px !== ex) && (py !== ey) && (wait < 121)){
if (wait >= 120){
$gameTemp.reserveCommonEvent(40);
}
if (wait >= 121){
break;
}
wait + 1;
}
}
if (ani == 3){
while ((px!== ex) && (py !== ey) && (wait < 181)){
if (wait >= 180){
$gameTemp.reserveCommonEvent(40);
}
if (wait >= 181){
break;
}
wait + 1;
}
}
if (ani == 4){
while ((px!== ex) && (py !== ey) && (wait < 241)){
if (wait >= 240){
$gameTemp.reserveCommonEvent(40);
}
if (wait >= 241){
break;
}
wait + 1;
}
}
Any thoughts to help me with this mess appreciated. Thanks!

EDIT: I tested the above script on a stand-alone parallel event without anything else going on with it to make sure nothing else on the same event was interfering with it. It still didn't work.

The common event it calls, for the moment, it just a simple "Show Text" command with nothing else in it for testing purposes.

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,018
Messages
1,018,357
Members
137,803
Latest member
andrewcole
Top