Frictional Games Forum (read-only)

Full Version: Eye Blinking Script?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to add realism to my custom story, so I was wondering if there's a way to make an eye blinking effect (screen fades out every few seconds)
Add a timer, that calls itself.
Use FadeOut(float) and FadeIn(Float)
Voila.

A timer that calls itself can look like this:

void Timer(string &in asTimer)
{
AddTimer("", 1.0, "Timer");
}
Just do not make it too much!
Blinking \ flickering could be disturbing!
Take it slow on that.
Might also take a RandInt for the blinking for randomised (events)
Why the hell would you add blinking eye to your story since the player blinks naturally dude?!
(06-07-2015, 11:13 AM)Lazzer Wrote: [ -> ]Why the hell would you add blinking eye to your story since the player blinks naturally dude?!

Someone's mad and not agreeing with someone's idea..
Laz doesnt't have a good day, seen his other post??
https://www.frictionalgames.com/forum/thread-30098.html
GoodCap, dont mind Lazzer, he is a pain in the ass sometimes.
Lets all stay On-Topic please!
yeah. I'd personally find it to be more of an annoyance too. But since you asked.

PHP Code:
void RandEyeBlink (string &in asTimer) {

FadeOut(0);
FadeIn(0.2f);
AddTimer("RandomRepeatBlink"RandFloat(3.0f10.0f), "RandEyeBlink");


This is probably as close as you can get. For me anyway.

If you'd want to stop it at some point, you would have to add an if statement or remove the timer.
So I'll answer the actual question of the thread. I made a function named Blink, where you can just use it in a regular looping timer.

Code:
void Blink(float fFadeOut, float fFadeIn)
{
    FadeOut(fFadeOut);
    AddTimer("loop", fFadeOut, "TimerBlink");
}

void TimerBlink(string asTimer) { FadeIn(fFadeIn); }

So let's say you have a looping timer ready, you place this function in it.

Code:
void LoopTimer(string asTimer)
{
      Blink(1.5f, 2.0f);
}

fFadeOut stands for how quick you want the player to close his eyes, meanwhile fFadeIn stands for how quick you want the player to open his eyes.
This has been taken elsewhere. Please refrain from commenting in this matter anymore in this thread. Violators will be warned.