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 / key on a switch to open door

Author
Message
X filer
18
Years of Service
User Offline
Joined: 30th Apr 2006
Location: Sebring, Florida
Posted: 4th May 2006 03:51
I want a door controlled by a switch, but I want the switch only to activate if I have a key.I've been playing with it now for hours and inbetween the builds, searching the forums.

I have: MaidDoor with (use key) Switch
I have: Switch with ( use key) MaidKey and (if used) MaidDoor
I have: MaidKey with (if used)Switch.
I have the switch1 script for the switch and doorremote for the door.

I know it can be done. I just can't figure it out.
FredP
Retired Moderator
18
Years of Service
User Offline
Joined: 27th Feb 2006
Location: Indiana
Posted: 4th May 2006 16:45
Put the switch on the other side of a door that you need that key to open.Then you will have to have that key to get to the switch.

FLa
Where you can find my demo:http://www.savefile.com/files/6970524
uman
Retired Moderator
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 4th May 2006 23:22 Edited at: 4th May 2006 23:25
It could be done one way or another.

You have 3 entities which need to be controlled of course and in most circumstances FPSC like most engines use entity inertactions of 2. e.g. switch and door.

What you really need is a separate little script which would be attached to an entity in this case a key entity which in turn activates the switch and which in turn activates the door. You could then place the key anywhere you wish.

If you cant create the script then there are some enity activation scripts around the place I'm sure.

Effectively you need the key to be a trigger to work (activate) the switch so you would really need all 3 entities scripts - switch and door could be default possibly or modifed ones - the key script may also be able to use a default script for but may have to make amendments to it. You may well have to modify all 3 to get it to function as you wish. Use copies of default ones of course not the originals.

One route you may be able to use is use a trigger zone to acivate the switch and being invisible place a key entity (no AI as such in script except for using any pickup data - you wont need to specify an ifused name if its a fake - otherwise you will so could use the default script) in the zone so when its picked up a little trickery and the zone does the work but the player thinks its the actual key.


In any case if you look closely at zones scripts you may gain an understanding of how triggers work - a very useful excercise.


Zones can be a bit tricky and fussy sometimes about which object types they work well with. If a default trigger zone does not work with anyone try creating your own trigger entity from a simple invisible box and attach any trigger script to it default or not.

gps
19
Years of Service
User Offline
Joined: 16th Dec 2004
Location: England
Posted: 4th May 2006 23:30 Edited at: 4th May 2006 23:33
@I Has Returned - I think he means that he wants a switch activated by a key which then opens a door, a bit like a modern hotel door - where the key is actually a magnetic swipe card.

Have you looked at the script for doors requiring a key? It's just guesswork, but perhaps if you can work out the bit of the script that keeps the door from opening unless you have a key, you could then apply that to the switch script?

EDIT

Oops, cross-posted with Uman - I suggest you ignore me and listen to him

X filer
18
Years of Service
User Offline
Joined: 30th Apr 2006
Location: Sebring, Florida
Posted: 4th May 2006 23:57
thank you, I think the trigger is the best option(or, the easier option)I need to and want to work on scripting, but right now I'm gathing all the little script tuts to pratice.
thanks again everyone
uman
Retired Moderator
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 5th May 2006 00:34
gps,

Nah - nice to see you keep popping in here - I trust you are well?

You have pointed in the right direction there. In fact all of my keys are security card type and dont look like keys. I might set all this up myself at some stage - though I have loads of other things to do at the moment. One thing that puts me off is that to really look like a swipe card is being used one would have to set up the player with hands that hold a swipe card and actually animate the action of doing so for best effect - currently I would rather spend that time on hands and weapons and new game characters.

Anyway I should have added that if using a trigger zone to activate a switch as described above then the trigger zone would carry the if used identifiyer activating the switch - the key being just picked up and actually doing nothing else. In this case the trigger zone would best work I would think using the main script : plrinzone_activateifused from the scripts folder unless your write your own.

Hope thats a liitle clearer - as mud I guess.

uman
Retired Moderator
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 5th May 2006 02:00 Edited at: 5th May 2006 02:00
Attached is a simple script which anyone can use to activate an entity.

I use this one to activate any entity which has simple animation which it needs to carry out. For instance a machine pumping a cylinder up and down. It does not contain any uneeded AI commands so if you have a complex entity with various behavious you want performed you will have to add the code. Thats not its purpose as I use it. Its a simple entity activation script.

