Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Scorpio82 on Sat 19/08/2006 20:54:30

Title: Running Actions on a Specific Frame (SOLVED)
Post by: Scorpio82 on Sat 19/08/2006 20:54:30
Hey,

I got myself a character who can walk over to a coffee pot, play his "pick up" animation, and then have the coffee pot disappear and added to his inventory.

What I would like to have is that on frame 3 of his "pick up" view, the game displays a message and the coffee pot disappears before his animation is finished (so it looks a bit more natural.)Ã,  My script currently follows this:

character[EGO].animate(4, 1, 0, eBlock);
if (cEgo.frame==3) {
Display("Yada yada...");Ã, 
}

But it's a no-go.Ã,  The reference says this should work, but I'm probably misreading something.Ã,  Any idea on how to get an action running on a specific frame?
Title: Re: Running Actions on a Specific Frame
Post by: Ashen on Sat 19/08/2006 22:55:57
It's because the script interaction runs at once - the frame ISN'T 3 when the interaction is run, so it makes no difference at that point in the code. You could try checking the frame in the Room repeatedly_execute function - you'd probably also want to check against the View, Loop and/or a variable to make sure it only runs on Frame 3 of the pick up animation, and not the third frame of every Walk/Talk/anything else animation that runs.

Easier would probably be to split the animation into 2 parts. Run the bit (up to Frame 3) with the eBlock parameter, as you are doing, display your message and remove the object, then play the second part.
Title: Re: Running Actions on a Specific Frame
Post by: Scorpio82 on Sat 19/08/2006 23:21:01

Ah, you're right.  That would be easier.  Thank you!