ID:155356
Jul 22 2011, 6:47 pm
|
|
How do i make a door respond when a player is near by?
|
You would want to define Bumped()
atom Now you can just call Bumped() on the door instead of one long Bump() obj If you want it to detect people nearby and open without bumping There are few options: - You can set a loop to detect people nearby the door once in awhile. - You can set 'sensor' turf that will open the door when a player enters using Entered() proc - You can call nearby doors to open on Move() If you need more information about those methods, just ask. |
In response to Rotem12
|
|
i'm more interested in when a player is 1 space in-front of said door.
Not on the door itself. |
There are several ways you could approach this.
1) Have doors constantly check for nearby mobs. 2) Have mobs constantly check for nearby doors. 3) Have mobs check for nearby doors when moving. The first two, while working perfectly fine, will bog the game down with unnecessary processing. It's overkill for an otherwise simple and light function. The third option makes the most sense. It's only active when it's needed and avoids unnecessary CPU usage. First you'll need to make the actual door and provide it with a function to open and close. // What this does is check to see if the door is already open by looking at its density. Now that the door is ready, all that's left is to trigger the door's Open() proc whenever the mob moves. // We're triggering this from the client so mob/Move() doesn't make unnecessary calls to DoorCheck(). |
If yes, look into the reference (F1) for Bump() proc.