if else condition
For my first custom map, I'm stuck at a point where I need to have some kind of if/else statement.
What I need to accomplish is :
Whenever a cube hit a prop_floor_cube_button, I want to compare the value of a running timer. If the timer value is less then 16 seconds OR more than 17 seconds, I want to kill the player.
Basically, the player needs to put the cube on the prop_floor_cube_button between 16 and 17 seconds.
What is working right now :
- I got a button that once pressed, get the timer to start.
- I got a logic to kill the player.
Can anyone help me on this?
Best regards
Sylvain
Vordwann wrote:
sounds like a reflex map!
It's more like "hear a song" and act about it 
From the sound of it, you want to use two logic_compares.
Mevious wrote:
From the sound of it, you want to use two logic_compares.
http://developer.valvesoftware.com/wiki/Logic_compare
Thanks Mevious, this make sense now.
All I need to find out now is how to "setValue" the current value of my logic_timer to my logic_compare and I will be fine.
Anyone got an idea?
Regards,
Sylvain.
It's a bit different, but here's how I would do it. Make a timer that runs for 16 seconds and add these outputs:
OnTimer : trigger_to_kill_player : Disable : 0.00
OnTimer : trigger_to_kill_player : Enable : 1.00
OnTimer : trigger_to_kill_player_end : Trigger : 2.00
When the player places a cube on the button it should try to trigger the "trigger_to_kill_player", and if the player does it at the right time then he should be in good shape.
In this case "trigger_to_kill_player_end" is used to kill the player if he doesn't ever put the box on the button. Simply send the outputs from the button:
OnPressed : trigger_to_kill_player : Trigger : 0.00
OnPressed : trigger_to_kill_player_end : Disable : 0.00
Does that make sense? It's kind of a different way of thinking out it, but I think it'll work.
Mevious wrote:
Oh I thought you had it sorted out how you are sending the value, so I wasn't worrying about that part. To be honest I don't really know a lot about timers and sending values, and I'm not sure how to do this the way you're trying to.It's a bit different, but here's how I would do it. Make a timer that runs for 16 seconds and add these outputs:
OnTimer : trigger_to_kill_player : Disable : 0.00
OnTimer : trigger_to_kill_player : Enable : 1.00
OnTimer : trigger_to_kill_player_end : Trigger : 2.00When the player places a cube on the button it should try to trigger the "trigger_to_kill_player", and if the player does it at the right time then he should be in good shape.
In this case "trigger_to_kill_player_end" is used to kill the player if he doesn't ever put the box on the button. Simply send the outputs from the button:
OnPressed : trigger_to_kill_player : Trigger : 0.00
OnPressed : trigger_to_kill_player_end : Disable : 0.00Does that make sense? It's kind of a different way of thinking out it, but I think it'll work.
My "trigger_to_kill_player" does start on "toggle" even if it's disabled. I say "toggle" here because I didn't find any "trigger" call as you were mentioning. Maybe I'm not using the good objects here. As such, the player always get killed, no mater what he does.
This is what I got :
trigger_to_kill_player and trigger_to_kill_player_end are "trigger_hurt" objects.
OnTimer : trigger_to_kill_player : Disable : 0.00
OnTimer : trigger_to_kill_player : Enable : 1.00
OnTimer : trigger_to_kill_player_end : Toggle : 2.00
Button:
OnPressed : trigger_to_kill_player : Toggle : 0.00
OnPressed : trigger_to_kill_player_end : Disable : 0.00
I'm most likely doing something wrong here ; I've been on Hammer for only one week now. Any help will be greatly appreciated.
Regards,
Sylvain.
E.g.,
logic_timer:
OnTimer : kill_relay_01 : Disable : 0.00
OnTimer : kill_relay_01 : Enable : 1.00
OnTimer : kill_relay_02 : Trigger : 2.00
prop_floor_button:
OnPressed : kill_relay_01 : Trigger : 0.00
OnPressed : kill_relay_02 : Disable : 0.00
kill_relay_01 and 02 (both logic_relay):
OnTriggered : hurt_area(the trigger_hurt) : Enable : 0.00
Sylvain.
Thanks a lot!!!!
Sylvain.
Don't double post.