You use this script as an entities main script in conjuction with a trigger zone. The tirgger zone needs to use plrinzone activateifused.fpi and needs the name of the entity to be triggered to life in its ifused field to call the activation script attached.

Thus it can be used for many purposes including setting up the users oiriginal post request of activating a switch on contact with the appropriate trigger zone. In fact in that instance a key could be used instead of a trigger zone If that was given an appropriate script so there are all kinds of options.

Keep this script safe as its a very useful function script and invaluable in lots of situations as that extra missing link in many gameplay scenarios.

If you search and find the other different activation scripts in my Load and unload entities post then you have some powerful and very useful scripts to add to your collection.

Attachments

Login to view attachments
uman
Retired Moderator
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 5th May 2006 02:01 Edited at: 5th May 2006 02:02
Save you searching heres another useful script - its the zoneactivate script.

Attachments

Login to view attachments
X filer
18
Years of Service
User Offline
Joined: 30th Apr 2006
Location: Sebring, Florida
Posted: 5th May 2006 02:40
thanks again.I went and bought some duct tape to wrap around my head to keep my mind from exploding, until I can get a handle on this...scripting thing. In time I'll be able to remove the tape.
thanks uman
I like to open up the script and play with it. The other day I changed the pickup key script. I recorded my voice saying " a key "
so now when I pick up a key it talks, as if the players guy is talking... It's fun.I figure I'll learn it quicker.
FredP
Retired Moderator
18
Years of Service
User Offline
Joined: 27th Feb 2006
Location: Indiana
Posted: 5th May 2006 06:28
Just do what I do.Go to the shrink and have him or her up the meds again...lol
You'll find out that usually it's going to be a small problem to fix although a lot of these small problems can get on your nerves.
Keep trying and you will perservere.

FLa
Where you can find my demo:http://www.savefile.com/files/6970524
Les Horribres
19
Years of Service
User Offline
Joined: 20th Nov 2005
Location: My Name is... Merry
Posted: 5th May 2006 07:25
You know... I am really tired... attached is a bunch of my scripts... have fun... what you want should be in there.

We all have our inner noob. Join the NJL, and have more fun!
I believe society is flawed; our notions on life, on child rearing, stem too far back to be of relevance in this day and time.

Attachments

Login to view attachments
gps
19
Years of Service
User Offline
Joined: 16th Dec 2004
Location: England
Posted: 5th May 2006 09:34
Quote: "gps,

Nah - nice to see you keep popping in here - I trust you are well?"


Every once in a while I don my pith helmet, gather up my torch and machete, and venture out from safety of the Models and Media forum, into the heart of darkness...

X filer
18
Years of Service
User Offline
Joined: 30th Apr 2006
Location: Sebring, Florida
Posted: 5th May 2006 15:51
thanks everyone
(one post)thanks for the scripts.the talk script is blank,just so you know...but there are a couple of them around. thanks again.

don't get annoyed, I'm sure i'll be posting a million and one times.
I've already have questions backing up, but i'll wait to figure them out myself first,then......watch out
K Jah
19
Years of Service
User Offline
Joined: 13th Jun 2005
Location: UK
Posted: 6th May 2006 02:41 Edited at: 6th May 2006 02:43
You really missed the obvious solution here. The switch should have a use key box when you right click on it. Put the name of your key in that box. And then put the name of the door in the if used box. Works for me.

Les Horribres
19
Years of Service
User Offline
Joined: 20th Nov 2005
Location: My Name is... Merry
Posted: 6th May 2006 04:40
@K Jah,
I hate to burst your bubble, but that won't work. UseKey is a variable, you NEED to have a script saying if plrhaskey=1 then blah blah...

We all have our inner noob. Join the NJL, and have more fun!
I believe society is flawed; our notions on life, on child rearing, stem too far back to be of relevance in this day and time.
X filer
18
Years of Service
User Offline
Joined: 30th Apr 2006
Location: Sebring, Florida
Posted: 6th May 2006 05:14
it doesn't work for me. Unless your using a different script. If so.....I'll take

Login to post a reply

Server time is: 2024-11-22 08:33:38
Your offset time is: 2024-11-22 08:33:38