Open Doors with Button only


(Boosted) #1

heya…ive searched but didnt find exactly what i want.

i want 3 doors to be opened with button only, they should be locked if u try to use them without the button.
also, the button needs to unlock them to open them and lock them afterwards again.
possible?
i havent found a way yet, i guess it may be only possible with some advanced scripting which i dont have experience with yet :expressionless:

any help appreciated!


(Flippy) #2

It may be possible by linking some entities together, like the func_button linked to the unlock entity (cant remember the name), and at the same time linked to the door (to open it), and also to a func_delay, which is in turn linked to a door locker?

Dunno… would be much easier using scripting.


(S14Y3R) #3

If all you want is 1 button to open 3 doors?
Or, is that button supposed to unlock those doors so they then work normally?

1 button to open 3 doors is relatively easy, whereas the latter is a little(shitload) more complicated.

I can throw something together for you, just specify exactly what you need.


(Boosted) #4

what i need is:
the doors are locked by default.
when i press the button the doors will unlock and open.
but after closing again the doors need to be locked again.
that theres only 1 way to open the doors at any time - the button :slight_smile:

ive tried around quite a bit but didnt find a way yet…
but as i said, im still a newbie, so what do i know :slight_smile:


(Nail) #5

like the garage doors in Fuel Dump ?


(Boosted) #6

not quite, my doors need to close by itself again.


(Flippy) #7

He means a normal door (like a func_door_rotating) which is locked. You cannot open it by walking up to it and using F.

However, there is a button, which will open the door. Once the door has closed again (I believe there’s a 4,5 second delay between open and close) it needs to be locked again.

There’s an entity called a ‘target_lock’ which must target the door. This entity can lock (‘key’ = 0) or unlock (‘key’ = -1) the door it is connected to. Activating this entity via script or via a func_button maybe will lock or unlock the door.
So this is the entity you are looking for. You need two of them, one to unlock the door and one to lock it again.

I’m not sure if this works but you can always try:

Create a ‘func_door_rotating’ and give it a ‘targetname’ of “door1” and a ‘key’ of “-1”.

Create two ‘target_lock’ entities, give one a ‘key’ of “-1” and a ‘targetname’ of “door1_lock” and the other one a ‘key’ of “0” with a ‘targetname’ of “door1_unlock”.
Give both ‘target_lock’ entities a ‘target’ of “door1”.

There should be two arrows pointing towards the door now.

Then, create a ‘func_button’ if you have it, or else a ‘func_invisible_user’.
Give it a ‘target’ of “door1_unlock”.
Give it a ‘delay’ of 5 seconds.

Create two ‘target_delay’ entities and make the ‘func_button’ target them both (arrow towards target_delays). Set the ‘wait’ key of nr1 to about 0.01 seconds. Set the ‘wait’ key of the other to about 5 seconds.

Have the first ‘target_delay’ (0,01s) entity target the door (func_door_rotating) and have the other target_delay (5s) target the ‘target_lock’ with targetname “door1_unlock”.

Again, not sure if this works, didn’t test it, just came up with this off the top of my head…

The logic behind it:

  1. Button unlocks the otherwise locked door.
  2. Button triggers a target_delay, which waits 0.01 seconds and then triggers the door to open.
  3. Button also triggered another target_delay, which waits 5 seconds (the door should have closed again by now) and locks the door again.

I can see quite an number of flaws here and also things that are probably not even neccesary… For example, I don’t know if you have to wait 0.01 s before actually opening the door. it might just work just aswell without the delay. I also don’t know if you need to wait for the door to close before locking it again. Hell, I don’t even know if you can open a door like this (by simply targetting it)!

Just try it and see what you can come up with. If this doesn’t work you’re probably best off trying to create a simple script for it… It’s really easy.


(kamikazee) #8

Script is the way to go. I messed around with those target_lock and target_unlock entities and they are easy to mess up. Also, you get a “locked” icon when you approach the door and the respective sound when you try to use it.

