Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Alen101 on Sun 03/01/2016 01:15:44

Title: Blinking view
Post by: Alen101 on Sun 03/01/2016 01:15:44
Im trying to make my characters blink, and blinking view seems the best way to do it.
But i dont understand it very well.

I want my characters to blink during the entire game so i suppose i put this stuff on global script,
but it gives me an error.

In the room it does not give me any error, but it dont work.


Code (ags) Select

cAlex.BlinkView = 23;
cAlex.BlinkInterval = 160;


Also i have 3 views to change right?
the front one and the two sides.
Do I have to do something with the loops?
Any ideas?
Title: Re: Blinking view
Post by: Crimson Wizard on Sun 03/01/2016 02:26:34
Quote from: Alen101 on Sun 03/01/2016 01:15:44
I want my characters to blink during the entire game so i suppose i put this stuff on global script,
but it gives me an error.
When game gives you an error, please tell what error is, because it's important.

Quote from: Alen101 on Sun 03/01/2016 01:15:44
Code (ags) Select

cAlex.BlinkView = 23;
cAlex.BlinkInterval = 160;

Please tell where (which script and function) did you put this script, it may also be important.

Title: Re: Blinking view
Post by: Alen101 on Sun 03/01/2016 03:10:07
Yes sorry i didnt give much direcctions,
ok so, if i put this:
Code (ags) Select
cAlex.BlinkView = 23;
cAlex.BlinkInterval = 160;


on global script it says:

Code (ags) Select
GlobalScript.asc(577): Error (line 577): Parse error: unexpected 'cAlex'

i supose maybe it got to be inside some function?

i put it outside of any function, now i realise it probably have to go inside one , but no idea of which one.

if i put this stuff (the same stuff)

in a room, it does not give me any errors but it dont work at all,
Ive putted it inside:
function room_Load()

i have make view of the player looking front, to the camera with two frames
one open eyed and the other with closed eyes.I have called it: VAlexBlink and its the View number 23
I suppose the :
QuotecAlex.BlinkView = 23;
would call this new view i have made, but so far no luck.
Title: Re: Blinking view
Post by: Snarky on Sun 03/01/2016 03:54:23
You can put it in room_load() for your first screen, or in game_start() (which I would recommend), or any other function that runs once as the game starts up.

However, I believe AGS only plays the "blinking" animation during speech/thinking. (Part of its legacy of originally being designed for Sierra-style games.) This doesn't seem to be clearly documented, but if you look up the Character.BlinkWhileThinking entry, it's implicit there. If you want blinking while the character is just standing around, you should probably use IdleView instead.
Title: Re: Blinking view
Post by: Alen101 on Sun 03/01/2016 06:10:37
Ok so, as i dont have the sierra style i guess it wont work for me.
That left me with idleview,
Rigth now i manage to change the animation.
Without a problem in this way.
Code (ags) Select
cAlex.LockView(26);// change to the blink view
cAlex.Animate(0, 8, eOnce, eBlock, eForwards);//the blink goes on
cAlex.LockView(10);//back to the normal view

But every time i want the player to blink y have to add 3 lines of code.
Is there any way to make the idleview in a more independant way?

I have tried using:

Code (ags) Select

function room_Load()
{
cAlex.SetIdleView(23, 10);
}

but nothing happened.

the 23 view i call there have the character blinking animation, the front, back, and sides.
Title: Re: Blinking view
Post by: Snarky on Sun 03/01/2016 11:01:29
Are you sure? With those values he should blink once every ten seconds, but only if he's actually idle (not walking, talking, or playing any other animation) and LockView is not set.

I would also add an up loop to the view, even if it's just his back not doing anything.
Title: Re: Blinking view
Post by: Alen101 on Sun 03/01/2016 16:42:44
Oh, i got the player locked in a view!
I also added the back blink as Snarky said.
Its working now! thank you!.