Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Revan on Tue 15/11/2005 13:38:16

Title: Changing Player Character
Post by: Revan on Tue 15/11/2005 13:38:16
How do I make the playable charatcer change halfway through the game?
<sorry if this has already been posted or if its on the tutorial but ie serched with no luck>
Title: Re: New Characters
Post by: strazer on Tue 15/11/2005 13:55:24
AGS Beginners FAQ (http://americangirlscouts.org/agswiki/Graphics%2C_Characters%2C_Text_%26_Rooms#Having_multiple_characters_in_your_game)

AGS v2.7+:

To change the player character to ROGER:

  cRoger.SetAsPlayer();


To let the player character say something depending on who he is:


  // script for interaction: Look at couch

  if (player == cRoger) {
    cRoger.Say("Roger, you idiot, that's a couch!");
  }
  else if (player == cIdiot) {
    cIdiot.Say("That's a...uh...buffalo. Yeah...! That's the ticket!");
  }
  // ...more characters
  else player.Say("That's a couch.");
Title: Re: Changing Player Character
Post by: strazer on Wed 16/11/2005 17:18:42
Quote from: Revan (via pm)
I'm still having difficulty in being able to change the playable charactor... I want to start off as one guy (KRAS) and on the click of a hotspot (HOTSPOT) change playability to another guy (RHONIN) please can you help me...

To make KRAS the player character by default, check his "This is the player character" checkbox in the Characters pane.

Making RHONIN the player character when clicking on a hotspot:

- Select "Room Editor" from the left side
- Load room (double-click) the hotspot is in
- Select "Areas" from left side
- Select "Hotspots" from drop-down above
- Select/draw the appropriate hotspot
- Click "Interaction..." button
- Right-click "Interact hotspot" (or "Look at" or whatever fits)
- "New action..."
- Select "Run script" from the drop-down
- Click "Edit script..." button
- cRhonin.SetAsPlayer();
- Close, Save, Yes, OK etc.
Title: Re: Changing Player Character
Post by: Revan on Wed 16/11/2005 17:27:16
Thankyou, was coding all last night tryin to get it to work... Didn't realise that the interactions dropdown box had a 'run script' selection... cheers
Title: Re: Changing Player Character
Post by: strazer on Wed 16/11/2005 17:30:02
No problem. :)
Title: Re: Changing Player Character
Post by: Revan on Thu 17/11/2005 11:28:00
I am making a game with multiple character selection at the start. Having trouble with the 3rd room; you get to choose ur character then it moves you to a bar where all the characters are but you only controle the 1 you pick... but whenever you go outside the bar it automaically changes the character to the one in 'character 1' slot how can I change this?
Title: Re: Changing Player Character
Post by: strazer on Thu 17/11/2005 11:36:47
Quote from: Revan on Thu 17/11/2005 11:28:00
whenever you go outside the bar it automaically changes the character to the one in 'character 1' slot

AGS doesn't automatically change the player character.

In your scripts, you probably have told it to use a specific character, like
  cEgo.Say("Hello");
instead of
  player.Say("Hello");
which always refers to the current player character.

So search all scripts for all those occurrences where a specific character is used as player character and change that to "player" instead.