Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: doctorhibert on Sun 26/02/2017 14:02:33

Title: How to play an animation after a dialogue
Post by: doctorhibert on Sun 26/02/2017 14:02:33
So in my script I have this.
Code (ags) Select

dcomisariofinal.Start();
ofortbot.Animate(0, 1, eOnce, eBlock);

And I want the animation to start after the dialogue is finished, however, when I do this, the animation plays at the same time the dialogue starts. How do I make the game wait until the dialogue is finished to play the animation?
Title: Re: How to play an animation after a dialogue
Post by: Slasher on Sun 26/02/2017 14:17:40
Dialog options generally go to the bottom of the function queue and are last to run.

You'll need to put the animation code within the dialog options itself when selecting an option that causes the animation to start.
Title: Re: How to play an animation after a dialogue
Post by: doctorhibert on Sun 26/02/2017 14:25:54
I tried it but it says ofortbot is an undefined token
Title: Re: How to play an animation after a dialogue
Post by: Slasher on Sun 26/02/2017 14:31:57
you must name objects by their ID not by name when you include it within a dialog option..

eg
Code (ags) Select

ofortbot.Animate(0, 1, eOnce, eBlock); // will not run as it does not know what ofortbot is.

object[3].Animate(0, 1, eOnce, eBlock); // will know how to animate an object by its ID number.
Title: Re: How to play an animation after a dialogue
Post by: dayowlron on Sun 26/02/2017 14:33:21
In dialogs you have to reference objects by number. for instance if ofortbot is object number 1
    object[1].Animate(0, 1, eOnce, eBlock);
Title: Re: How to play an animation after a dialogue
Post by: doctorhibert on Sun 26/02/2017 14:38:27
Thanks dudes