Enemy reactions and opening doors questions


i have a few questions about the BGE, ok i have a tutorial on how to make a enemy with reactions like if you get to a certain distance from the enemy the enemy will start to attack you. With that being said, i was wondering how would you apply that to lets say a door or getting close to a button, then the game engine gives the player the option to press a certain button to make the door open? I know how to make a animation to make doors open, but not to a certain distance to the certain location.

I got close to finding out this but there was no link or tut for it…i will continue to look but in the mean time could some one direct me to a source?

Thank you.:yes:

Not sure exactly what you’re asking, but you can use a near sensor to make something happen only if the object is nearby… You can then trigger a different state (using the state actuator) for the door (for example the state:inv option to change from “open” state to “closed”)

Ok put it this way, if your far away from a elevator (a certain distance away) and you want to press the button to go up it would not work because your not within range to actually press the button. Your arms are only so long so you would have to walk further intil you get within arm distance for you finger to touch the elevator.

So i want to apply this situation to the game world. Right now my characters arms are able to reach the elevator door from like 10 feet when my characrers arm is only 2 and a half feet.

Soo? can you give me an example file? for the state actuator? i found it and used state:inv but it’s not really working out for me. im gonna look around and see if i can find a tut on it. but in the mean time place respond.

Thank you.

Ok so i found this tut that might be useful to other people wanting to do automatic doors.


Follow everything on here except the distance. The distance should be 4 and reset should be 4. This is for the Near sensor.

Cool. Glad you found the answer, and thanks for sharing it with everyone here. A nice looking tutorial!

Yeah lol im glad too. I wanna know more about the AI, so if i find anything else besides this tut then i will post it here. or is there another place i could post?

Best to create a new post per problem. That way it gets a good, relevant title that gets you better help from people who know about the subject, and it helps others later trying to figure out the same kind of problems.

Other than that, post away! :slight_smile: