[RMVX ACE RGSS3] HOW CAN I GET EVENT COORDINATES ?

Posts

Pages: 1
Fflo
Be careful ! I'm French
3650
Hi,

I'm working on a little puzzle mini-game for Sorcelleria.

Move the 9 tiles correctly on the blue carpet so that the gate opens.

I want to check each tile's X&Y coordinates. But I don't want to use 2 variables for each tile (redundant).

I think there's some script code that can get an event's coordinates.
What is it ? Thanks.

It's not redundant, but you can just use a combination of Regions and one set of variables to check X/Y.

Give each different slot a variable.
Use the terrain event to check if the x/y of a certain event is on that variable.
If yes, lock it in.
Then check the region of the next event and see if that is on the right spot.
And so on.

Eventing is very powerful if you're not too lazy to use it - besides, as long as you don't go back to that room you can reuse those variables again to check x and y positions through-out your whole game.

I always have at least 5 variables that are used over and again through a game (usually one for random chance, one for x check, one for y check and two others for bits and bobs that need quick checks).
Deltree
doesn't live here anymore
4556
You can get the X and Y coordinates in script this way:

$game_map.events[ID].x

$game_map.events[ID].y


Where ID is the event's ID number. So, if the event is number 001, you'd replace ID with 1.

To check it, you'd need a big block of those x and y comparisons for each event tile. It's not elegant, but it should work. I'd do the check after each time the player pushes a tile.

I might also recommend picking the top left tile of the carpet as an "origin" and then making the other comparisons relative to that (for instance, x + 1 for the tile to the right) rather than checking against hard numbers for all of them. That way, in case your map changes and you have to move the puzzle, you only have to change one pair of numbers and not all of them.
Fflo
Be careful ! I'm French
3650
Thanks.

Before posting my topic, I tried with something almost identical to your code, Deltree.
It didn't work because I added parenthesis instead of semicolons.

I corrected my conditional branches and it works perfectly !
Problem solved !
Pages: 1