Realistic door, opening and closing on use

Post topics regarding Level Building/Design and Entity Usage with Reality Factory
Post Reply
Agentbromsnor
Posts: 37
Joined: Wed Jun 13, 2012 6:22 pm

Realistic door, opening and closing on use

Post by Agentbromsnor »

I've been experimenting with the door-entity in RF. I think I've got it all figured out with the animating and the settings, but for my game I would like to be able to open and close doors when used. So, once the player opens the door, the door has to stay open untill the player closes it again.

What would be the best way to achieve this?
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: Realistic door, opening and closing on use

Post by QuestOfDreams »

The best way to do this is to use a LevelController entity + script.
Use the DoorDistance method to check if the player is in the range to open/close the door. If true use self.key_pressed to check if the Use key is pressed. Then use SetDoorTargetTime to open/close the door. Something like this (not tested):

Code: Select all

{
	USERANGE [100]
	USEKEY [22]
	DDIST  [0.0]    // Distance to door01
	DOPENTIME [2.5] // Open door time
	OPENING [false]

	Start[()
	{
		DDIST = DoorDistance("door01", "Player", true);

		if(DDIST < USERANGE)
		{
			if(self.key_pressed = USEKEY)
			{
				if(OPENING)
				{
					// close door
					SetDoorTargetTime("door01", 0.0);
					OPENING = false;
				}
				else
				{
					// open door
					SetDoorTargetTime("door01", DOPENTIME);
					OPENING = true;
				}
			}
		}
	}]
}
Agentbromsnor
Posts: 37
Joined: Wed Jun 13, 2012 6:22 pm

Re: Realistic door, opening and closing on use

Post by Agentbromsnor »

Thanks for getting me on the right track! I'm gonna give it a go.

Also, I noticed that a regular animated door can pass through the player when it swings open or closed. Is there a way to make the animated door 'solid', so to say?
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: Realistic door, opening and closing on use

Post by QuestOfDreams »

Have you set bRotating to true? IIRC this disables collision checking when the door starts to animate.
Agentbromsnor
Posts: 37
Joined: Wed Jun 13, 2012 6:22 pm

Re: Realistic door, opening and closing on use

Post by Agentbromsnor »

Not sure, I'll check. :)
Agentbromsnor
Posts: 37
Joined: Wed Jun 13, 2012 6:22 pm

Re: Realistic door, opening and closing on use

Post by Agentbromsnor »

This is kinda unrelated, but its just something that popped up.

I got an new version of a level send by EvilDraggie, and suddenly in-game the bumpmaps looks really pixelised and ugly. I'm 100% they didn't look like this before. Is there a reason for this? :?
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: Realistic door, opening and closing on use

Post by QuestOfDreams »

Sorry, I can't think of a reason why this would happen.
Agentbromsnor
Posts: 37
Joined: Wed Jun 13, 2012 6:22 pm

Re: Realistic door, opening and closing on use

Post by Agentbromsnor »

Hmm... Let me show you a screenshot to clarify what it looks like:

Image
Agentbromsnor
Posts: 37
Joined: Wed Jun 13, 2012 6:22 pm

Re: Realistic door, opening and closing on use

Post by Agentbromsnor »

Agentbromsnor wrote:Hmm... Let me show you a screenshot to clarify what it looks like:

Image
Never mind, this issue has been resolved! I was just being retarded, the texture pack was updated and I wasn't aware of it. :P
Post Reply