Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Step on trigger

Let's say I put a switch on the floor for the character to step on, is there a way to make it so that if the character gets off that switch without having to press any buttons, the switch turns off?
 
Yes.  It's not as simple as you think though.

You need to make 4 variables.

Hero X Hero Y Switch X Switch Y.  Have a parallel process checking if these two are the same.  If they are turn on a switch, if those conditions aren't true then turn it off. 

Out of interest, how do you plan to keep the switch down eventually.  If you want to use a  crate etc you'll need to do the same for that as well.  Crate X and Crate Y map coords.
 
Alright thanks,
And my Idea was more with a rolling barrells that press on the switch as they go and the player has to time his entrance or something like that.

Just another question, how Am I suppose to make a variable that knows the players location and keeps track of it?
 

mawk

Sponsor

Player's X and Y are options in the Control Variables menu. I haven't been around RMXP for a while now, but it should go something like this:
Control Variables > Variable 001:"Player's X" = Player's X position
Control Variables > Variable 002:"Player's Y" = Player's Y position

A Parallel Process event will update that variable to your player's current position constantly, so it should stay current.
 
Barrels eh... depending on how you go about setting that up, that could take a shit load of variables... good luck.

EDIT: I'm thinking of one of my open puzzles when I told you.  For your original question, you only need 2 variables and then check those against actual map coordinate values.  I don't think you'll need to make actual variables for the switch seeing as it doesn't vary its position.
 
And Another question, I tried to test it out with your variable thing using conditional branches, but I couldnt figure out wich trigger to put to the event, up to now nothnig works lol
 
http://i209.photobucket.com/albums/bb278/slikkarma/Sanstitre.png[/img]

this is how I set up the switch, and I made a boulder with a custom route that goes towards the switch but when it hits it nothing happens, or the switch triggers at a random time.
 
It's easier than that, I know. You shouldn't have to use all of the switches and stuff. Once my grandpa gets off the comp i will figure out how and then yeah, I'll tell you.
 
Okay, well first of all, I'd personally have the eventing in a blank event at the edge of the map.  You don't seem to have SET the variables.  They all need to be set so the game knows what variable is what.  I'd also suggets swapping the Switch Y around with the Hero Y.  You seem to have that part the opposite way round from the X's.

AND... why would the boulder do anything.  This event you have here is checking where the player is, not the boulder.

Cheese, please do find a way to work out an  event colliding with an event without using any variables.  I'm interested.
 
ok Ya I have to be the worst detailer in the world sorry about that, ok never mind the hero and Imagine it's written boulder(I tried hero at first then changed it to boulder but I just didnt change it back before I screened it). Second the variables are set through another event, so thats cleared with.  I'll try what you said about swapping but I really doubt it will have an effect.
 
LOL.  I have done this plenty of times.  It most definately does work.

here lets do it a simpler way for the hero.

Have the switch set to player touch and when he does turn on the switch.  Make 4 events around the switch with player touch and set the switch off.  Note this will only work with the player, not the barrel.  Chainsaw Cheeze is going to solve the event touch event conundrum without using variables.
 
Whao your way is so obvious (maybe too obvious...) I can't believe I didn't think of it before!
Ya but I really want to see what cheese can figure out, it would make things alot simpler.

(if you say it works for you can you post me exactly what you did so I can see if I didn't set it right or if my pc is just plain dumb!)
 
Oh the hassle... :P

I'll try and write it in here.

Start from scratch.

Make the switch, name it switch, leave it alone.

Make the barrel, name it barrel, leave it alone. 

Make an event in the corner.

Variable operations, leave it on the "set" radio button.

Set two different variables - Barrel X and Barrel Y

To do this, go to character and then select the corresponding event that should be named barrel.

Then obviously for X set it to X coordinate

For Y set it to Y coordinate.

Now go out to your map and take note of the map coordinates here yuor switch is.

Go back into the event we are doing and add a con. branch.  Check to see if the Barrel x variable = the number of the x coord where the switch is, make sure there is an else statement.  Inside the true part of the first branch, do the same for the y coord.  Make sure you don't mix these two up!

Then inside this con branch, seeing as all the conditons we need are true (ie the barrel is o nthe switch) turn the door switch on.  In all the else statements, turn  it off.

Phew, i think thats it
 
I was talking about the first one, I didn't look at the second thing yet.

EDIT: And for the Event touching event, I've done that somewhere in my game, I will look it up once my GP gets off the other comp.
 
Well when I answered the first one, it was obvious to me that sooner or later, something else was going to have to go on that switch to allow the hero to get through so I used some common sense and future proofed it all. 

Unless I'm dumb cause it's 3am where I am, I very much doubt you did event touching event processing without a single variable / script.  It's also worth noting that using x and y's is the the most fool proof way to avoid glitches with this sort of thing.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top