Frictional Games Forum (read-only)
[SCRIPT] Eye Blinking Script? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Eye Blinking Script? (/thread-30099.html)



Eye Blinking Script? - goodcap - 06-07-2015

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)


RE: Eye Blinking Script? - FlawlessHappiness - 06-07-2015

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");
}


RE: Eye Blinking Script? - DnALANGE - 06-07-2015

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)


RE: Eye Blinking Script? - Slanderous - 06-07-2015

Why the hell would you add blinking eye to your story since the player blinks naturally dude?!


RE: Eye Blinking Script? - Radical Batz - 06-07-2015

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


RE: Eye Blinking Script? - DnALANGE - 06-07-2015

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!


RE: Eye Blinking Script? - RaideX - 06-07-2015

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.


RE: Eye Blinking Script? - Neelke - 06-07-2015

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.


RE: Eye Blinking Script? - Kreekakon - 06-07-2015

This has been taken elsewhere. Please refrain from commenting in this matter anymore in this thread. Violators will be warned.