Page 1 of 1
Help with hatch script
Posted: Sun Jul 31, 2005 2:32 am
by neillomax
How do you make this close like a regular door would ? /////////////////////
How do you give it sound ? ///////////////////////////////////////////////////
//---------------------------------------->
hatch1_open:
level.hatch1pos = 0
$hatch1 time 1.75 // set for 13/4 seconds travel time
goto hatch1_move
//---------------------------------------->
hatch1_move:
$hatch1_trigger waittill trigger
if(level.hatch1pos == 0)
{
$hatch1 rotateXup 90 // or Y or Z if your hatch opens that way.
$hatch1 playsound metal_bunker_hatch_open
$hatch1 waitmove
level.hatch1pos = 1
goto hatch1_move
}
else
if(level.hatch1pos == 1)
{
$hatch1 rotateXdown 90 // or Y or Z if your hatch opens that way.
$hatch1 playsound metal_bunker_hatch_open
$hatch1 waitmove
level.hatch1pos = 0
goto hatch1_move
}
//---------------------------------------->
Posted: Mon Aug 01, 2005 9:09 am
by diego
tltrude's door2 tutorial map has a scripted door that opens like a hatch.
Posted: Mon Aug 01, 2005 7:11 pm
by tltrude
This should work.
//---------------------------------------->
hatch1_open:
$hatch1 time 1.75 // this line can be under prespawn
$hatch1_trigger waittill trigger
$hatch1 rotateXup 90 // or Y or Z if your hatch opens that way.
$hatch1 playsound door_wood_open_move
$hatch1 waitmove
$hatch1 playsound door_wood_open_stop
wait 4
$hatch1 rotateXdown 90 // or Y or Z if your hatch opens that way.
$hatch1 playsound door_wood_close_move
$hatch1 waitmove
$hatch1 playsound door_wood_close_stop
goto hatch1_open
end
//---------------------------------------->
Posted: Tue Aug 02, 2005 8:17 am
by Bjarne BZR
Here is a hatch script I made for "Vemork Ferry" ( A map I forgot to release now that I think of it

)
Code: Select all
setup_hatch:
// Hatch to lower deck
level.hatch_open = 0
level.hatch_moving = 0
$hatch_trigger_opened hide
$hatch_trigger_closed show
end
use_hatch local.close_only:
if(local.close_only !=1 || ( local.close_only ==1 && level.hatch_open) ) {
if(level.hatch_moving == 0) {
level.hatch_moving = 1
local.hatch_time = 1
$hatch time local.hatch_time
if (level.hatch_open) {
$hatch rotateZup 90
$hatch_trigger_opened hide
$hatch_trigger_closed show
$hatch playsound hatch_close
} else {
$hatch openportal
$hatch rotateZup -90
$hatch_trigger_opened show
$hatch_trigger_closed hide
$hatch playsound hatch_open
}
level.hatch_open = !level.hatch_open
$hatch waitmove
level.hatch_moving = 0
if(!level.hatch_open) {
$hatch closeportal
}
if(level.hatch_open) {
thread hatch_auto_shut
}
}
}
end
hatch_auto_shut:
level.time_left_to_auto_shut = 3
if( level.auto_shut_active != 1 ) {
level.auto_shut_active = 1
while ( level.time_left_to_auto_shut > 0 ) {
level.time_left_to_auto_shut --
wait 1
}
thread use_hatch 1
}
level.auto_shut_active = 0
end
Call "setup_hatch" from main.
Call "use_hatch" from a trigger around the hatch.
It got this complicated because I wanted the hatch to auto close because the hatch covers an areaportal. The areaportal is controlled by the "closeportal" and "closeportal" commands.
Hmmm... perhaps this code is so hairy that it should be bundled with a prefab of the hatch...
Posted: Tue Aug 02, 2005 3:40 pm
by Axion
Bjarne BZR wrote:Here is a hatch script I made for "Vemork Ferry" ( A map I forgot to release now that I think of it

)
Well, now that you've remembered, are you going to release it? I remember looking at screenies of it a LONG time ago.
Posted: Tue Aug 02, 2005 5:02 pm
by Bjarne BZR
Yes I will, remind me in a few weeks and lets stop hogging neillomax thread
