Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Aryes on Wed 26/02/2014 12:13:30

Title: Switch *all* player views (i.e. walking, speaking, idle etc)
Post by: Aryes on Wed 26/02/2014 12:13:30
I'm trying to set up a character that changes her 'outfit' using items in her inventory. (This is for cold weather and disguise options).

So far I have:


function invCloak_Interact(){
        player.Say("Lovely and warm.");
        player.SetIdleView(5, 0); // Where 5 is the view with the 'cloak' enabled
  }


Obviously all this does is change the idle view. But I can't find similar functions for the other views. I also considered just switching characters but that gets complicated with starting rooms and I'm not sure whether Inventory would carry over?

Any advice would be greatly appreciated.
Title: Re: Switch *all* player views (i.e. walking, speaking, idle etc)
Post by: Khris on Wed 26/02/2014 12:21:20
Switching characters isn't a problem but you'd indeed have to manually duplicate the inventory. It doesn't solve the issue of having to use different views/loops for special animations though.

To change the character's other views:
Code (ags) Select
  player.ChangeView(CLOAKWALK);
  player.SpeechView = CLOAKTALK;
  // player.ThinkView = CLOAKTHINK;


As for other animations like picking up stuff: you could use one view for each outfit and store the number in a global int variable.
In the above code, you'd do animationView = CLOAKANIMS;
When the player picks up something:
Code (ags) Select
  player.LockView(animationView);
  player.Animate(...);
  player.UnlockView();

Just make sure the loops do the same in each outfit's animation view.
Title: Re: Switch *all* player views (i.e. walking, speaking, idle etc)
Post by: Aryes on Wed 26/02/2014 12:41:42
Great. I'll test this on my game tomorrow. Thanks for your help! :)