RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Event opossite player

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 70
RMRK Junior
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.



*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
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.
« Last Edit: July 21, 2011, 07:34:02 PM by cozziekuns »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
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:

« Last Edit: July 21, 2011, 07:38:29 PM by modern algebra »

**
Rep: +0/-0Level 70
RMRK Junior
I have one problem: the guard moves automaticaly down and when is down opossite of player guard starts moving so, I want.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
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.

**
Rep: +0/-0Level 70
RMRK Junior
I fixed it. I had in autonomous movement move route command move toward player.