How to make my character face a direction right as the game starts?

Started by theinsanedump, Tue 13/03/2018 20:21:24

Previous topic - Next topic

theinsanedump

Hi there, I am attempting to script my character so that he starts the game facing up towards a TV. However, I am receiving a Parse Error: Unexpected 'cChris' and I am very confused because my character's name is Chris. In the character properties it says ScriptName: Chris. I also tried putting cChris in there based on the video tutorials, but it still doesn't work.

Here is the code I have in my room file;

Code: ags

// room script file
  cChris.FaceDirection(eDirectionUp);


I have also tried using the default Ego name (cEgo in the script) with no luck. I am stuck. Any help would be appreciated.

Thank you very much!

Crimson Wizard

Question: is this the only line you have in a the script?
Any command must be inside function.

You need to open your room's events table and create at least 1 event function, for example "Enter room before fade-in".
Then put your commands inside that function.


theinsanedump

It worked!! You are an amazing human being! Thank you very much!

Mandle

It sounds like you are very new to AGS.

I would suggest you spend some time reading/watching some tutorials. The time invested will return to you ten-fold as it will speed up your development time that much.

Some of the best are on youtube. Search something like "how to use AGS" on youtube. Watch the series based on making the game "Sammy's Quest". Some coding syntax might be slightly out of date but the basic concepts are still the same.

Watching this series turned my from a complete noob afraid to write a single line of code for the inevitable errors I would get into a more experienced noob unafraid of the inevitable errors I still get.

Because at least now I can understand what the errors mean and where they stem from and fix them "quickly".


Khris

Let me also add that AGS is 100% event based. Apart from variable definitions and the like, all code goes into functions, and those are called by the AGS engine whenever the linked event occurs. Most events are interactions by the user, like "clicked interact cursor on flower pot", or "let player character walk on region 1".

Make absolutely sure to do at least the manual's tutorial, which has a basic introduction to events and their functions in part 3 (iirc).

SMF spam blocked by CleanTalk