Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Paul Franzen on Sun 07/10/2012 19:52:59

Title: SayAtBackground?
Post by: Paul Franzen on Sun 07/10/2012 19:52:59
Does anyone know how to code a character.SayAtBackground function? I have a creature who's being carried around by the player character in his inventory. There's one screen in particular where, if the player is carrying the creature, the creature starts making little noises (to signify that there's something on this screen he's interested in) from the player's inventory.

Here's what the code looks like:

function room_RepExec()
{
if(cPaul.HasInventory(iInventory46)){ // Paul has Merlin
   int haphap=Random(250);
   if (haphap==3){
    DisplaySpeechAt((character[PAUL].x)-75, (character[PAUL].y)-50, 125, MERLIN, "hap hap!");
   
   }
}
}

(Please excuse the combination of old- and new-style code; this game has a few different people working on it, and it's gone through a few different AGS versions.)

This means that the character "randomly" (i.e., every time the counter hits 3) says "hap hap!" from Paul's torso when he's on this screen. The problem is that, since it's not a SayBackground command, Blocking is turned on, so the game has to stop each time he says "hap hap." Is there a way to turn off Blocking for a SayAt command? (It's not the end of the world if there's no simple way to do it, but I figured I'd ask, since people here Know Things, and I don't always Know Things.)

Thanks in advance!
Title: Re: SayAtBackground?
Post by: arj0n on Sun 07/10/2012 20:04:02
Why not use SayBackground?
Title: Re: SayAtBackground?
Post by: Paul Franzen on Sun 07/10/2012 20:41:50
I need the creature to be saying it at a specific location relative to the main character's positioning. (It's not an on-screen character itself; it's in Room -1, technically, displaying its speech wherever the player happens to be.)
Title: Re: SayAtBackground?
Post by: Andail on Sun 07/10/2012 20:51:09
Have a dummy character say it, using SayBackground. This character is invisible (use a blank sprite) and follows the main character around the screen.
Title: Re: SayAtBackground?
Post by: Crimson Wizard on Sun 07/10/2012 20:54:43
Quote from: Andail on Sun 07/10/2012 20:51:09
Have a dummy character say it, using SayBackground. This character is invisible (use a blank sprite) and follows the main character around the screen.
Yeah, this is probably the best way to do this IMO.
Also this way you may make speech have different text color to allow player distinguish creature speech from PC's speech.
Title: Re: SayAtBackground?
Post by: Paul Franzen on Sun 07/10/2012 21:05:03
All right, I can do that! Thanks!