Charas-Project

Game Creation => Requests => RPG Maker Programming => Topic started by: Pythis on September 04, 2005, 12:59:52 AM

Title: If one event meets another
Post by: Pythis on September 04, 2005, 12:59:52 AM
How do I make it so that if one event meets another something happens.
Title:
Post by: WarxePB on September 04, 2005, 01:11:51 AM
Unfortunately, the only way to do this is in-game scripting or (if it's just random) coordinates.

First, you'll have to get the coordinates of both events. Create four variables (Event1-X, Event1-Y, Event2-X, Event2-Y), and create four Variable Operations that get the coordinates of the events (in the Variable Operation window, click Sprite, the event you want, and X/Y Coordinate (not Screen-Relative)). Then, create another Variable Operation that subtracts 1 from Event2-X. Create a Conditional Branch (Fork Condition) that checks if Event1-X and Event2-X are equal. If they are, activate the event. If not, add 2 to Event1-X, and check again. If not, subtract 1 from Event1-Y, and check if both Y coordinates are equal. If not, add 2 to Event1-Y, and check again. If none of those conditions are true, then the second event isn't close to the first.


Since that's sort of difficult to understand, here's what your code should look like:

<>Variable Operation: Var[0001:Event1-X] Set, Event 1 X Coord
<>Variable Operation: Var[0002:Event1-Y] Set, Event 1 Y Coord
<>Variable Operation: Var[0003:Event2-X] Set, Event 2 X Coord
<>Variable Operation: Var[0004:Event2-Y] Set, Event 2 Y Coord
<>Variable Operation: Var[0002:Event1-Y] -, 1
<>Branch if Var[0002:Event1-Y] is Var[0004] Equal
|<>(event)
|<>
<>Else Handler
|<>Variable Operation: Var[0002:Event1-Y] +, 2
|<>Branch if Var[0002:Event1-Y] is Var[0004] Equal
||<>(event)
||<>
|<>Else Handler
||<>Variable Operation: Var[0001:Event1-X] -, 1
||<>Branch if Var[0001:Event1-X] is Var[0003] Equal
|||<>(event)
|||<>
||<>Else Handler
|||<>Variable Operation: Var[0001:Event1-X] +, 2
|||<>Branch if Var[0001:Event1-X] is Var[0003] Equal
||||<>(event)
||||<>
|||<>End
|||<>
||<>End
||
|<>End
|<>
<>End
<>


Something like that, anyways.
Title:
Post by: Meiscool-2 on September 04, 2005, 01:12:36 AM
Make four varibles. Two would be the first events X and Y, and second the other two would be the other event's x and Y. Then make a script to where if event 1 X= event 2 X and if eveny 1 Y= event 2 Y, the thing you want to have happen happens.
Title:
Post by: Pythis on September 04, 2005, 04:23:07 AM
niether work
Title:
Post by: WarxePB on September 04, 2005, 05:04:08 AM
I forgot to mention that you need to set one of the events to "Parallel Process". Try it again, because it works for me.