Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Arjunaz78 on Mon 17/10/2011 17:58:49

Title: Create 2nd Char & Switch Icon
Post by: Arjunaz78 on Mon 17/10/2011 17:58:49
How can i create a second character and put in to other room?I mean for example i want a 2nd character to save her friend from prison,while the main character currently stuck in prison and cannot do anything..

And i want create a switch icon that player can click and then change the 2nd char as a main char. otherwise player can switch back to 1st char later..

I know i can use the;

cEgo.SetAsPlayer();


as the scripting code but i don't know how to put it on room scr. or global scr. besides i think i need to put another scripting code to it right?
and for the switch icon,can i create custom GUIs or i need to make it as Object?

THX.
Title: Re: Create 2nd Char & Switch Icon
Post by: Khris on Mon 17/10/2011 19:14:21
You'd put the switch button on a GUI.

As for the button's code:
  if (player == cEgo) cFriend.SetAsPlayer();
  else cEgo.SetAsPlayer();


Or the short version:
  character[(cEgo.ID + cFriend.ID) - player.ID].SetAsPlayer();

Keep in mind that coding a two-player character game is a good deal more complex than a standard game; if you're having trouble with stuff like this already, maybe you should improve your coding skills first.