Hello!!
I'm a new user of the forum.
I've started to use AGS yesterday. I've read in the tutorial about change the playable character with this code:
cCharacter.SetasPlayer();
So, I introduce in my Room Script this:
function cSofia.SetasPlayer();
To change cAlfred character to CSofia.
What is wrong?
That doesn't even make sense.
What event do you want to have happen to make the player change character? Then you put the cSofia.SetasPlayer(); line in that function.
something like:
function cSofia_click()
{
cSofia.SetasPlayer();
}
Hello.
First of all, it's SetAsPlayer, the script is case sensitive.
Regarding where to place this command, as dayowlron mentioned you need to put it in a function.
AGS script is function-based, which means that all commands must be in some function. Functions are called either by events or other functions.
Events can be like game start, entering the room, clicking on character or button, and so on.
How do you connect events to functions? Bunch of events look for certain function names which cannot be changed, like "game_start". They are listed here: https://www.adventuregamestudio.co.uk/manual/ags40.htm#TextScriptEvents
Room and object-related events (also for characters, GUI, inventory items etc) are configured on their respective property pane, on the "events" tab. You can go there by clicking on the "lighting" tool button when an object is currently selected in the editor.
https://www.adventuregamestudio.co.uk/manual/acintro3.htm
https://youtu.be/_lghOGrET2A
These videos might help. They are old, but they will give you an idea of how things work.
Thanks you very much at all.
Yesterday I found a solution. I used an event called room_AfterFadeIn() in the room2 and made the function CharacterAsPlayer.
Thanks you another time.