Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: MotatoChisp on Fri 21/05/2021 21:11:07

Title: Change Player Character or Player Character View
Post by: MotatoChisp on Fri 21/05/2021 21:11:07
Hello there!

In short, I'm making a game where your player character is first a kid, then a teen, then an adult and
I want to change the view that is displayed for the character or just assign a new character as the player character to
make there character look like a kid first and then like a teen (etc.) in the next room.

I tried to find a way to do that, but only found ways on how to change the view of a character in general and not over the course of the game.

Greetings!
Title: Re: Change Player Character or Player Character View
Post by: Khris on Fri 21/05/2021 22:26:57
The script command is  player.ChangeView(...);  which will permanently set the stated view as the new Normal View, i.e. the one used for standing and walking.

You would simply run this command in the "before fadein" event of a room.
Title: Re: Change Player Character or Player Character View
Post by: eri0o on Fri 21/05/2021 22:59:51
Hey, the command to change the player character is Character.SetAsPlayer()

Here's a link to it on the manual:

https://adventuregamestudio.github.io/ags-manual/Character.html#charactersetasplayer

Say you have a character named cChildDude that you want to make the player, you will call:
Code (ags) Select
cChildDude.SetAsPlayer()
Title: Re: Change Player Character or Player Character View
Post by: Crimson Wizard on Fri 21/05/2021 23:18:06
It's also important to note that if you are changing player character in your game - it's strongly recommended to always refer to player character in script using "player" keyword instead of the particular character's name (except for cases when you must command exact character).
(It is best to always do that even if you don't change character)

For example "player.Walk" instead of "cYoungPlayer.Walk", and so on.

That way these commands will work regardless of who player character is at the given moment.