I am making an elevator and want the character to lock his view and slide down through the floor with a platform.
I have tried the following but the movement appears jerky and inconsistent.
function region2_WalksOnto()
{
int y;
hMetalPlate.Enabled = true; // turns on platform hotspot
cEgo.Walk(205, 105, eBlock); // walks to center of platform
cEgo.FaceLocation(205, 200, eBlock); //faces the camera
cEgo.Baseline = 5; // character can now appear to be going through the hole in the floor
oElevator.SetView(13);
oElevator.Animate(0, 0, eOnce, eNoBlock, eForwards); // elevator object slides down
cEgo.SayBackground("&2 WHOA!");
while (y<45) {
cEgo.LockViewOffset(EGOIDLE, 0, y);
y++;
}
Wait(50); // waits at bottom for a bit
oElevator.Animate(0, 0, eOnce, eNoBlock, eBackwards); // elevator object slides back up
while (y=45) {
cEgo.LockViewOffset(EGOIDLE, 0, y);
y--;
}
cEgo.Baseline = 0; // returns walk behind to normal
cEgo.UnlockView();
}
What am I doing wrong?
Cheers,
Paul.
Try this and see if this helps:
function region2_WalksOnto()
{
int y;
hMetalPlate.Enabled = true; // turns on platform hotspot
cEgo.Walk(205, 105, eBlock); // walks to center of platform
cEgo.FaceLocation(205, 200, eBlock); //faces the camera
cEgo.Baseline = 5; // character can now appear to be going through the hole in the floor
oElevator.SetView(13);
oElevator.Animate(0, 0, eOnce, eNoBlock, eForwards); // elevator object slides down
cEgo.SayBackground("&2 WHOA!");
while (y<45) {
cEgo.LockViewOffset(EGOIDLE, 0, y);
Wait(1); //ADD THIS
y++;
}
Wait(50); // waits at bottom for a bit
oElevator.Animate(0, 0, eOnce, eNoBlock, eBackwards); // elevator object slides back up
while (y=45) {
cEgo.LockViewOffset(EGOIDLE, 0, y);
Wait(1); //ADD THIS
y--;
}
cEgo.Baseline = 0; // returns walk behind to normal
cEgo.UnlockView();
}
Wow that worked like a charm Gilbot thanks for responding to quickly. The only problem I'm having now is trying to get the timing right for the elevator ride back up. The ride down was spot on but it seems that on the ride up, the platform object animates a second too soon and the character passes through the floor after the elevator has already returned.
Any ideas? Thanks again, btw. Made my night!
Cheers,
Paul.
Edit:
Never mind. I just created another loop for the elevator ride up and added a delay of 35 to the first frame.