Hello! I ran into this problem: when I start the first screen in the game (its very beginning), I want to make a cutscene where two elevator doors (left and right) open and the main character stands behind them. After some time, transferring control to the player.
But when I try to animate doors (objects), nothing works out :( I did not want to litter the forum with another stupid question, but the siege of Google and other forum topics did not help me.
function room_Load()
{
oElevDoorLeft.SetView (2, 1, 0);
oElevDoorLeft.Animate (1, 3, eOnce, eBlock, eForwards);
oElevDoorRight.SetView (3, 1, 0);
oElevDoorRight.Animate (1, 3, eOnce, eBlock, eForwards);
}
Views name's: vElevatorDoorLeft and vElevatorDoorRight
Inside each Door view I have 11 frames closing animation (it looks like door sliding inside a wall) on Loop 1 (Left door) and Loop 3 (Right door).
Here's the GIF with example what I trying to achieve:
https://tenor.com/view/gif-20116754 (https://tenor.com/view/gif-20116754)
I can see two problems with this script.
1. "Room load" event happens before room is first displayed, which means anything you put there will not be seen on screen. It's advised to place any starting cutscenes in "room after fade in" event.
2. You play two door animations blocking, which means they will run in sequence rather than simultaneously. If that is not what you intend, play them non blocking and wait for animation to end like this:
while (oElevDoorLeft.Animating || oElevDoorRight.Animating)
{
Wait(1); // this will let engine to update and redraw the game in small steps
}
PS. Please always clarify what "nothing works" mean: what you see happening, any error messages, and so on. More information may help diagnose the problem.
The only thing that remains to add is unrelated to the problem: you can move objects. So unless the doors have to actually animate, you can simply use
oElevDoorLeft.Move(...); instead.
Just draw a walkbehind area on the wall so the doors disappear behind it.
Thank you all very much for your help! I tried Crimson Wizard's method, but could not understand the general logic, so I tried Khris method with moving objects to the sides.
I was more than satisfied with the result! Although yesterday I was very angry because I couldn't do anything.
The code came out like this:
function room_FirstLoad()
{
Wait(80);
oElevDoorLeft.Move(225, 104, -8, eNoBlock, eAnywhere);
oElevDoorRight.Move(270, 104, -8, eBlock, eAnywhere);
cPugovkin.Walk (252, 121, eBlock, eAnywhere);
oElevDoorLeft.Move(242, 104, 1, eNoBlock, eAnywhere);
oElevDoorRight.Move(253, 104, 1, eNoBlock, eAnywhere);
}
Unbelievably happy about this success, I even tried to do a small test cutscene today so that the main character could go back in the elevator and this led to a false ending like many Sierra Games. :-D
function oElevDoorLeft_AnyClick()
{
cPugovkin.Say ("Oh my! I forgot to turn off the kettle!");
cPugovkin.Walk(252, 114, eBlock, eAnywhere);
Wait (40);
oElevDoorLeft.Move(225, 104, -8, eNoBlock, eAnywhere);
oElevDoorRight.Move(270, 104, -8, eBlock, eAnywhere);
cPugovkin.Walk (252, 106, eBlock, eAnywhere);
cPugovkin.FaceDirection(eDirectionDown, eBlock);
cPugovkin.Say ("Thank God I remembered!");
//Wait(80);
oElevDoorLeft.Move(242, 104, 1, eNoBlock, eAnywhere);
oElevDoorRight.Move(253, 104, 1, eBlock, eAnywhere);
Wait(80);
FadeOut(30);
player.ChangeRoom(3, 0, 0);
Quote from: Licht61 on Wed 27/01/2021 15:49:01
Thank you all very much for your help! I tried Crimson Wizard's method, but could not understand the general logic
Well, it is simply like
oElevDoorLeft.SetView (2, 1, 0);
oElevDoorLeft.Animate (1, 3, eOnce, eNoBlock, eForwards);
oElevDoorRight.SetView (3, 1, 0);
oElevDoorRight.Animate (1, 3, eOnce, eNoBlock, eForwards);
while (oElevDoorLeft.Animating || oElevDoorRight.Animating)
{
Wait(1);
}
But above is a formality. I did not realize since the animations are mirrored they last same time. So you could do as well just what you did with Move, but with Animate (first started non-blocking, next blocking), then you of course dont have to do this loop with Wait.