Amnesia "Insanity-like" view

For those of you who have played Amnesia: The Dark Descent, what I’m trying to do is make a script that creates the visual “insanity” effects as well as the “terror” sound like when a monster sees you. I want the music and visuals to begin when you have reached a set amount of HP (15 or below, for example) and when an enemy is pursuing you.

For those of you who do not know what I mean, I want to make a script that (when the requirements above are met)
-makes the player’s vision blur
-slightly distorts color
-creates a sort of “fish-eye” effect
-plays+loops a sound

If this seems unrealistic, the reason I believe that this script is possible is simple - hours of toying around with the post-processing effects ingame.
I am very new to LUA coding. The reason I have posted this is to ask how difficult it would be to write a script like this, considering that I am a beginner.

In Gamemode.EntityTakeDamage you can check if they are alive and if they are, if their health is 15 or below and if it is you can use post processing effects, such as G.DrawMotionBlur (there should be links to the other post processing effects on that wiki page).

All of that is possible. The most tricky part would be distorting the view the same way they do in Amnesia. The color distortion can be done with post processing effects like Color Mod and Bloom. You could dink around with the player’s FOV and add some blur for the fisheye effect like cis.joshb said. Sounds wouldn’t be too difficult to do, you’d just need to figure out when to make them start and stop.

Check out these pages:

You can use CalcView to do some cool FOV effects. RenderScreenspaceEffects is where you would call DrawMotionBlur, DrawColorModify, and DrawBloom from. CreateSound allows you to create a looping sound that can be started and stopped at any time.

To trigger all of this I’m guessing you’ll want to use a **[Gamemode.PlayerHurt](** hook or something similar, but you’ll need to tell the client to start all of these effects from there by using a custom console command or usermessage.

Don’t let the fact that you’re a beginner daunt you. Lua (Lua is not an acronym, it is portuguese for “moon”) tends to be very accessible to coders and non-coders alike.

The way I learned was to look at how other people did things, and then use that knowledge to make my own things.

Sorry I wasn’t very specific in things, but if you have specific questions, I’m always here.

Thanks for the feedback :slight_smile:
I can’t do much now, being out of town for the holidays. But when I get back I’ll certainly get to it.