Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Door Lock behind you and require a key?

Author
Message
foobly
16
Years of Service
User Offline
Joined: 10th Feb 2008
Location:
Posted: 23rd Jul 2008 04:54
I've been fiddling around with door scripts, and I can make a door lock behind you, but I can't seem to figure out how to get it to accept a key. In the game I'm working on, the player needs to backtrack, but must find a key to open a door that he's already been through and locked, if that makes sense.

If someone would help me out, I would be much obliged.

Thanks.

911truth.org

http://www.loosechange911.com/finalcut/
Seth Black
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 22nd Feb 2005
Location: Pittsburgh, PA
Posted: 23rd Jul 2008 17:41
...I know for a fact that a very similar series of door scripts was highlighted and posted in a thread, some time ago.

I do not have FPSC, or media installed on this computer. If nobody beats me to it, I'll see if I can locate the script that does what you seek, and post it here...


foobly
16
Years of Service
User Offline
Joined: 10th Feb 2008
Location:
Posted: 23rd Jul 2008 20:58
Much obliged, Seth.

Take your time.

911truth.org

http://www.loosechange911.com/finalcut/
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 24th Jul 2008 01:03
Here are some tips to achieve this:

- Create the door to open and close behind you.
- When the door is triggered to close (Meaning the player walked through it), have it enter a new section of the script
- In the new section of the script, have it act JUST like the script for a door that needs a key.
- Make sure you give the door entity the proper "UseKey" property


Good luck!


The one and only,


Whosoever says, "Don't sweat the small stuff," is obviously not a programmer.
Hybrid
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: In the p-block, group 7.
Posted: 24th Jul 2008 02:01
I would like to give you the script, but people need to try things for themselves first. I can help, but give us something to work with.

foobly
16
Years of Service
User Offline
Joined: 10th Feb 2008
Location:
Posted: 24th Jul 2008 02:08
I've got this, which closes the door behind you, but I'm not entirely sure how to modify it to get the door to lock.



911truth.org

http://www.loosechange911.com/finalcut/
Hybrid
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: In the p-block, group 7.
Posted: 24th Jul 2008 03:43
Add a state so that plrhaskey=1, or something like that controls the door to open again.

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 24th Jul 2008 03:54
Hmmm, I would suggest making it so that the door closes from a triggerzone and not when the player moves away from the door.

Because, what if the player openned the door and then backed away from it, NOT going through it? They'd be stuck and have to start all over.


The one and only,


Whosoever says, "Don't sweat the small stuff," is obviously not a programmer.
Hybrid
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: In the p-block, group 7.
Posted: 24th Jul 2008 04:08
That would be much better, Ply. Good thiking. Just give the zone the plrinzoneactivateifused.fpi file and set its IFUSED to the name of the door. Then, add the code activated=1 to the line where the door closes, so that way, It will nt close unless the player is within the zone. Good work.

xXThe Dead OneXx
17
Years of Service
User Offline
Joined: 20th Oct 2007
Location: In My Own Little World/s
Posted: 24th Jul 2008 10:04
I'm not specifically good with scripts but
I've got it to pretty much close,
but the door kind of appears open
but you can't walk through it.
and the key doesn't work to
get back in either... maybe i should
learn scripting first. lol

Offset a little to the left. Or was it the right?
foobly
16
Years of Service
User Offline
Joined: 10th Feb 2008
Location:
Posted: 24th Jul 2008 20:33
Ok, now I have another problem.

Not only can I not get the door to lock behind you, but I can't open it from the inside because the trigger zone is there.

Here is the modified script.



911truth.org

http://www.loosechange911.com/finalcut/
xXThe Dead OneXx
17
Years of Service
User Offline
Joined: 20th Oct 2007
Location: In My Own Little World/s
Posted: 25th Jul 2008 00:09
HEY!!! i think i'm better than i thought.
I DID IT!!!
I edited fooblys code and came up with this.




all you do is place the trigger after you walk in
and the key in whatever room you want after the point.
obviously you have to type the name of the door in the trigger
and key and type the key in the door as well... IT WORKS!!!

Offset a little to the left. Or was it the right?
Hybrid
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: In the p-block, group 7.
Posted: 25th Jul 2008 00:31 Edited at: 25th Jul 2008 00:33


Something like this is your best bet. The player can open it and cose it as much as they want, but as soon as the player enters the zone, the door needs the key.

foobly
16
Years of Service
User Offline
Joined: 10th Feb 2008
Location:
Posted: 25th Jul 2008 06:46
Thanks to all that helped me out on this.

911truth.org

http://www.loosechange911.com/finalcut/
Hybrid
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: In the p-block, group 7.
Posted: 25th Jul 2008 17:20
Does it work, though?

foobly
16
Years of Service
User Offline
Joined: 10th Feb 2008
Location:
Posted: 26th Jul 2008 07:01
Yeah, it works.

Thanks a lot.

911truth.org

http://www.loosechange911.com/finalcut/
Hybrid
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: In the p-block, group 7.
Posted: 26th Jul 2008 17:35
Good.

xXThe Dead OneXx
17
Years of Service
User Offline
Joined: 20th Oct 2007
Location: In My Own Little World/s
Posted: 26th Jul 2008 20:27
i was wondering if anybody would try my edited script.
I know it works for me, but i wanted to know if it works
for anyone else... can someone try it for me please?

Offset a little to the left. Or was it the right?
foobly
16
Years of Service
User Offline
Joined: 10th Feb 2008
Location:
Posted: 28th Jul 2008 01:05
Yours worked better than Hybrid's, actually.

Yours included the door closing behind you.

That said, Hybrid's code could be easily modified to include a closing door, so good job to the both of you.

911truth.org

http://www.loosechange911.com/finalcut/
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 28th Jul 2008 01:08
TDO, your script works, indeed.

A couple things to clean it up, tho:
- State 4 is not used and so... shouldn't even be in the script.
- In state 3, you never STOP decreasing the frames of animation for shutting the door. This causes unnecessary processing on the engine's part.


The one and only,


Whosoever says, "Don't sweat the small stuff," is obviously not a programmer.
Hybrid
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: In the p-block, group 7.
Posted: 28th Jul 2008 01:17
Other than that, I cannot see anything else either. Good work.

xXThe Dead OneXx
17
Years of Service
User Offline
Joined: 20th Oct 2007
Location: In My Own Little World/s
Posted: 1st Aug 2008 21:19
thanks, my main problem was trying to get
the "door is locked need key" HUD
to appear after the door closes.
i couldn't figure it out so i just
left it as is. I'm glad it works.

Offset a little to the left. Or was it the right?

Login to post a reply

Server time is: 2024-11-24 12:11:23
Your offset time is: 2024-11-24 12:11:23