main:
exec global/DMprecache.scr
level.script = maps/dm/test_swingdoor.scr
local.master=spawn ScriptMaster
for (local.i=1 ; local.i <= 9 ; local.i++ ) //same sound getting lower for the saloondoor
{
local.master aliascache ("saloondoor2_"+local.i) sound/mechanics/DoorWoodClose_stop3.wav soundparms (local.i/9.00) 0.2 0.5 0.2 256 1024 auto loaded maps "dm obj"
}
local.master aliascache saloondoor1 sound/mechanics/DoorWoodClose_03.wav soundparms 1 0.2 0.5 0.2 256 1024 auto loaded maps "dm obj"
level waittill prespawn
level waittill spawn
thread saloon_door_prep
end
saloon_door_prep:
level.saloon_door_angle = 90 //how far the doors open
$right_door time 0.5 //speed of doors
$left_door time 0.5
end
saloon_door:
$door_opener nottriggerable
local.doorblocked = 1
local.door_turn = 1
local.player= parm.other
local.door_dir = 0
if (local.player istouching $door_collision_out)
{
local.door_dir = -1
}
if (local.player istouching $door_collision_in)
{
local.door_dir = 1
}
$right_door rotateYup (level.saloon_door_angle * -1 * local.door_dir)
$left_door rotateYup (level.saloon_door_angle * local.door_dir)
$left_door playsound saloondoor1
$right_door move
$left_door waitmove
//doors wait until space is empty
while (local.doorblocked)
{
for( local.i = 1 ; local.i <= $player.size ; local.i++ )
{
if (!($player[local.i] istouching $door_collision_in) && !($player[local.i] istouching $door_collision_out))
{
local.doorblocked = 0
}
else
{
local.doorblocked = 1
break
}
}
wait 0.1
}
//now doors swing back and forth into start position
for( local.k = 9 ; local.k >= 1 ; local.k-- )
{
local.door_turn=local.door_turn * -1
local.saloon_closing_angle = level.saloon_door_angle / 10 * local.k * local.door_turn
$right_door rotateYup (local.saloon_closing_angle * -1 * local.door_dir)
$left_door rotateYup (local.saloon_closing_angle * local.door_dir)
$right_door move
$left_door waitmove
$left_door playsound ("saloondoor2_" + local.k)
//being halfway, we check for players blocking the door
for( local.j = 1 ; local.j <= $player.size ; local.j++ )
{
if(($player[local.j] istouching $door_collision_in) || ($player[local.j] istouching $door_collision_out))
{
goto cleanup
}
}
$right_door rotateYup (local.saloon_closing_angle * -1 * local.door_dir)
$left_door rotateYup (local.saloon_closing_angle * local.door_dir)
$right_door move
$left_door waitmove
}
cleanup:
// setting doors in start position whereever they might be
if ($right_door.angle > 180)
{
$right_door rotateYupto 0
}
if ($right_door.angle < 180)
{
$right_door rotateYdownto 0
}
if ($left_door.angle > 180)
{
$left_door rotateYupto 0
}
if ($left_door.angle < 180)
{
$left_door rotateYdownto 0
}
$right_door move
$left_door waitmove
$left_door playsound saloondoor1
$door_opener triggerable
//everything's fine again
end
The way it is working:
Player use trigger $door_opener
Doorwings swing away from player and stay open until the player has left both triggers $door_collision_in and $door_collision_out
Once he left, doorwings swing back and forth with decreasing angle until they are in startposition again.
Now this works fine for one player but for a second, the door does not stay open.
Any ideas? Here's a pk3 with bsp, script and map if u wanted to take a look
Last edited by wacko on Mon Mar 21, 2005 9:50 pm, edited 1 time in total.
lizardkid wrote:why can't you just use the shutter-style for the door and if a player hits use it swings forward, and then back.
if u test the pk3, u'd see. it's so pretty that way, when its closing with a wopp woppwoppwoppwoppwopp. I must have it like this
Also, the current problem is the collision detection and I wonder whether I'd have the same problem with the 'shutter' solution
oh, just saw it:
on one pc, I get console message: 'Delta parseEntitiesNum too old'
and on the other 'Wacko: Delta request from out of date entities.'
is this why the doors don't work? and what does it mean? and what can I do about it?
I think the problem is in the doorblocked loop. But, I don't know how to fix it. Why do you need a "for" loop in it? Can't you just use local.player or make it local.player.dmteam?
u mean, I should make another thread that would set a level.doorblocked (instead of the local.doorblocked) to 1 if the collision triggers were touched? Atm, I use the for loop to check whether ANY player is in the way, not just the one who did use the $door_opener
tltrude wrote:I hope you added a player triggered piano.
Errm No.... not yet. Problem is that the 4 stock piano sounds are rubbish. I searched my cds and found nothing that would fit the theme
If u knew something pretty of an acceptable filesize, well, let me know
Oh, btw, there's another piano in the church which would need another sound as well