triggered automati doors


(stealth6) #1

I was trying to make 2 doors open at the same time, double doors, by walking through 1 trigger brush

But at the moment it isn’t really working :stuck_out_tongue:
First the door20 opens and then closes then door 21 opens, but doesn’t close…

and is there anyway to turn off the trigger untill the doors have sucessfully opened and closed, because now they open and if you keep standing in the trigger zone the sound keeps looping… and that is annoying lol

code:


elevator_move20
{
	spawn
	{
	}

	trigger move_up20
	{
		stopsound
		playsound sound/vehicles/misc/radar_start.wav volume 96
		trigger elevator20 move_up20
		trigger elevator21 move_up21
	}

}

elevator20
{
	spawn
		{
		accum 1 set 0
		}

	trigger move_up20
		{
		accum 1 abort_if_not_equal 0
		accum 1 set 1
		stopsound
		playsound sound/vehicles/misc/radar_start.wav volume 96
		gotomarker elevator_up20 300 wait
		stopsound
		accum 1 set 0
		wait 1000
		trigger elevator20 move_down20
		}

	trigger move_down20
		{
		accum 1 abort_if_not_equal 0
		accum 1 set 1
		stopsound
		playsound sound/vehicles/misc/radar_end.wav volume 96
		gotomarker elevator_down20 300 wait
		stopsound
		accum 1 set 0
		}
}

elevator21
{
	spawn
		{
		accum 1 set 0
		}

	trigger move_up21
		{
		accum 1 abort_if_not_equal 0
		accum 1 set 1
		stopsound
		playsound sound/vehicles/misc/radar_start.wav volume 96
		gotomarker elevator_up21 300 wait
		stopsound
		accum 1 set 0
		wait 1000
		trigger elevator21 move_down21
		}

	trigger move_down21
		{
		accum 1 abort_if_not_equal 0
		accum 1 set 1
		stopsound
		playsound sound/vehicles/misc/radar_end.wav volume 96
		gotomarker elevator_down21 300 wait
		stopsound
		accum 1 set 0
		}
}

move_up means door opening, move_down is door closing and elevator = door :stuck_out_tongue: jsut I already had elevators, and otherwise I had to change everything to door


(S14Y3R) #2

Hi, first the looping sound is coming from elevator_move20 move_up20, your door sounds are called in their respective routine, so they can be removed from it:


elevator_move20
{
   trigger move_up20
   {
      //stopsound
      //playsound sound/vehicles/misc/radar_start.wav volume 96
      trigger elevator20 move_up20
      trigger elevator21 move_up21
   }

} 

The lack of moving from your second door might be caused by the extra sounds and waits, try setting it up so your first door calls to open the second door. This will “streamline” what’s called:


elevator_move20
{
   trigger move_up20
   {
      trigger elevator20 move_up20
   }
}

elevator20
{
   spawn
      {
      accum 1 set 0
      }

   trigger move_up20
      {
      accum 1 abort_if_not_equal 0
      accum 1 set 1
      stopsound
      playsound sound/vehicles/misc/radar_start.wav volume 96
      trigger elevator21 move_up21 
      gotomarker elevator_up20 300 wait
      accum 1 set 0
      wait 1000
      trigger elevator20 move_down20
      }

   trigger move_down20
      {
      accum 1 abort_if_not_equal 0
      accum 1 set 1
      playsound sound/vehicles/misc/radar_end.wav volume 96
      trigger elevator21 move_down21
      gotomarker elevator_down20 300 wait
      stopsound
      accum 1 set 0
      }
}

elevator21
{
   trigger move_up21
      {
      gotomarker elevator_up21 300 
      }

   trigger move_down21
      {
      gotomarker elevator_down21 300 
      }
}

see how that runs. :slight_smile: , the second door might be a little out of sync with the first, if its really noticable, add a little wait before the second door actually opens, like this:



trigger move_up21
      {
      wait 50
      gotomarker elevator_up21 300 wait
      }

   trigger move_down21
      {
      wait 50
      gotomarker elevator_down21 300 wait
      }
}

gl.


(stealth6) #3

nope still isn’t working, they act really wierd, so I think I’m going to drop that Idea, I’m going to change the trigger into one that you have to press f then the 2 doors open, and the sound will be played once :stuck_out_tongue:

then I get all the problems solved in 1 go… now just to find the time to do that


(Flippy) #4

What will that accomplish? Afaik your script will be almost exactly the same when you use a trigger brush or a button…

What you need to do is have a target_script_trigger that is connected to your trigger brush (trigger brush -->–> target_script_trigger). Then give the target_script_trigger a scriptname and a ‘target’ key.

In the script, when you walk through the trigger, the target_script_trigger will activate the following sequence:

scriptname_of_target_script_trigger
{
   spawn
   {
   }

   target_of_target_script_trigger
   {
        //This will get called.
   }
}

In that script, you will need to call the “move” sequence for both doors, and you will have to set an accum value so you don’t trigger it again. You seem to have that worked out so I don’t know what could be wrong… Maybe just try it again from scratch?

EDIT
I just noticed, you might need a “resetscript” or “wait 20” behind the accum check (“accum 1 abort_if_not_equal 0”) I remember always doing that in my script…


(stealth6) #5

ok I’ll try it from scrath, but the sond is very annoying, so that i would solve with a button insead of just standing in an area…

and I’m not a very good scripter, I just look at how other maps work, and from that I conclude how to make it myself…


(stealth6) #6

ah lol just as I was deleting it I found the problem I switched up with down on 1 of the doors, it works now, and I syncronized the sound so it sstops when the doors are open eand once they’ve closed, but once they’ve opened and you are still in the trigger brush the sound starts looping, whichis very annoying, so now I am goin to attempt to change the trigger so it only activatesif you press f hopefully that will solve the problem


(Flippy) #7

You are probably triggering the same piece of script over and over again if you stay in the trigger brush. You can use an accum value to stop the script if the sound has already been triggered once, but it’s probably better to do it another way, saving you one precious global accum :slight_smile:

You can hide (setstate invisible) the trigger_brush once it has been used. I assume the doors will also close again, so you must be able to open them a second, third etc, time? If not it’s really easy, youll probably figure it out yourself…
If you need to use them more times, simply setstate the trigger brush the invisible (don’t forget to use it’s target_name) and setstate it back to default once the doors close again.


(stealth6) #8

I tried that… and failed :stuck_out_tongue:
So I changed them to a button func_invisible_user
with 3 sec delay time so now th door open and sound plays once they stay open for 3 seconds, and then close again and the sound plays once :stuck_out_tongue:
then you can open then again


(Diego) #9

If the door is automatic, will it stay open while someone is standing in the trigger zone? or will they automatically close after a certain amount of time? Perhaps set the script to disable the trigger while the doors are open?

I once setup a trigger for a poison gas zone and I wanted the damage to fire every second, but play a different audio file than the standard sizzle effect you hear when you run into barbwire. For that, I used 2 trigger zones with different timings.

If you use 2 triggers, the first can actually control the opening and closing of the doors. But disable the noise for the doors in their entitiy parameters. Then use a second trigger to target a different script that will play the sound file only once.