Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: strazer on Thu 15/01/2004 10:25:26

Title: Blinking view problem
Post by: strazer on Thu 15/01/2004 10:25:26
Hi!

1.) Moved to technical forum (http://www.agsforums.com/yabb/index.php?board=2;action=display;threadid=10990) (Crossfade ambience)

2.) I can't get the blinking view to work. I assigned the correct view (8) to my player character and the animation is correct when testing it with talking for example.
I put
SetCharacterBlinkView(EGO,8,2*40);
in the game_start function.
Yet my character never blinks. Am I missing something?

Thanks
Chris
Title: Re:Crossfade ambience & Blinking view problem
Post by: Ishmael on Thu 15/01/2004 11:17:27
2) SetCharacterBlinkView(EGO, 8, 80);

I think... I'm not sure how AGS handles multiplying or division etc in function parameters...
Title: Re:Crossfade ambience & Blinking view problem
Post by: strazer on Thu 15/01/2004 11:22:50
Quote2) SetCharacterBlinkView(EGO, 8, 80);

I think... I'm not sure how AGS handles multiplying or division etc in function parameters...

Nope, no change.
Title: Re:Crossfade ambience & Blinking view problem
Post by: Ishmael on Thu 15/01/2004 11:25:33
Hmmmm.... Try placing it into the "Player enters screen for the first time" of the first room the player enters...
Title: Re:Crossfade ambience & Blinking view problem
Post by: strazer on Thu 15/01/2004 11:28:09
Same thing.

Isn't the blinking view a fairly new addition to AGS? Is there anyone/game that has it yet?
Title: Re:Crossfade ambience & Blinking view problem
Post by: Scorpiorus on Thu 15/01/2004 14:54:19
Quote from: strazer on Thu 15/01/2004 10:25:26
Hi!

1.) Seeing how it is possible to crossfade music (which uses channel 0), would it be a big problem to implement the same thing for ambience (channel 1)?
If I didn't use music, I could of course use the music channel.
I realize it would probably slow down quite a bit if the engine had to decode 4 files simultaneously. Still.
Since it's a suggestion it would be reasonable to post it in the technical forum instead.

Quote2.) I can't get the blinking view to work. I assigned the correct view (8) to my player character and the animation is correct when testing it with talking for example.
I put
SetCharacterBlinkView(EGO,8,2*40);
in the game_start function.
Yet my character never blinks. Am I missing something?
Blinking only works with the sierra-style speech, is that ok?
Title: Re:Crossfade ambience & Blinking view problem
Post by: strazer on Thu 15/01/2004 15:06:30
QuoteSince it's a suggestion it would be reasonable to post it in the technical forum instead.
Indeed.  Will do. Thanks for the hint.

QuoteBlinking only works with the sierra-style speech, is that ok?
What does this have to do with anything? Shouldn't he blink when he isn't talking as well?
Maybe I am misunderstanding the whole thing? Blinking as in opening and closing your eyes, yes?
Title: Re:Blinking view problem
Post by: Scorpiorus on Thu 15/01/2004 15:17:53
No no, only whe he is talking. I haven't put it in use yet, but from what I tried the blinking view is used to play random animations (during the talk) and AGS draws the blink frames over character's talking image. So, yes your eyes example fit in very well to describe what the feature is useful for.

~Cheers
Title: Re:Blinking view problem
Post by: strazer on Thu 15/01/2004 15:27:58
I see. Well, I'm using LucasArts-style speech. :-\

So if I wanted my character to both blink in certain (shorter) intervals when standing around, but also have other idle animations in certain (longer) intervals, it would involve some scripting constantly changing idle views, right?
Title: Re:Blinking view problem
Post by: SSH on Thu 15/01/2004 15:35:15
I'm not sure how you would check if the character is doing an idle view to know when to update it. I guess that player.view should change when the idle animation starts, so put

if (player.view + 1 ==  IDLE1_VIEW_NUMBER) {
  SetCharacterIdle(EGO, IDLE2_VIEW_NUMBER, 20 );
} else if (player.view + 1 ==  IDLE2_VIEW_NUMBER) {
  SetCharacterIdle(EGO, IDLE1_VIEW_NUMBER, 20 );
}

in rep_ex to alternate, or use a counting variable if you only want to use change view every N times...
Title: Re:Blinking view problem
Post by: strazer on Thu 15/01/2004 16:56:10
How about this:

game_start:

 SetTimer(1,3*GetGameSpeed());
 SetTimer(2,10*GetGameSpeed());

repeatedly_execute:

 if (IsTimerExpired(1) && (player.animating==0)) {
   SetCharacterIdle(EGO,8,1); // 8 = blinking
   SetTimer(1,3*GetGameSpeed());
 }
 if (IsTimerExpired(2)) {
   SetCharacterIdle(EGO,14,1); // 14 = idle animation
   SetTimer(2,10*GetGameSpeed());
 }

The first timer is for the blinking eyes, the other for the normal idle animation.
Seems to work.

Does this seem efficient? How would you do it?
Title: Re:Blinking view problem
Post by: Scorpiorus on Fri 16/01/2004 12:49:06
Hmm, I guess it won't work that exactly as you probably want:

Quote
if (IsTimerExpired(1) && (player.animating==0)) {
  SetCharacterIdle(EGO,8,1); // 8 = blinking
  SetTimer(1,3*GetGameSpeed());
}
See, that part can stick because IsTimerExpired() returns 1 only once.
What if it returns 1 and the player is animating at the same time, the block of script will never be run and thereby the timer is not reset anymore. The next modification would reset it properly.

if (IsTimerExpired(1)) {
   if (player.animating==0) SetCharacterIdle(EGO,8,1); // 8 = blinking
   SetTimer(1,3*GetGameSpeed());
}




Quoteif (IsTimerExpired(2)) {
  SetCharacterIdle(EGO,14,1); // 14 = idle animation
  SetTimer(2,10*GetGameSpeed());
}
That's ok, except the delay between players inactivity and idle starting. For example, you can move the character around for 9 seconds, stop him and then the idle animation will be played in just 2 seconds after he has been stopped.


Also, if you want to make a use of build in idle routine and ready to sacrifice some characters take a look at FollowCharacterEx() command in the manual, specifically about the FOLLOW_EXACTLY option.

You can create another character set his idle view and put in script the next:

FollowCharacterEx(EGO, BLINKCHAR, FOLLOW_EXACTLY, 0);

That could be a good way to add an extra stuff.

~Cheers
Title: Re:Blinking view problem
Post by: strazer on Fri 16/01/2004 13:45:41
QuoteThe next modification would reset it properly.

Thanks!

QuoteFor example, you can move the character around for 9 seconds, stop him and then the idle animation will be played in just 2 seconds after he has been stopped.

I could live with it, but you're right. Now I reset the timer everytime the user clicks anywhere.

QuoteFollowCharacterEx(EGO, BLINKCHAR, FOLLOW_EXACTLY, 0);

Good idea. However, I tested it, and:

- the blinking character is not always in front of the player character
- he even blinks when the player character is walking
- he doesn't always face the same direction as the player character

With some tweaking, I could probably make it work, but for the moment I'll stick with my solution, although I just realized I will have to do timers for EVERY character that has an idle animation in addition to blinking.

Because of all that hassle involved I thought that's what the blinking view was for. Maybe such a view will be added to AGS in the future. I'll put this one on the back of my priorities list until then.

Thanks again for you help!
Chris