Author Topic: an eNoBlock animation will never happen  (Read 199 times)

bx83

  • Get 'Er Doooooone
an eNoBlock animation will never happen
« on: 25 Feb 2018, 23:17 »
I've probably asked this before, but humour me.

I'm trying to run an animation at the begining of each question in a dialog:

Code: Adventure Game Studio
  1. @2
  2. cJulius.LockView(82);
  3. cJulius.Animate(2,0,eOnce,eBlock);
  4. cJulius.SayBubble("&1301 'What's your favourite character?'");
  5. ...
  6.  

However, the animation is a bit too long - ~2 seconds. Because it's blocking, I can't skip it, even as it delays every single question. BUT If I change it to eNoBlock, it doesn't happen.
Same for the following:

Code: Adventure Game Studio
  1. @1
  2. cJulius.LockView(82);
  3. while (!cJulius.Animating) {
  4.         cJulius.Animate(2,0,eOnce,eNoBlock);
  5. }
  6.  

and

Code: Adventure Game Studio
  1. @1
  2. cJulius.LockView(82);   //read's script
  3. cJulius.Animate(2,0,eOnce,eNoBlock);
  4. cJulius.UnlockView();
  5.  

and

Code: Adventure Game Studio
  1. @1
  2. cJulius.LockView(82);   //read's script
  3. cJulius.Animate(2,0,eOnce,eNoBlock);
  4. *all the other lines*
  5. cJulius.UnlockView();
  6.  

Basically, how can I get a NoBlocking view to just play, once; but if I click or press space-bar it moves on instantly to the next animation (talking)?

bx83

  • Get 'Er Doooooone
Re: an eNoBlock animation will never happen
« Reply #1 on: 25 Feb 2018, 23:44 »
(Also tried with the second argument to animating to 1; 0 is illegal. Same thing; animation doesn't play.)

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: an eNoBlock animation will never happen
« Reply #2 on: 26 Feb 2018, 00:22 »
Ofcourse non-blocking animation does not play, there is SayBubble right after, which probably starts speech animation for the same character.


Whenever you want player to be able to skip over a blocking sequence, use cutscene:
Code: Adventure Game Studio
  1. StartCutscene(eSkipAnyKey);
  2. cJulius.Animate(2,0,eOnce,eBlock);
  3. EndCutscene();
  4.  
not completely certain if it works in dialog script, but hopefully it does.



Only for the information, if you still want to use non-blocking animation (maybe in another place), the way to wait for non-blocking animation is this:
Code: Adventure Game Studio
  1. cJulius.Animate(2,0,eOnce,eNoBlock);
  2. while (cJulius.Animating){
  3.     Wait(1);
  4. }
  5.  

But if you want it to be skippable, inside cutscene:
Code: Adventure Game Studio
  1. StartCutscene(eSkipAnyKey);
  2. cJulius.Animate(2,0,eOnce,eNoBlock);
  3. while (cJulius.Animating && !Game.SkippingCutscene){
  4.     Wait(1);
  5. }
  6. EndCutscene();
  7.  

If there is no cutscene, you may do something like this -
Code: Adventure Game Studio
  1. cJulius.Animate(2,0,eOnce,eNoBlock);
  2. while (cJulius.Animating && !IsKeyPressed(eKeyEscape)){
  3.     Wait(1);
  4. }
  5.  
Which may be improved by replacing IsKeyPressed with some function that detects all keys and mouse clicks necessary. AFAIK there was some module that was doing checks, but I cannot remember it right away.


« Last Edit: 26 Feb 2018, 00:36 by Crimson Wizard »

bx83

  • Get 'Er Doooooone
Re: an eNoBlock animation will never happen
« Reply #3 on: 26 Feb 2018, 06:53 »
Quote
cJulius.Animate(2,0,eOnce,eNoBlock);
while (cJulius.Animating){
    Wait(1);
}

Doesn't work (in a dialogue script).

Quote
StartCutscene(eSkipAnyKey);
cJulius.Animate(2,0,eOnce,eBlock);
EndCutscene();

Doesn't work; can't skip seen, even though a timer doesn't appear.

Quote
StartCutscene(eSkipAnyKey);
cJulius.Animate(2,0,eOnce,eNoBlock);
EndCutscene();

Doesn't work, animation doesn't play (for more than one frame).

Quote
StartCutscene(eSkipAnyKey);
   cJulius.Animate(2,0,eOnce,eNoBlock);
   while (cJulius.Animating && !Game.SkippingCutscene){
      Wait(1);
   }
EndCutscene();

Doesn't work; timer appears, doesn't allow skipping.

Quote
cJulius.Animate(2,0,eOnce,eNoBlock);
while (cJulius.Animating && !IsKeyPressed(eKeyEscape)){
    Wait(1);
}

DOES WORK - in a dialogue script, anyway. Now I start the journey of finding out how to say 'If the user clicks the left mouse button'...

bx83

  • Get 'Er Doooooone
Re: an eNoBlock animation will never happen
« Reply #4 on: 26 Feb 2018, 06:58 »
Quote
cJulius.LockView(82);   //'reading script' animation
cJulius.Animate(2,0,eOnce,eNoBlock);
while (cJulius.Animating && !WaitMouseKey(1)){
    Wait(1);
}

This works, and wait's for a mouse button :)