Blinking view problem

Started by strazer, Thu 15/01/2004 10:25:26

Previous topic - Next topic

strazer

Hi!

1.) Moved to technical forum (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

Ishmael

#1
2) SetCharacterBlinkView(EGO, 8, 80);

I think... I'm not sure how AGS handles multiplying or division etc in function parameters...
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.

strazer

Quote2) SetCharacterBlinkView(EGO, 8, 80);

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

Nope, no change.

Ishmael

Hmmmm.... Try placing it into the "Player enters screen for the first time" of the first room the player enters...
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.

strazer

Same thing.

Isn't the blinking view a fairly new addition to AGS? Is there anyone/game that has it yet?

Scorpiorus

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?

strazer

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?

Scorpiorus

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

strazer

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?

SSH

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...
12

strazer

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?

Scorpiorus

#11
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

strazer

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

SMF spam blocked by CleanTalk