Switch *all* player views (i.e. walking, speaking, idle etc)

Started by Aryes, Wed 26/02/2014 12:13:30

Previous topic - Next topic

Aryes

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:

Code: ags

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.

Khris

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
  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
  player.LockView(animationView);
  player.Animate(...);
  player.UnlockView();

Just make sure the loops do the same in each outfit's animation view.

Aryes

Great. I'll test this on my game tomorrow. Thanks for your help! :)

SMF spam blocked by CleanTalk