Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: FinalSin on Sat 26/06/2004 19:10:53

Title: Two Characters
Post by: FinalSin on Sat 26/06/2004 19:10:53
This may be in the manual (apologies to the regulars) but is it possible, and if so how, to switch the player character? Changing inventory is not a problem.
Title: Re: Two Characters
Post by: Darth Mandarb on Sat 26/06/2004 19:29:29
From the manual ...

----------------------------------

SetPlayerCharacter

SetPlayerCharacter (int char_id)

Changes the character which the player controls to CHAR_ID. You can either use the character's number, or the ID string set in the Room Editor. This function will also cause the room to change to the room which the chosen character is currently in. (It calls NewRoom with the character's room, so the change won't happen until the end of the script).
Note: The "player" global variable is not updated with the new character; so using "player.x", "player.name" and so on will change the original character, not the current player character.

Example:

SetPlayerCharacter(MAN);

will change the character that the player controls to character MAN and also change (if needed) the room to the room that the character MAN is .

----------------------------------

Should be what you're looking for.