PDA

View Full Version : Pressure pad



Streamfox
22-08-2016, 03:15 PM
I thought I copy paste my post into this tutorial section to preserve it for future usage, if someone ever wanna have some pressure pad.
This entsystem lets you have a "pressure pad" which toggles a light ON and OFF, depends on if a player is standing on the pad.
If player is standing on it light goes ON and pad goes down, if leaves light goes OFF and pad goes up.

Put a func_door on the ground:


name: pressure_light_door
obey trigger mode: yes, even when moving
yaw: down
lip: 2
flags:
[x] toggle


Then put some slim(2-8 units tall) trigger_multiple on the door:


target: pressure_cvalue
flags:
[x] fire on enter
[x] fire on exit


The dark brush is the pad, and null textured brush is the trigger_multiple:
https://dl.dropboxusercontent.com/u/58320647/tutorial/pressurebutn.jpg

Create a trigger_changevalue:


name: pressure_cvalue
destination entity: pressure_target
destiantion key: $i_num
source value: 1
action: XOR


You'll need an info_target, turn off smart edit and add a new keyvalue:


name: pressure_target
$i_num: 0


Next add some trigger_condition:


monitored entity: pressure_target
monitored key: $i_num
compare-value (alternative): 1
comparator: == (equal)
target for 'true'-case: pressure_relay_on
target for 'false'-case: pressure_relay_off


Now two trigger_relays:


name: pressure_relay_on
target: pressure_light_door
trigger state: on




name: pressure_relay_off
target: pressure_light_door
trigger state: off


Add some light:


light: pressure_light_door
flags:
[x] initially dark


The light and door entity share the name: pressure_light_door, so both being toggled respectively when player stepping on the pad.
You can replace the light with something else, like a door, which only stays open as long as a player is on the button.
Or set the trigger_multiple's flags to "no client" and "pushables", so it only activates when you put a heavy crate on it or something.

Zorbos
22-08-2016, 04:27 PM
Clever usage of entities. Nice work!

AdamR
23-08-2016, 02:52 AM
Nice build. I'm not convinced you'd need a door for this, or that many entities though.

Puchi
23-08-2016, 07:40 AM
I am not sure there.
You could use a func_button like Hezus suggested, which would be my first idea aswell, but you cannot easily control when the func_button moves back to the upper position.
Without recreating this and only looking at the setup, to switch something on/off this should be the most simple system.

Hezus
23-08-2016, 09:07 AM
As Puchi mentions: seems like a pretty complex setup. Here's is the most simple setup I could come up with.

1. Create a pressure plate and turn it into a func_door. Angle to 'down', speed to 20 and name it 'pressure_plate'. Set the lip to '2' and tag Flags 'Toggle'.

2. Create a trigger_multiple above that plate (same size, small height). Set the target to 'pressure_*'. Use Flag 'Fire on Enter'.

3. Copy the trigger_multiple you just made and change the flag to 'Fire on Exit'. Put it slightly above the other trigger_multiple.

4. Put a light / door / whatever you want to trigger and call it 'pressure_something'. (the * wildcard will search for anything starting with 'pressure_').

Streamfox' way would use some more entities but accomplishes the same. Use whichever you like.. no pressure ;)

Streamfox
23-08-2016, 10:26 AM
Nice build. I'm not convinced you'd need a door for this, or that many entities though.

The door on the ground is the cosmetic effect imitating the pressure pad.


As Puchi mentions: seems like a pretty complex setup. Here's is the most simple setup I could come up with.

And I just broke it, by walking all over the "pressure_plate" until they stuck in the open position:

https://dl.dropboxusercontent.com/u/58320647/random/20160823171908_1.jpg

Before you say, I tested with others my system this way and couldn't break it in any way.

Hezus
23-08-2016, 02:37 PM
Could you explain how you broke it exactly? I've walked all over the pressure plate 10 times and it worked. What do you refer to when you say 'they'? There's only 1 plate, right?

Streamfox
23-08-2016, 03:16 PM
Yes there's one plate and the test door on the wall sharing same targetname. 'They' refers to plate on the ground and blue brush door on the wall.
About breaking it. I just like was constantly and quickly walking back and forth on the plate, until both the plate on the ground and test door got "stuck" in the open/pressed down position.
Kind of like reversing the effect, plate goes up and door goes down, when standing on the plate.

Maybe not that easy to break but there's the chance.