Change Player Character or Player Character View

Started by MotatoChisp, Fri 21/05/2021 21:11:07

Previous topic - Next topic

MotatoChisp

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!

Khris

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.

eri0o

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
cChildDude.SetAsPlayer()

Crimson Wizard

#3
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.

SMF spam blocked by CleanTalk