Main Menu
  • Welcome to The RPG Maker Resource Kit.

Event opossite player

Started by michael95, July 21, 2011, 05:17:02 PM

0 Members and 1 Guest are viewing this topic.

michael95

I want this guard moving, so that be always stay opossite player.

It means: When player move one step left left, guard move left one step too. When player go up guard move stay in current position.



cozziekuns

#1
Look into a caterpillar script like Zeriab's Caterpillar Script. Could probably be done with events, but it would be a lot more tedious.

EDIT: Nvm, I misunderstood the question. Sorry.

modern algebra

#2
I don't think that's what he wants (and besides, I need to fix that script).

I think he means he wants the guard to always prevent the player from going past that line. He doesn't want the guard to follow him; he just wants the guard to always be on the same X-coordinate as the player.

@michael95 - One way to event this would be to run a parallel process event in the map which looks something like this:

Loop
  Control Variables [X Difference] = Player's Map X
  Control Variables [X Difference] -= [Guard]'s Map X
  Conditional Branch: Variable [X Difference] > 0
    Move Event: Guard -> Move Right
    Wait: 6 frames
  Else
    Conditional Branch: Variable [X Difference] < 0
      Move Event: Guard -> Move Left
      Wait: 6 frames
    Else
      Break Loop
    Branch End
Branch End
Move Event: Guard -> Turn Down
Wait: 6 frames

That would be the basic idea anyway - I don't know how many each of the wait frames would have to be.

And of course, the guard will have to be at least as fast as the player for this to work.


EDIT::

I've attached a picture of the event as that will probably be of more assistance:


michael95

I have one problem: the guard moves automaticaly down and when is down opossite of player guard starts moving so, I want.

modern algebra

Err, I don't know what you just said. I tested that out in a game, and the guard never ever moved down - it worked just as you wanted it to work. Make sure that the last move event is Turn Down, as in the screenshot, not Move Down.

michael95

I fixed it. I had in autonomous movement move route command move toward player.