Posted: Fri Jun 09, 2006 1:02
If you are using 3d floors to make up the divisions between each floor, you would probably do best getting the the ceiling height, considering that's what you stand on when atop a 3d floor. Lets assume you have 3 floors you want to navigate within an elevator. Tag 1 will be the lowest, tag 2 in the middle, tag 3 the highest, and tag 4 the sector you are moving. I'll also assume that the floor of the elevator is in fact a floor, not a 3d floor (in which case the ceiling), and so is the bottom floor. Since the elevator functions seem to be a bit limitted in this regaurd, we won't use them.
[edit]This anything like what you're trying to do?
Code: Select all
Script 1 (int SectorTag, int Speed)
{
int Value;
switch (SectorTag)
{
case 1: if (GetSectorFloorZ(4, 0, 0) != GetSectorFloorZ(1, 0, 0))
{
Value = GetSectorFloorZ(4, 0, 0) - GetSectorFloorZ(1, 0, 0);
Floor_LowerByValue(4, Speed, Value >> 16);
Ceiling_LowerByValue(4, Speed, Value >> 16);
}
break;
case 2: if (GetSectorFloorZ(4, 0, 0) < GetSectorCeilingZ(2, 0, 0))
{
Value = GetSectorCeilingZ(2, 0, 0) - GetSectorFloorZ(4, 0, 0);
Floor_RaiseByValue(4, Speed, Value >> 16);
Ceiling_RaiseByValue(4, Speed, Value >> 16);
}
else if (GetSectorFloorZ(4, 0, 0) > GetSectorCeilingZ(2, 0, 0))
{
Value = GetSectorFloorZ(4, 0, 0) - GetSectorCeilingZ(2, 0, 0)
Floor_LowerByValue(4, Speed, Value >> 16);
Ceiling_LowerByValue(4, Speed, Value >> 16);
}
break;
case 3: if (GetSectorFloorZ(4, 0, 0) != GetSectorCeilingZ(3, 0, 0))
{
Value = GetSectorCeilingZ(3, 0, 0) - GetSectorFloorZ(4, 0, 0);
Floor_RaiseByValue(4, Speed, Value >> 16);
Ceiling_RaiseByValue(4, Speed, Value >> 16);
}
break;
}
}