unlock door from somewhere else

Post your scripting questions / solutions here

Moderator: Moderators

solar
Colour Sergeant
Posts: 99
Joined: Fri Mar 21, 2003 2:40 pm
Location: Toledo, OH

unlock door from somewhere else

Post by solar »

OK, I've done a lot of searching and can't find a thread that is exaclty what I need. Basically, all I need is a door that is locked and sounds like it is locked, but can be unlocked by a switch elsewhere. Can someone tell me an easy way to do this. Please provide me with both a way to simply unlock it and a way to make the switch triggerable so it will relock it if activated. I don't know which way I will use and would like to test both. Thx.
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

what kinda door? metal/wood then i'll give u ur reply
hope this helps, prob not cos it's all foreign 2 me :-/
solar
Colour Sergeant
Posts: 99
Joined: Fri Mar 21, 2003 2:40 pm
Location: Toledo, OH

Post by solar »

It's a wooden door. thx
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

place a trigger over the door that'll trigger the locking sound,
key: targetname
value: door_trigger
key: setthread
value: my_door

place a trigger over the object that'll trigger the door (i'e the switch)
key: targetname
value: door_switch_trigger
key: setthread
value: door_switch

make the door a script object
key: targetname
value: lockable_door

then scripting


main:
level.lockeddoor = 0
end

my_door:
if (level.lockeddoor == 0)
{self playsound door_wooden_locked}
else
{
door_trigger nottriggerable
lockable_door time 3
lockable_door rotateYup 90
lockable_door waitmove
wait 5
lockable_door rotateYdown 90
lockable_door waitmove
door_trigger triggerable
}
end

door_switch:
if (level.lockeddoor ==0)
{level.lockeddoor = 1}
else
{level.lockeddoor = 0}
end


//though you may still want to add a team check if u need 1
hope this helps, prob not cos it's all foreign 2 me :-/
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Simple

Post by tltrude »

Her is an alterative remote door. Just download my tutorial map and look for the door with switches.
http://pages.sbcglobal.net/tltrude/Temp ... ngdoor.zip

There are also a locked door that has to be shot or blown open.
Tom Trude,

Image
solar
Colour Sergeant
Posts: 99
Joined: Fri Mar 21, 2003 2:40 pm
Location: Toledo, OH

Post by solar »

Didn't work nuggets, don't know why. Here is my logfile excerpt:

logfile:
unknown command: door_trigger
door_trigger nottriggerable (maps/obj/dbenztest1.scr, 35)
^

unknown command: lockable_door
lockable_door time 3 (maps/obj/dbenztest1.scr, 36)
^

unknown command: lockable_door
lockable_door rotateYup 90 (maps/obj/dbenztest1.scr, 37)
^

unknown command: lockable_door
lockable_door waitmove (maps/obj/dbenztest1.scr, 38)
^

unknown command: lockable_door
lockable_door rotateYdown 90 (maps/obj/dbenztest1.scr, 40)
^

unknown command: lockable_door
lockable_door waitmove (maps/obj/dbenztest1.scr, 41)
^

unknown command: door_trigger
door_trigger triggerable (maps/obj/dbenztest1.scr, 42)
^

^~^~^ Script file compile error: Couldn't compile 'maps/obj/dbenztest1.scr'
^~^~^ Game (Event: 'setthread', Object: 'TriggerUse') : Script 'maps/obj/dbenztest1.scr' was not properly loaded

^~^~^ Game (Event: 'setthread', Object: 'TriggerUse') : Script 'maps/obj/dbenztest1.scr' was not properly loaded
Will try your version as soon as I get a chance Tom, thx.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Just add key 'lock' (no value) and your door is locked 8)

Later you can do $door unlock or something to unlock the door.
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

$

Post by tltrude »

All those targetnames in the script need the $ symbol in front of them.

$door_trigger
$lockable_door
Tom Trude,

Image
solar
Colour Sergeant
Posts: 99
Joined: Fri Mar 21, 2003 2:40 pm
Location: Toledo, OH

Post by solar »

Tom, I'm at work and can only view the map in radiant and I have the worst system here to boot. I'm having difficulty finding the door you're referring to. Can you pinpoint it for me? Thx.
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

door

Post by tltrude »

It is made of window texture and has to posts with switches next to it. It also is the only door with script_origins that act as fake players.
Tom Trude,

Image
solar
Colour Sergeant
Posts: 99
Joined: Fri Mar 21, 2003 2:40 pm
Location: Toledo, OH

Post by solar »

well nuggets, got it to work somewhat. The door rotates across its center axis and there's no way to bypass it, so I don't see how you can make "rotateYup" work. It also won't stay open if you stand next to it and there is no sound. The playsound won't work because of ubersound, I think.

Basically, I need this to work using a normal func_rotating door. JV- can you elaborate a bit on what you mentioned, maybe give me a sample script and I'll try to work out the rest. Thx
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Origin

Post by tltrude »

You need an origin brush at the hinge of a script_object door just like you do with a func_rotating door. Normally the center of an object is its pivot point. But if you add an origin brush to the object, the center of that brush becomes the pivot point.
Tom Trude,

Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Example (I assume your door has targetname door):

Code: Select all

main:
  $door lock
  $door.locked = 1
end

switch:
  // called from setthread
  if($door.locked)
  {
    $door.locked = 0
    $door unlock
  }
  else
  {
    $door.locked = 1
    $door lock
  }
end
That's all, just use a trigger_use with setthread switch like nuggets suggested. You don't need a trigger for the locked sound.
Image
solar
Colour Sergeant
Posts: 99
Joined: Fri Mar 21, 2003 2:40 pm
Location: Toledo, OH

Post by solar »

So let me get this straight before I waste time with a compile, jv. In your example, the door is a func_rotating door, not a script object- correct?
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Yes

Post by tltrude »

Yes, his script is for a normal rotating door targetnamed door.


If you want the switch to play the locked sound you can add this line under the door lock and unlock lines.

$switch playsound door_metal_locked_clue

or

$switch playsound door_wood_locked_clue

Of course, you can have the door play that sound if you like. If it is a rotating switch you can add these lines to make it rotate on and off.

$switch anim turn

and

$switch anim idle
Tom Trude,

Image
Post Reply