OBJECT ON A SWITCH?

Posts

Pages: 1
How can I code a VX game to check if items are on switches?

Would I code a condition statement if they are on a certain X,Y coordinate?
If so, how would I do that?

I thought my previous solution would work, but it didn't. :(
On the event page go into Control Variables, select Character (and then choose the event that is going to be used the press the switch) and choose Map X.

This will store the item's X coordinate into a variable, use another for Y. You'll need to update these variables every time the object is moved.

After that you just check if X and Y are equal to the location of the switch, if they are, then trigger it.

If you need more help after this I'll go into more detail.
Thanks! My original puzzle didn't work.
Having six objects with 3 events each all running at the same time didn't work out so well.
I had to make three rocks be on three switches at the same time.

If you can find a way to code that so that it won't crash the game that'd be awesome.
What you do is block off a 5x5 area in as small a cave as you can make.
Then add two spaces for walking along on the right edge of the puzzle, and add two on the bottom.
Add an arrow tile for each direction, (in a somewhat logical left to right order; I used left, up, down, right.)
and make an event so that each arrow moves all the boulders one space in the direction of the arrow when you stand on it and press the action button.

Then, you need to make a code that checks whether or not all of the boulders are on a pedestal.
If they are, then a switch turns off and a door opens.

Can you do this without crashing the game?
It's a lot of stuff...
It should be pretty simple like this.
ONE Parallel Event, SIX variables


To get the co-ordinates just click on the event position of the pedistal and look at the numbers at the bottom of the screen.
Thanks, but I already got it.
I made it so that the X co-ords are proccessed AFTER the Y co-ords are, not at the same time.
Now it's only doing half the work at once.
A also made it so that ONE rock was all that was being kept track of, so that might've helped too.

BTW liberty, Don't parallel event's massively slow down a game?
Or, would the parallel event count as ONE event instead of 6, thus allowing my game to not crash?


Also, I'm pretty sure I can configure that code into VX. :)

...I still can't script for beans. :P
I tried it a little and F'd up my game...
Had to make a second project and copy/past the original script. >.>

Unless you've got a lot of other events running on the same map it shouldn't cause any slowdown. (I also forgot to add a WAIT 0.0 command at the bottom). Now, I'm not recommending a Common Event for this, just a normal event set to Parallel Process. You can add a switch that turns it off when they've all been put in the correct places too. If it does slow down some it should only be for that map - just add some more wait commands, they generally help with lag.

Thanks!
And there were five other events on the map.
All action button triggers, but it still slowed down too much.
I'll have to try this puzzle again with your advice of a single parallel event.
TO RPGMVX! AWAY!
Pages: 1