More than one idle animation per view? ( SOLVED )

Started by silverwolfpet, Sat 16/07/2011 14:49:32

Previous topic - Next topic

silverwolfpet

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.

Matti

There's a built-in timer function but I prefer using a variable.

Code: ags


// 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);
}


Khris

You must use player, not Character:

Code: ags
    player.SetIdleView(13 - player.IdleView, 1);

silverwolfpet

#3
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!!

Dualnames

Code: ags

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;  
    } 
  }
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

silverwolfpet

Thank you!
And "else if" seemed to do the job too. :)

SMF spam blocked by CleanTalk