Blinking view

Started by Alen101, Sun 03/01/2016 01:15:44

Previous topic - Next topic

Alen101

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

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?

Crimson Wizard

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

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

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


Alen101

#2
Yes sorry i didnt give much direcctions,
ok so, if i put this:
Code: ags
cAlex.BlinkView = 23;
cAlex.BlinkInterval = 160;


on global script it says:

Code: ags
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.

Snarky

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.

Alen101

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

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.

Snarky

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.

Alen101

Oh, i got the player locked in a view!
I also added the back blink as Snarky said.
Its working now! thank you!.

SMF spam blocked by CleanTalk