Using a script mover might work as good, if not better.


(Boosted) #9

^ but theres my problem - experience with scripting, about zero.
well, ive done forwards spawns with the help of tutorials, but thats about it.

i guess ive got to try flippys (maybe) solution for now :slight_smile:


(Flippy) #10

Try looking at things like the hatch on battery, they work in the same way, the only difference is that the ‘button’ (which is a ‘func_invisible_user’) is right on top of the hatch instead of somewhere else… But that’s just a matter of moving the entity.


(S14Y3R) #11

Sorry for late reply, just woke up :lol:

I slapped this together before my coffee, so there’s no sounds, but it works.

-When calling simultaneous actions, there is a trigger global xx command, which did the trick here.
-Play with the wait 2000 if you want them to stay open longer
-Play with door speeds in faceangles x x x speed(is time to complete rotation, not rotation speed)

Script


game_manager
{
	spawn
	{
		wm_axis_respawntime	2
		wm_allied_respawntime	2
		wm_number_of_objectives 1
		wm_set_round_timelimit	30

	}
}

switch_1
{
	spawn
	{
		accum 1 set 0
	}

	activate axis
	{
 		trigger self func
	}

	activate allies
	{
 		trigger self func
	}

	trigger func
	{
		accum 1 abort_if_not_equal 0
		accum 1 set 1
		trigger global open
		wait 2000
		trigger global close
		accum 1 set 0
	}
}

door_1
{
	trigger open
	{
		faceangles 0 90 0 500
	}

	trigger close
	{
		faceangles 0 0 0 500
	}
}

door_2
{
	trigger open
	{
		faceangles 0 90 0 500
	}

	trigger close
	{
		faceangles 0 0 0 500
	}
}

door_3
{
	trigger open
	{
		faceangles 0 90 0 500
	}

	trigger close
	{
		faceangles 0 0 0 500
	}
}

The map info: just copy/paste this into a blank map with wordpad or something.

Map:


