In one part of my game Hawaiian Treasure there will be a casino with a roulette table so there is going to be a croupierre that announces winners and so on. Now here is my quesion: How do I similiar sayings for that the crouierre in Grim Fandango saying announces like first he says "Please place your bets" after a couple of seconds he say " Betting is closed." and after about a minute he say the winners randomly? Understand what I mean? Can somebody please help me?
Pseudo Code
If your character is in the room or is capapble of hearing the announcer, Have a timer start and then start with
at 10 loops or whatever increment you want to work with,
DisplaySpeechBackground (MAN, "Ladies and Gentlemen, Please place your bets.");
then another check at if the timer is at say, 50 loops, the next message and so on.
Within this you could put your check to see if your ego has gotten their bet placed within the timer.
Well, in your room it activates a timer :
SetTimer (int timer_id, int timeout);
Remembers 40 loop it is one second 20 Timer_id they Exist
Then it compares if you finishes the time
Example.
function room_c () {
/ / script for room: First time player enters screen
SetTimer(1,40); // 1 second
SetTimer(2,160); / /4 seconds
}
function room_b () {
/ / script for room: Repeatedly execute
If (IsTimerExpired(1)==1)
{DisplaySpeechBackground (CROUPIERRE, "LADIES AND GENTLEMEN, PLEASE PLACE YOUR BETS");}
IF (IsTimerExpired(2)==1)
{DisplaySpeechBackground (CROUPIERRE, "BETTING IS CLOSED".);}
}
:)
Ok but when the announcing of the winners? Like he says "Fourteen, red" or "Twenty,black" and sometimes he say "House pays all winners". Like it's taking about after saying "Betting is closed"15 secs or so and then the winners comes randomly.
Declare a variable using a randomization function (can't remmeber the name) then use the number created to choose from a set of options for the croupier to say.
Sorry, but I'm new so I don't know the exact scripting, but I pretty sure it can be done this way...
//add another timer to as room loads
SetTimer(3,300);
//then in repeatedly execute
if (IsTimerExpired(3)==1)
{int ran=Random(32);
if (ran==0) DisplaySpeechBackground (MAN,"red one");
else if (ran==1) DisplaySpeechBackground (MAN,"red two");
else if (ran==2) DisplaySpeechBackground (MAN,"red three");
else if (ran==3) DisplaySpeechBackground (MAN,"red four");
else if (ran==4) DisplaySpeechBackground (MAN,"red five");
else if (ran==5) DisplaySpeechBackground (MAN,"red six");
else if (ran==6) DisplaySpeechBackground (MAN,"red seven");
else if (ran==7) DisplaySpeechBackground (MAN,"red eight");
else if (ran==8) DisplaySpeechBackground (MAN,"red nine");
else if (ran==9) DisplaySpeechBackground (MAN,"red ten");
else if (ran==10) DisplaySpeechBackground (MAN,"red eleven");
else if (ran==11) DisplaySpeechBackground (MAN,"red twelve");
else if (ran==12) DisplaySpeechBackground (MAN,"red thirteen");
else if (ran==13) DisplaySpeechBackground (MAN,"red fourteen");
else if (ran==14) DisplaySpeechBackground (MAN,"red fiveteen");
else if (ran==15) DisplaySpeechBackground (MAN,"red sixteen");
else if (ran==16) DisplaySpeechBackground (MAN,"black two");
else if (ran==17) DisplaySpeechBackground (MAN,"black three");
else if (ran==18) DisplaySpeechBackground (MAN,"black four");
else if (ran==19) DisplaySpeechBackground (MAN,"black five");
else if (ran==20) DisplaySpeechBackground (MAN,"black six");
else if (ran==21) DisplaySpeechBackground (MAN,"black seven");
else if (ran==22) DisplaySpeechBackground (MAN,"black eight");
else if (ran==23) DisplaySpeechBackground (MAN,"black nine");
else if (ran==24) DisplaySpeechBackground (MAN,"black ten");
else if (ran==25) DisplaySpeechBackground (MAN,"black eleven");
else if (ran==26) DisplaySpeechBackground (MAN,"black twelve");
else if (ran==27) DisplaySpeechBackground (MAN,"black thirteen");
else if (ran==28) DisplaySpeechBackground (MAN,"black fourteen");
else if (ran==29) DisplaySpeechBackground (MAN,"black fiveteen");
else if (ran==30) DisplaySpeechBackground (MAN,"black sixteen");
else DisplaySpeechBackground (MAN,"black one");
SetTimer(3,300);
}
///experiment with the timer amounts to get the cycle right..note the SetTimer at the
///end of the else if random section to make sure it repeats ,alter this amount allso to match
probably a neater way to do it but it should be ok