script with out it pausing the game

Started by piraatlife4me, Mon 24/11/2003 16:26:25

Previous topic - Next topic

piraatlife4me

Hey Everyone! I just have a real quick basic question that I need help with solving.  Say you have some NPC's in a room and you want things to happen in the background every (some number) of loops along with there idle animations how do you script this with out it pausing the game?.  I know how to set up my idle animations but when I try to have repeating events on top of that It will run them but it pauses the game and the player has to wait untill they are done everytime, and I just want them to happen in the background.  For example I have a fortune teller inside a machine.  She has a idle animation that she executes every 200 loops with that I want her to say like "Insert Coin I will tell you everything" or something like that every 185 loops with out pausing the game at all.  What command and where do I put code to do this?  If anyone knows how to do this I would really appreciate it
thanks
P.S. I was reading the variables section of the ags help contents and was wondering is there any more AGS variables available for use that are not displayed there?I'm  just curious?

Daniel
Winebarger

Ishmael

#1
The speech can be done in the background with DisplaySpeechBackground(), and the every n loops thing goes like:

in the start of room script:

int timer;

and in the room rep_ex:

if (timer == 200) {
// yourcode blah blah blah
timer = 0;
} else timer++;

Read the scripting tutorial of the AGS Manual!
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.

piraatlife4me

Hey TK, thanks alot for the help but I got one other quick question can your characters use their talking views with DisplaySpeechBackground? Or does that only just display speech?

Thanks
Daniel
Winebarger

Scorpiorus

#3
Quotecan your characters use their talking views with DisplaySpeechBackground? Or does that only just display speech?
Yeah, you could do it manually with AnimateCharacter() command:

DisplaySpeechBackgfound(MAN, "...");
AnimateCharacter(MAN, ...); // repeat parameter has to be 1

there is an issue however how to stop talking amination. For this you can check whether an appropriate overlay is valid or not:


at the top of the (room) script

int speech_overlay;

when starting background speech:

// we take the returned overlay id to handle the speech:
speech_overlay = DisplaySpeechBackground(MAN, "blah blah blah");
AnimateCharacter(MAN, ... , 1); //repeat = 1



repeatedly execute (room):

check if our overlay is not valid anymore to stop animation:

if (IsOverlayValid(speech_overlay)==0) ReleaseCharacterView(MAN);

EDIT: oh, and one quick hint :) :
As animation loop you can pass character[EGO].loop and thereby the character would use the right talking loop corresponding to his current direction.

~Cheers

SMF spam blocked by CleanTalk