Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: pheeph on Sun 01/02/2009 06:04:01

Title: Changing characters
Post by: pheeph on Sun 01/02/2009 06:04:01
I'm trying to do a script where one character will change into a different character.  What I'm trying to explain is that a new character sprite replaces the current character sprite.  The manual doesn't seem to mention that part.  How do I do this?
Title: Re: Changing characters
Post by: ThreeOhFour on Sun 01/02/2009 06:13:48
This is as simple as making a new view and then placing:


cCharacter.ChangeView(2);


in your script, at the part where you want the character to change.

In the manual, have a look under the Character.ChangeView and Character.LockView entries :).
Title: Re: Changing characters
Post by: on Mon 02/02/2009 22:10:40
Alternatively, if you really want to SWITCH two existing characters, you would need two different characters, place the new one at the position of the old one, and make the new one the player character. As I write this it sounds hilariously complicated... but basically you would


cNewCharacter.ChangeRoom(RoomNr, player.X, player.Y);
cNewCharacter.SetAsPlayer();
cOldCharacter.ChanceRoom(-1);


I'm not entirely sure, but the last command may not work with -1. In that case, just supply any other room- preferrable one you create just for storage (Like an empy Room100).
To play it safe, look up the commands in the manual, I have a habit of ignoring capitals when typing from the top of my head.