Player enters screen before fadein + Lockview bugs.[SOLVED}

Started by Lionmonkey, Fri 10/08/2007 14:11:05

Previous topic - Next topic

Lionmonkey

Help. I tried to make main character to lie in a corner wnen the room starts, then open eyes and get up and all that in a one cutscene, so player can skip this, but after many tries I still get error warning after the game. I've looked through manual. AGSwiki and forums, but still can't find the solution.

Here's it
"Some warnings were generated while you were testing this game. They are listed below. These are not serious errors, but you should fix them before distributing your game.

(in room 1): Wait() was used in Player Enters Screen - use Enters Screen After Fadein instead." Whenever I change "Before" to "after", it shows:

"There was an error compiling your script. The problem was:
In: 'Global script'

Error (line 212): Undefined symbol 'eEventEnterRoomAfterFadein'"

Also, after the fadein my character view is default, not one I wanted.

Here's a piece of my global script:

#sectionstart on_event  // DO NOT EDIT OR REMOVE THIS LINE
function on_event(EventType event, int data){
if (event==eEventEnterRoomBeforeFadein) {
   if (player.Room ==1) {
     StartCutscene(eSkipAnyKey);
      character[EGO].LockViewFrame(11,0,1);
      Wait(80);
      character[EGO].LockViewFrame(12,0,1);
      Wait(40);
      character[EGO].UnlockView();
     }

Please explain in simple language why does this occur and how to fix it.
,

Khris

-A wait command in eEventBeforeFadeIn doesn't make any sense because the screen is still black at the time it's executed.

-There's no "eEventAfterFadeIn", that's why you are getting the error.

-You don't need to use on_event.

Just move the code to a RunScript-action in the room's "player enters room (after fadein)"

The on_event function should only be used if something takes place more than once.
It would be a pain to put the same function call in every room, so if something needs to be done in [almost] every room, you use on_event.
Say the player should automatically start sneaking if there are NPCs in a room.
The check for NPCs and the commands to switch the players view and speed should go into on_event.

On the other hand, a singular event like a cutscene at the start of the game should always go into the room's events.

EDIT: The character's view is set back to the default view because you're unlocking it at the end.

Lionmonkey

Sorry, but I'm still new to scripting and can't seem to understand what do I have to do. I've got nothing in my room1 scipt. Could you please show me how exactly sould the script look, please.

Anyway, thanks for quick replying.
,

Khris

In Room editor -> settings, click the red i-Button.
Add a RunScript-Action to the "player enters screen (after fadein)" event by double-clicking it and selecting "RunScript" from the dropdown menu.

Now either click "Edit script..."
OR
close both windows, click the {}-button and edit the contents of the newly created function (my preferred method).

Put in there what you had in on_event:
Code: ags
  StartCutscene(eSkipAnyKey);
  player.LockViewFrame(11,0,1);
  Wait(80);
  player.LockViewFrame(12,0,1);
  Wait(40);
  player.UnlockView();
  EndCutscene();
  
  player.ChangeView(x);  // you mentioned something about not wanting the default view

Lionmonkey

,

SMF spam blocked by CleanTalk