// entity 0
{
"_color" "1.000000 1.000000 1.000000"
"ambient" "50"
"classname" "worldspawn"
"mapcoordsmaxs" "512 -512"
"mapcoordsmins" "-512 512"
// brush 0
{
( 512 512 -272 ) ( -512 512 -272 ) ( -512 -448 -272 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( -512 -512 -208 ) ( 512 -512 -208 ) ( 512 -512 -272 ) common/caulk 0 -32 0 0.500000 0.500000 0 0 0
( 512 -448 -208 ) ( 512 512 -208 ) ( 512 512 -272 ) common/caulk 0 -32 0 0.500000 0.500000 0 0 0
( 512 512 -208 ) ( -512 512 -208 ) ( -512 512 -272 ) common/caulk 0 -32 0 0.500000 0.500000 0 0 0
( -512 512 -208 ) ( -512 -448 -208 ) ( -512 -448 -272 ) common/caulk 0 -32 0 0.500000 0.500000 0 0 0
( -512 512 -256 ) ( 512 512 -256 ) ( -512 -448 -256 ) assault_rock/concrete_m02 0 0 0 0.500000 0.500000 0 0 0
}
// brush 1
{
( -512 -448 272 ) ( -512 512 272 ) ( 512 512 272 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( -512 -512 -176 ) ( 512 -512 -176 ) ( 512 -512 -240 ) common/caulk 0 32 0 0.500000 0.500000 0 0 0
( 512 -448 -176 ) ( 512 512 -176 ) ( 512 512 -240 ) common/caulk 0 32 0 0.500000 0.500000 0 0 0
( 512 512 -176 ) ( -512 512 -176 ) ( -512 512 -240 ) common/caulk 0 32 0 0.500000 0.500000 0 0 0
( -512 512 -176 ) ( -512 -448 -176 ) ( -512 -448 -240 ) common/caulk 0 32 0 0.500000 0.500000 0 0 0
( -512 512 256 ) ( -512 -448 256 ) ( 512 512 256 ) skies/sd_railgun 0 0 0 0.500000 0.500000 0 0 0
}
// brush 2
{
( 512 512 -256 ) ( -512 512 -256 ) ( -512 -448 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( -512 -448 256 ) ( -512 512 256 ) ( 512 512 256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( -512 -512 -192 ) ( 512 -512 -192 ) ( 512 -512 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( 496 -448 -192 ) ( 496 512 -192 ) ( 496 512 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( -496 512 -192 ) ( -496 -448 -192 ) ( -496 -448 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( 512 -496 -192 ) ( -512 -496 -192 ) ( 512 -496 -256 ) assault/awall_m01 0 0 0 0.500000 0.500000 0 0 0
}
// brush 3
{
( 512 512 -256 ) ( -512 512 -256 ) ( -512 -448 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( -512 -448 256 ) ( -512 512 256 ) ( 512 512 256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( -512 -512 -192 ) ( 512 -512 -192 ) ( 512 -512 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( 512 -448 -192 ) ( 512 512 -192 ) ( 512 512 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( 512 512 -192 ) ( -512 512 -192 ) ( -512 512 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( 496 512 -192 ) ( 496 -448 -192 ) ( 496 512 -256 ) assault/awall_m01 0 0 0 0.500000 0.500000 0 0 0
}
// brush 4
{
( 512 512 -256 ) ( -512 512 -256 ) ( -512 -448 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( -512 -448 256 ) ( -512 512 256 ) ( 512 512 256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( 496 -448 -192 ) ( 496 512 -192 ) ( 496 512 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( 512 512 -192 ) ( -512 512 -192 ) ( -512 512 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( -496 512 -192 ) ( -496 -448 -192 ) ( -496 -448 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( -512 496 -192 ) ( 512 496 -192 ) ( -512 496 -256 ) assault/awall_m01 0 0 0 0.500000 0.500000 0 0 0
}
// brush 5
{
( 512 512 -256 ) ( -512 512 -256 ) ( -512 -448 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( -512 -448 256 ) ( -512 512 256 ) ( 512 512 256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( -512 -512 -192 ) ( 512 -512 -192 ) ( 512 -512 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( 512 512 -192 ) ( -512 512 -192 ) ( -512 512 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( -512 512 -192 ) ( -512 -448 -192 ) ( -512 -448 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 0 0
( -496 -448 -192 ) ( -496 512 -192 ) ( -496 -448 -256 ) assault/awall_m01 0 0 0 0.500000 0.500000 0 0 0
}
// brush 6
{
( 160 -256 -256 ) ( 112 -256 -256 ) ( 112 -288 -256 ) assault_rock/concrete_m02 0 0 0 0.500000 0.500000 0 0 0
( 112 -288 -224 ) ( 112 -256 -224 ) ( 160 -256 -224 ) assault_rock/concrete_m02 0 0 0 0.500000 0.500000 0 0 0
( 112 -288 -128 ) ( 160 -288 -128 ) ( 160 -288 -256 ) assault_rock/concrete_m02 0 0 0 0.500000 0.500000 0 0 0
( 160 -288 -128 ) ( 160 -256 -128 ) ( 160 -256 -256 ) assault_rock/concrete_m02 0 0 0 0.500000 0.500000 0 0 0
( 160 -256 -128 ) ( 112 -256 -128 ) ( 112 -256 -256 ) assault_rock/concrete_m02 0 0 0 0.500000 0.500000 0 0 0
( 128 -256 -128 ) ( 128 -288 -128 ) ( 128 -288 -256 ) assault_rock/concrete_m02 0 0 0 0.500000 0.500000 0 0 0
}
}
// entity 1
{
"spawnflags" "3"
"origin" "282 -100 -208"
"classname" "team_CTF_bluespawn"
"angle" "270"
}
// entity 2
{
"spawnflags" "3"
"origin" "378 -100 -208"
"classname" "team_CTF_redspawn"
"angle" "270"
}
// entity 3
{
"description" "spawnax"
"spawnflags" "1"
"origin" "408 -54 -192"
"classname" "team_WOLF_objective"
}
// entity 4
{
"description" "spawnal"
"spawnflags" "2"
"origin" "256 -54 -192"
"classname" "team_WOLF_objective"
}
// entity 5
{
"scriptname" "game_manager"
"origin" "330 -70 -160"
"classname" "script_multiplayer"
}
// entity 6
{
"origin" "330 -100 -208"
"classname" "info_player_deathmatch"
"angle" "270"
}
// entity 7
{
"spawnflags" "2"
"origin" "304 -30 -192"
"classname" "info_player_intermission"
"angle" "270"
}
// entity 8
{
"spawnflags" "1"
"origin" "364 -30 -192"
"classname" "info_player_intermission"
"angle" "270"
}
// entity 9
{
"classname" "script_mover"
"spawnflags" "2"
"targetname" "door_1"
"scriptname" "door_1"
// brush 0
{
( 712 -396 -144 ) ( 248 -396 -144 ) ( 248 -732 -144 ) common/origin 16 8 0 0.500000 0.500000 0 15 0
( 248 -708 -128 ) ( 248 -372 -128 ) ( 712 -372 -128 ) common/origin 16 8 0 0.500000 0.500000 0 15 0
( -88 -396 72 ) ( 376 -396 72 ) ( 376 -396 64 ) common/origin 16 0 0 0.500000 0.500000 0 15 0
( 264 -412 120 ) ( 264 -76 120 ) ( 264 -76 112 ) common/origin -8 0 0 0.500000 0.500000 0 15 0
( 712 -380 72 ) ( 248 -380 72 ) ( 248 -380 64 ) common/origin 16 0 0 0.500000 0.500000 0 15 0
( 248 -380 72 ) ( 248 -716 72 ) ( 248 -716 64 ) common/origin -8 0 0 0.500000 0.500000 0 15 0
}
// brush 1
{
( 256 -368 40 ) ( 256 -704 40 ) ( 256 -704 32 ) metal_misc/metal_m03 0 0 0 0.500000 0.500000 0 0 0
( 672 -384 40 ) ( 208 -384 40 ) ( 208 -384 32 ) metal_misc/metal_m03 0 0 0 0.500000 0.500000 0 0 0
( 320 -464 40 ) ( 320 -128 40 ) ( 320 -128 32 ) metal_misc/metal_m03 0 0 0 0.500000 0.500000 0 0 0
( 16 -392 40 ) ( 480 -392 40 ) ( 480 -392 32 ) metal_misc/metal_m03 0 0 0 0.500000 0.500000 0 0 0
( 256 -696 -128 ) ( 256 -360 -128 ) ( 720 -360 -128 ) metal_misc/metal_m03 0 0 0 0.500000 0.500000 0 0 0
( 720 -384 -256 ) ( 256 -384 -256 ) ( 256 -720 -256 ) metal_misc/metal_m03 0 0 0 0.500000 0.500000 0 0 0
}
}
// entity 10
{
"scriptname" "door_2"
"targetname" "door_2"
"spawnflags" "2"
"classname" "script_mover"
// brush 0
{
( 120 -380 72 ) ( 120 -716 72 ) ( 120 -716 64 ) common/origin 56 0 0 0.500000 0.500000 0 15 0
( 584 -380 72 ) ( 120 -380 72 ) ( 120 -380 64 ) common/origin -48 0 0 0.500000 0.500000 0 15 0
( 136 -412 120 ) ( 136 -76 120 ) ( 136 -76 112 ) common/origin 56 0 0 0.500000 0.500000 0 15 0
( -216 -396 72 ) ( 248 -396 72 ) ( 248 -396 64 ) common/origin -48 0 0 0.500000 0.500000 0 15 0
( 120 -708 -128 ) ( 120 -372 -128 ) ( 584 -372 -128 ) common/origin -48 -56 0 0.500000 0.500000 0 15 0
( 584 -396 -144 ) ( 120 -396 -144 ) ( 120 -732 -144 ) common/origin -48 -56 0 0.500000 0.500000 0 15 0
}
// brush 1
{
( 592 -384 -256 ) ( 128 -384 -256 ) ( 128 -720 -256 ) metal_misc/metal_m03 0 0 0 0.500000 0.500000 0 0 0
( 128 -696 -128 ) ( 128 -360 -128 ) ( 592 -360 -128 ) metal_misc/metal_m03 0 0 0 0.500000 0.500000 0 0 0
( -112 -392 40 ) ( 352 -392 40 ) ( 352 -392 32 ) metal_misc/metal_m03 0 0 0 0.500000 0.500000 0 0 0
( 192 -464 40 ) ( 192 -128 40 ) ( 192 -128 32 ) metal_misc/metal_m03 0 0 0 0.500000 0.500000 0 0 0
( 544 -384 40 ) ( 80 -384 40 ) ( 80 -384 32 ) metal_misc/metal_m03 0 0 0 0.500000 0.500000 0 0 0
( 128 -368 40 ) ( 128 -704 40 ) ( 128 -704 32 ) metal_misc/metal_m03 0 0 0 0.500000 0.500000 0 0 0
}
}
// entity 11
{
"classname" "script_mover"
"spawnflags" "2"
"targetname" "door_3"
"scriptname" "door_3"
// brush 0
{
( 456 -396 -144 ) ( -8 -396 -144 ) ( -8 -732 -144 ) common/origin 16 8 0 0.500000 0.500000 0 15 0
( -8 -708 -128 ) ( -8 -372 -128 ) ( 456 -372 -128 ) common/origin 16 8 0 0.500000 0.500000 0 15 0
( -344 -396 72 ) ( 120 -396 72 ) ( 120 -396 64 ) common/origin 16 0 0 0.500000 0.500000 0 15 0
( 8 -412 120 ) ( 8 -76 120 ) ( 8 -76 112 ) common/origin -8 0 0 0.500000 0.500000 0 15 0
( 456 -380 72 ) ( -8 -380 72 ) ( -8 -380 64 ) common/origin 16 0 0 0.500000 0.500000 0 15 0
( -8 -380 72 ) ( -8 -716 72 ) ( -8 -716 64 ) common/origin -8 0 0 0.500000 0.500000 0 15 0
}
// brush 1
{
( 0 -368 40 ) ( 0 -704 40 ) ( 0 -704 32 ) metal_misc/metal_m03 0 0 0 0.500000 0.500000 0 0 0
( 416 -384 40 ) ( -48 -384 40 ) ( -48 -384 32 ) metal_misc/metal_m03 0 0 0 0.500000 0.500000 0 0 0
( 64 -464 40 ) ( 64 -128 40 ) ( 64 -128 32 ) metal_misc/metal_m03 0 0 0 0.500000 0.500000 0 0 0
( -240 -392 40 ) ( 224 -392 40 ) ( 224 -392 32 ) metal_misc/metal_m03 0 0 0 0.500000 0.500000 0 0 0
( 0 -696 -128 ) ( 0 -360 -128 ) ( 464 -360 -128 ) metal_misc/metal_m03 0 0 0 0.500000 0.500000 0 0 0
( 464 -384 -256 ) ( 0 -384 -256 ) ( 0 -720 -256 ) metal_misc/metal_m03 0 0 0 0.500000 0.500000 0 0 0
}
}
// entity 12
{
"targetname" "switch_1"
"scriptname" "switch_1"
"classname" "func_invisible_user"
// brush 0
{
( 592 -256 -240 ) ( 128 -256 -240 ) ( 128 -592 -240 ) common/trigger 0 0 0 0.500000 0.500000 0 7 0
( 128 -560 -176 ) ( 128 -224 -176 ) ( 592 -224 -176 ) common/trigger 0 0 0 0.500000 0.500000 0 7 0
( -144 -304 48 ) ( 320 -304 48 ) ( 320 -304 32 ) common/trigger 0 0 0 0.500000 0.500000 0 7 0
( 176 -336 48 ) ( 176 0 48 ) ( 176 0 32 ) common/trigger 0 0 0 0.500000 0.500000 0 7 0
( 560 -240 48 ) ( 96 -240 48 ) ( 96 -240 32 ) common/trigger 0 0 0 0.500000 0.500000 0 7 0
( 112 -256 48 ) ( 112 -592 48 ) ( 112 -592 32 ) common/trigger 0 0 0 0.500000 0.500000 0 7 0
}
// brush 1
{
( 120 -252 72 ) ( 120 -588 72 ) ( 120 -588 64 ) common/origin -8 0 0 0.500000 0.500000 0 15 0
( 584 -252 72 ) ( 120 -252 72 ) ( 120 -252 64 ) common/origin 16 0 0 0.500000 0.500000 0 15 0
( 136 -284 120 ) ( 136 52 120 ) ( 136 52 112 ) common/origin -8 0 0 0.500000 0.500000 0 15 0
( -216 -268 72 ) ( 248 -268 72 ) ( 248 -268 64 ) common/origin 16 0 0 0.500000 0.500000 0 15 0
( 120 -580 -128 ) ( 120 -244 -128 ) ( 584 -244 -128 ) common/origin 16 8 0 0.500000 0.500000 0 15 0
( 584 -268 -144 ) ( 120 -268 -144 ) ( 120 -604 -144 ) common/origin 16 8 0 0.500000 0.500000 0 15 0
}
}

You just need to texture the doors, and add in the sounds you want.


(Boosted) #12

:o thats one long script!

since i want to add it to an existing map i guess ill have to find out the exact coordinates for the doors?
is there an easy way to do that?

thanks for ur work :slight_smile:


(Diego) #13

Create an info_null entity. (or most any other one) In the entity window, it will tell you it’s location. Place it at the origin of your doors.


(S14Y3R) #14

lol, that’s not a long script :stuck_out_tongue: its just a little box/tester map.

to get your doors though, create a new blank map in radiant, then save it-empty as door_test.map or something.

open that map in your maps folder with Wordpad or notepad,
copy/paste the map info into the blank map, and save it.

re-open in radiant, open the wordpadded map and it will be there, you can then select the doors/button and either edit/copy then paste in your open map, or while they’re selected do file/save as… and save as doors.map or something.

Then just import it into your map, when you first import stuff, its always selected/highlighted, so you can move it to a neutral location. Then grab them one at a time to put where you need.

short version


Alternatively, just use the script and create 3 script_movers(door_1/2/3) and a func_invisible_user(switch_1) just set the targetname/scriptname and check solid on the script_movers.

gl


(Boosted) #15

one last thing…
i forgot to say my doors should not rotate, they need to move from the right to the left.
what do i need to change to get that?


(S14Y3R) #16

D’oh! Its easy to switch from rotating to sliding, you need 2 path_corners for each door. One for closed, one for open. makes sense, eh?

modify your script so instead of faceangles, use gotomarker (path_corner targetname) (speed)

like this:


door_1
{
   trigger open
   {
      gotomarker d1_open 100  //100 is speed, not time to finish like faceangles
   }

   trigger close
   {
      gotomarker d1_close 500
   }
}

do the same for the other doors.
path_corner only needs a targetname, no scriptname.
just name the path_corner’s conventionally, d1_open d1_close, d2_open d2_close, etc…

have a go at setting it up, its basic stuff.