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
}
//---------------------------------------->
Help with hatch script
Moderator: Moderators
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
//---------------------------------------->
//---------------------------------------->
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
//---------------------------------------->
-
Bjarne BZR
- Site Admin
- Posts: 3298
- Joined: Wed Feb 05, 2003 2:04 pm
- Location: Sweden
- Contact:
Here is a hatch script I made for "Vemork Ferry" ( A map I forgot to release now that I think of it
)
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...
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
endCall "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...
- Axion
- Major General
- Posts: 683
- Joined: Mon Sep 29, 2003 5:14 am
- Location: Northern California
- Contact:
Well, now that you've remembered, are you going to release it? I remember looking at screenies of it a LONG time ago.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)
"The work of a thousand years is nothing but rubble."
- Dr. Carl Goerdeler (1943)
Visit my mapping site: http://www.freewebs.com/axion9

- Dr. Carl Goerdeler (1943)
Visit my mapping site: http://www.freewebs.com/axion9

-
Bjarne BZR
- Site Admin
- Posts: 3298
- Joined: Wed Feb 05, 2003 2:04 pm
- Location: Sweden
- Contact:

