Page 1 of 1

door variables

Posted: Thu Feb 27, 2003 9:08 am
by tltrude
I am working on a script that opens subpendoors that are func_rotatingdoor entities. What I need are variables that can tell the script when the doors are closed, in transit, or open. My guess is that these variables are in the game engine because I have not seen any scripts for function stuff. Anyone have a clue?

I know I can just make script_object doors, but that would be cheating, ha ha.

Btw, here are a couple of lines from spearhead that are used to open/close function doors:


$subpen_doors open $door_entity
$subpen_doors close $door_entity


// "door_entity" is the targetname of a script_origin placed near the door as if it were a fake player. The lines work great to trigger function doors with the script.

Posted: Thu Feb 27, 2003 9:13 am
by jv_map
I don't think the variables you're looking for are available :(. You might be able to use:

$door waittill dooropened

and

$door waittill doorclosed

Never tried it though :?

Re: door variables

Posted: Thu Feb 27, 2003 10:30 am
by Angex
tltrude wrote:What I need are variables that can tell the script when the doors are closed, in transit, or open.
You say you need these variables, but if you tells us what exactly it is you're trying to do, maybe someone can come up with a workaround.

reversible doors

Posted: Fri Feb 28, 2003 1:20 am
by tltrude
The guy I'm making the script for want opening the doors (two sets) to be objectives. They take 25 seconds to open and are reversible by the other team untill they get fully open or fully closed.

Here is the threads for one set of doors:

Code: Select all

// --------------------------------------------
//  Big Door Right threads
// --------------------------------------------

bigdoors_rt_waittill_capture:

  while ( $bigdoor_rt_trigger )
  {
    $bigdoor_rt_trigger waittill trigger
    local.player = parm.other

	if ((local.player.dmteam == "allies") && ((level.rtdoorspos == 1) || (level.rtintransit == 1))) // if moving or fully open
		{
		$bigdoor_rt_switch playsound door_metal_locked1
		goto bigdoors_rt_waittill_capture
		}
		else
	if ((local.player.dmteam == "axis") && (level.rtintransit == 0)) // if bigdoors are not moving
		{
		$bigdoor_rt_switch playsound door_metal_locked1
		goto bigdoors_rt_waittill_capture
		}
		else
	if ((local.player.dmteam == "allies") && (level.bdrspos == 0))
		{
			thread bigdoors_rt_open
		}
		else
	if ((local.player.dmteam == "axis") && (level.bdrspos == 1))
		{
			thread bigdoors_rt_close
		}

   waitframe // protection
}
end

bigdoors_rt_open:

	$bigdoor_rt_switch anim move
	$bigdoor_rt_switch playsound lighthouse_lever
	level.bdrspos = 1
	$bigdoor2 open $door_entity_rt
	$bigdoor1 loopsound bigdoors_run
	$bigdoor2 loopsound bigdoors_run
	level.rtintransit = 1
	wait 25
	level.rtintransit = 0
	$bigdoor1 loopsound bigdoors_run wait
	$bigdoor2 loopsound bigdoors_run wait
	level.rtdoorspos = 1

	if (level.bdrspos != 1)
	{
		end
	}
	thread global/bomber.scr::bomb 5
	$biggun_fire anim start
	$biggun playsound boat_snd_fire2
	wait .6
	$biggun_fire anim stop
	$bombspeaker playsound arty_leadin
	wait 2
	thread global/exploder.scr::explode 3
	$bombspeaker playsound explode_water2

end

bigdoors_rt_close:

	$bigdoor1 loopsound bigdoors_run wait
	$bigdoor2 loopsound bigdoors_run wait
	$bigdoor_rt_switch anim idle
	$bigdoor_rt_switch playsound alarm_switch
	level.bdrspos = 0
	wait 1
	$bigdoor2 close $door_entity_rt
	iprintln "Right subpen doors are closing!"
	$bigdoor1 loopsound bigdoors_run	
	$bigdoor2 loopsound bigdoors_run
	level.rtintransit = 1
	wait 25
	level.rtintransit = 0
	$bigdoor1 loopsound bigdoors_run wait
	$bigdoor2 loopsound bigdoors_run wait
	level.rtdoorspos = 0

end
It is getting very hard to do a work around, as you can see above.

"bdrspos" is the "big doors right switch position".

Posted: Fri Feb 28, 2003 1:04 pm
by Angex
The only thing I can think of, is to make it so the doors are opened by a wheel valve (like the ones at the fort in m6). Then you could make it so each turn moves the door a small way, by scripting the doors movement.

This would mean a player needs to be contantly triggering a trigger in order for the door to move. The trigger could use an if statement to say, if allies then open door, doorVariable++, else close door, doorVariable--.

In a seperate thread, you would also need a while loop saying, while doorVariable != 25. When it reaches 25 it breaks the loop and continues with the code, which would say $trigger nottriggerable.

When the allies have sucessfully opened the door, and incremented the doorVariable enough it will disable the trigger. 25 is the number of trigers required.

I haven't got time to work on all the scripting, but its something to think about.