Bird in room and **Squawk Squawk Squawk** [SOLVED]

Started by Candle, Fri 31/12/2004 03:20:46

Previous topic - Next topic

Candle

I just want him to say **Squawk  Squawk  Squawk **  random times with out blocking . whats the easy way to do this ?

Gilbert

You may try using DisplaySpeechBackground() and some scripting. Like for example:

Define necessary variables on top of the room's script:
int overid, squawk;

Then in repeatedly execute of that room:
if (squawk==0) {  //If bird is not talking
  if (Random(10)==0) { //so it'll be 1/10 chance, increase that 10 if you want it to speak less frequently and decrease if you ant the opposite
    squawk=1;
    overid=DisplaySpeechBackground(BIRD, "**Squawk  Squawk  Squawk **");
  } else if (IsOverlayValid (overid)==0) squawk=0;

Candle


Barbarian

Okay, this is just one possible example of how you might do something like that:

For the room you want to add the random "Squawking", and at the "Player enters screen (before fadein)" part, add a "Run Script" command, and in the script have a command such as:
Code: ags
SetTimer(1,Random(200+400));


Then in that room's Repeatedly Execute part, add another script with commands such as:
Code: ags
if (IsTimerExpired(1)==1){ Ã, 

PlaySound(4);

SetTimer(1,Random(200+400));
}


Whereas Sound number 4 is your "Squawk" sound effect (or whatever number it is for your game). And you can change the Timer's (200+400) part to either lower number to have the Squawk sound play more frequently or increse the number higher to slow down the frequency. If you wanted actual text message to appear rather than an sound-effect, you could easily replace or add a DisplaySpeech command in where the "PlaySound(4);" part of the script was.

*Edit, I notice Gilbot was adding a reply at the same time I was entering my reply, but I'll still post my message as another option for you to consider.
Conan: "To crush your enemies, see them driven before you, and to hear the lamentation of the women!"
Mongol General: "That is good."

Blade of Rage: www.BladeOfRage.com

Candle

Thanks Barbarian , I got yours to work were the other one only  ran the one time and that was it . I messed with the time but didn't seem to help .but yours works fine .
Thanks .

Gilbert

BTW Barbarian, I suppose your line was intended to be:

SetTimer(1,200+Random(400));

which may work better, right? ;)

Candle

Quote from: Gilbot V7000a on Fri 31/12/2004 04:05:42
BTW Barbarian, I suppose your line was intended to be:

SetTimer(1,200+Random(400));

which may work better, right? ;)

Seems to work fine now ?

SMF spam blocked by CleanTalk