Room fades out too early (SOLVED)

Started by Blade, Fri 14/01/2005 13:24:16

Previous topic - Next topic

Blade

Here's my script for player enters screen after fadein. It's supposed to wait a short while before a dialog begins, then fade out after the dialog and go to different room.

// script for room: Player enters screen (after fadein)
Wait(5)
RunDialog(1); //chaufer talks with DM
Wait(10);
FadeOut(3);
NewRoom(11); //mapÃ, 

Well, it loads the room and almost immediately fades it out, not allowing anything to be visible, then goes to the next room. It just won't show the player what's this room supposed to be for. I suppose my fault is not using 'while' or some other functions but I don't know how to handle that.
Studies show that 50% of the people do not know they form half of the society.

strazer

First, the Wait command takes game loops as parameter, not seconds. The default game speed is 40 game loops per second, so if you want to wait 5 seconds, do
  Wait(5*40); // wait 5 seconds, or less if game speed is increased
or
  Wait(5*GetGameSpeed()); // wait 5 seconds, regardless of game speed setting

Second, the RunDialog and NewRoom commands are delayed functions, meaning they don't get executed immediately but are delayed until the script finishes.
The easiest solution is to add two "Run script" actions to the "Player enters room" interaction, the first containing
  Wait(5*GetGameSpeed());
  RunDialog(1); //chauffeur talks with DM
and the second
  Wait(10*GetGameSpeed());
  FadeOut(3);
  NewRoom(11); //map

Ishmael

;)

Because, to quote the holy Manual:



RunDialog
RunDialog (int topic)

Starts a conversation using topic number TOPIC. This is identical to the "Run dialog topic VAL" room interaction command.
NOTE: The conversation will not start immediately; instead, it will be run when the current script function finishes executing.

If you use this command from within the dialog_request function, it will specify that the game should return to this new topic when the script finishes.




And damn you strazer!
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Blade

Studies show that 50% of the people do not know they form half of the society.

SMF spam blocked by CleanTalk