Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: silverwolfpet on Sat 16/07/2011 14:49:32

Title: More than one idle animation per view? ( SOLVED )
Post by: silverwolfpet on Sat 16/07/2011 14:49:32
Short version:

I read the help file... useful stuff but I can't really tie them together.
How do I make the game show one idle animation after 5 seconds...and another idle animation for the same view (let's say Front) after another 5 seconds?

LucasArts style game.

Long Version:

Let's say the default idle view is 6.
And the other idle view is 7.

I think I can set up a global timer... and when that timer reaches zero I can change idle view of character to 7.
Then reset the timer.
And do it again to change it back to 6.

Question is... how do I "phrase" that in code?
I can't quite put my finger on it.
Title: Re: More than one idle animation per view?
Post by: Matti on Sat 16/07/2011 15:46:23
There's a built-in timer function but I prefer using a variable.



// top of the script:

int idlewait = 200;   // at normal gamespeed one second equals 40 gameloops

// in the repeatedly execute:

if (idlewait > 0) idlewait--;

if (idlewait == 0){
 idlewait = 200;      
 if (Character..IdleView == 6) Character.SetIdleView(7, 1); // 1 is the delay
 else Character.SetIdleView(6, 1);
}

Title: Re: More than one idle animation per view?
Post by: Khris on Sat 16/07/2011 16:00:19
You must use player, not Character:

    player.SetIdleView(13 - player.IdleView, 1);
Title: Re: More than one idle animation per view?
Post by: silverwolfpet on Sat 16/07/2011 16:09:44
I have two characters...so it's fine with "character" for me.

Thank you very much! It's brilliant!

I just need to polish it a little... for some reason it sometimes cuts off the animation. I'll figure it out :) Thanks!

Oh and if I want to have three idle views?

EDIT: added a "else if" and made it work. Thanks!!
Title: Re: More than one idle animation per view?
Post by: Dualnames on Sat 16/07/2011 16:25:07

int idlewait, cc=1, idleviews=3;//the number of idleviews can be adjusted

// in the repeatedly execute:

idlewait++;

if (idlewait == cc*5*40)
  {
  Character.SetIdleView(5+cc, 1); //assuming the idle views are 6,7,8,9 ecc..
  cc++;
    if (cc>idleviews)
    {
    cc=1;
    idlewait=0; 
    }
  }
Title: Re: More than one idle animation per view?
Post by: silverwolfpet on Sat 16/07/2011 16:51:29
Thank you!
And "else if" seemed to do the job too. :)