First, here is the script:
// script for room: Repeatedly execute
if (GetGlobalInt(2) == 3) {
if (GetGlobalInt(3) == 2) {
PlaySound(2);
SetGlobalInt(2,4);
}
}
My character is preparing for a party. He must do two things before the guests arrive (Int 2 and 3). After he completes these, the guests arrive (sound2 = doorbell). However, the current script plays the sound the very second the character finishes the second task. I want there to be a good 5 to 10 second delay before the guests arrive. However, if I use "wait" the game locks up, I do not want this. I want for the player to be able to continue playing for these 5-10 seconds. Any way this can be done?
You can set a timer for 5 seconds:
// script for room: Repeatedly execute
// you can combine to conditions with the && operator:
if (GetGlobalInt(2) == 3 && GetGlobalInt(3) == 2) { //if GlobalInt2 = 3 AND at the same time GlobalInt3 = 2
PlaySound(2);
SetTimer(1, 5*GetGameSpeed()); // set timer #1 to tick for about 5 seconds.
SetGlobalInt(2,4);
}
if (IsTimerExpired(1)==1) { //if timer #1 has just expired
// ghosts appearing code here
...
}
Thanks a lot! Worked great and I learned something new! (&&)