RPG Palace
( Register )
Navigation
Home Creations RMVX RMXP RM2k/RM2k3 Music

Affiliates
Latest News
RMXP Outdoor Tileset!
10/21/2007
Finally, the next installment of Inquisitor's epic RPG Maker XP tileset series is out! This gargantuan tileset is sure to get mouths watering. Download it exclusively from RPG Palace!

RPG Palace:

 

Lufia Monster Movement - Maxy's Tidbits

Another query on the forums recently is how to make monsters move for every step the hero takes, as in Lufia 2. Now, I haven't played Lufia 2, I'm a graphics whore and so decided to give it a miss, so I was working in the blind. I anticipated the problem that if you're next to a wall and continue to hold an arrow key, monsters would keep walking despite the hero not moving, so using key inputs was out of the question. However, later I found out that Lufia 2 had that. I was disappointed - those lazy buggers. Thanks for RpgmT for his alternative solution which stays true to the game in question.

I've looked for an easy way to tell whether the hero has moved in the past, but it just doesn't exist. We'll have to use a technique similar to the one I used in my AP tutorial.

We'll start with a common event, once again triggered by Parallel Process. Give it a trigger switch in case we need to turn it off at some point. We're going to use 4 variables here: 0001:Hero X, 0002:Hero Y, 0003:Previous X, 0004:Previous Y. The basic premise is we're going to set 0001 and 0002 to be the Hero's X and Y positions, then check if they are the same as the last time we ran the common event. Since it's a parallel process, we'll be running it pretty much constantly. When they're not equal, however, that means the hero has taken a step. At this point we can put in our code to move the monsters. The code looks like this:

Now we know whenever the hero takes a step. There are a variety of ways we can do the next bit, but for simplicity let's use a switch. Back in the code, replace "Comment: Hero has moved!" with a switch turning on "0001: Hero Moved". Replace "Comment: The hero hasn't moved." with a switch turning off "0001: Hero Moved". Your new code is:

So, how does that affect the monsters? I presume you've already placed them, so edit one now. Create a new page, triggered by 0001: Hero Moved. We aren't going to use the Events Command pane here, nor the trigger condition (Action key etc), you're free to do what you like with those. What we will edit is the movement speed and routine. Give the monster a custom pattern movement type, with a frequency of 8. Define the pattern to be "Move Towards Hero", but uncheck the Repeat Pattern. This means the monster will only take one step for each time 0001: Hero Moved is switched on; 0001: Hero Moved is actived for each step the hero takes so both monster and hero move at the same rate. Also, tick the Ignore Impossible Move box - this may cause problems where the monster doesn't always move when your hero does, but it also means they don't get stuck in a routine where they can't move at all, ever again. You might want the monsters to move at the same speed as the hero too, otherwise the monster will still be taking steps even when the hero has finished.

This method is best used in an open area.

RpgmT's alternative:

You can also do a check such as this:

The monster movement code can also be done in the same page.
Have a check on each monster, such as Switch 0001: Monster 1 Dead

Then, where the comment Hero Has Moved is, put this:

Or, if you for example want a monster who takes 1 step for each two steps:

RpgmT: This way is much simpler if you ask me. The only drawback is that the monsters still move if you for example move against a wall, but that's actually to your adventage if you ask me. Remember the monster race puzzle in Lufia 2? Where you had to get your monster on the step first by smart moving?

Maxy: Oh how we argued about which way was better. But the answer is mine.

 

 

Community MMORPG

Hot Picks
Mode07
XP Indoor Tileset
XP Outdoor Tileset
XP World Tileset


2004 - Copyright RPG Palace - Webdesign Made By: NunoLac from NL Design