Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script for traumatic/fear visual effects
JohnnyMedieval Offline
Junior Member

Posts: 5
Threads: 1
Joined: Aug 2013
Reputation: 0
#1
Script for traumatic/fear visual effects

Hi people,

I'll start by saying I'm very much new to Amnesia map making, and this one thing I'm working on will probably be the only time I ever do it, so I don't need to learn everything about scripting. Sorry if my question/request is stupid, and if you answer it for me, please explain it to me in a way a newbie can understand. Thanks.

I'm just trying to do something very simple (for a custom video, I'm not even making a whole custom story), so I hope you guys can please just give me a few lines of script or something, without directing me to some long complicated tutorial or just saying "go read the whole wiki."

Anyway, all I'm trying to do is script so that when the player enters an area I placed on the map it triggers the sort of "tunnel vision" or "shockwave" visual effects that trigger when Daniel gets scared by something in the game.

I've been looking around for a few hours, have watched a few tutorial on youtube and skimmed through the wiki, but I just can't seem to find anything that tells me how to script these visual effects. I have watched a tutorial on how to set up an area and script it to slam a door though, so I know some basics.

Anyway, if someone could help me out and tell me what scripts I need to add to do this, I'd appreciate it. Thanks in advance.
08-28-2013, 03:09 PM
Find
Kreekakon Offline
Pick a god and pray!

Posts: 3,063
Threads: 70
Joined: Mar 2012
Reputation: 124
#2
RE: Script for traumatic/fear visual effects

Well according to what you said knowing how to set up an "area", I'll assume you're familiar with AddEntityCollideCallback. If you're not, tell me, and I'll elaborate.

The visual effect you're looking for is actually very simple, and is built into the engine. it plays when the player takes sanity damage. It works as follows:

Quote:
void GiveSanityDamage(float afAmount, bool abUseEffect);

Reduces the sanity of the player.

afAmount - amount of sanity damage done

abUseEffect - determines whether an effect is played when the sanity damage is dealt

[Image: Tv0YgQb.gif]
Image by BandyGrass
(This post was last modified: 08-28-2013, 03:19 PM by Kreekakon.)
08-28-2013, 03:19 PM
Find
JohnnyMedieval Offline
Junior Member

Posts: 5
Threads: 1
Joined: Aug 2013
Reputation: 0
#3
RE: Script for traumatic/fear visual effects

Hey, thanks for the quick response Smile

I'm sorry I'm not really familiar with AddEntityCollideCallback, I actually didn't pay that much attention yet to the door slamming tutorial since that wasn't what I'm looking to do.

Basically, I have my map set up, I added an area, and I just need to know I guess what exactly I have to type into the .hps to make the area cause sanity damage when I step into it. It's really a simple thing, just one room and I'll be adding two scripted areas, that cause sanity damage.

Thanks for the help.

Ok I just looked at that tutorial again quick, so the AddEntityCollideCallback is just for when the player collides with the area. I understand, kind of Tongue pardon my noobishness.
(This post was last modified: 08-28-2013, 03:47 PM by JohnnyMedieval.)
08-28-2013, 03:25 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: Script for traumatic/fear visual effects

Great thing you read on it again, and understood it better! Smile Ask again if you need more help!

Trying is the first step to success.
08-28-2013, 03:41 PM
Find
JohnnyMedieval Offline
Junior Member

Posts: 5
Threads: 1
Joined: Aug 2013
Reputation: 0
#5
RE: Script for traumatic/fear visual effects

Thanks again guys. Ok, so this is what I have, please let me know if I've done this right:

void OnStart ()
{
    AddEntityCollideCallback("player", "Area1", "CollideArea1", true, 1)
}

void CollideArea1
{
    void GiveSanityDamage(float 1, true)
}

I'm not sure if I'm supposed to leave "float" in there, or if "1" is the right variable format to set the sanity damage.
(This post was last modified: 08-28-2013, 03:50 PM by JohnnyMedieval.)
08-28-2013, 03:49 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#6
RE: Script for traumatic/fear visual effects

(08-28-2013, 03:49 PM)JohnnyMedieval Wrote: Thanks again guys. Ok, so this is what I have, please let me know if I've done this right:

void OnStart ()
{
    AddEntityCollideCallback("player", "Area1", "CollideArea1", true, 1)
}

void CollideArea1
{
    void GiveSanityDamage(float 1, true)
}

I'm not sure if I'm supposed to leave "float" in there, or if "1" is the right variable format to set the sanity damage.

void OnStart ()
{
    AddEntityCollideCallback("player", "Area1", "CollideArea1", true, 1);
}

void CollideArea1 (string &in asParent, string &in asChild, int alState)

{
GiveSanityDamage(1, true);
}

This is the right code. By tunnel, I think you mean the Field Of View:

FadePlayerFOVMulTo(float afX, float afSpeed);

Changes the field of view of the player. A shorter FOV will create a zoom effect.

afX - multiplier of default FOV (1 is default)
afSpeed - the speed of change between FOV's

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
08-28-2013, 03:55 PM
Find
JohnnyMedieval Offline
Junior Member

Posts: 5
Threads: 1
Joined: Aug 2013
Reputation: 0
#7
RE: Script for traumatic/fear visual effects

Thanks, yeah I got an error when I tried it the first way.

I just changed it to your code, but the area didn't trigger any visual effects.
This is what I have now:
void OnStart ()
{
    AddEntityCollideCallback("player", "ScriptArea_1", "CollideArea1", true, 1);
}

void CollideArea1(string &in asParent, string &in asChild, int alState)

{
    FadePlayerFOVMulTo(3, 2);

    GiveSanityDamage(5.0f, true);
}
I tried remaking the area too, and used the default name in the editor and in the script. It's still not working and I have no idea what I'm doing wrong.
Sorry, like I said, I know nothing about scripting.
If someone could tell me what to fix I appreciate it, thanks.
(This post was last modified: 08-28-2013, 04:35 PM by JohnnyMedieval.)
08-28-2013, 04:04 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#8
RE: Script for traumatic/fear visual effects

I think "player" must be capitalized.

Trying is the first step to success.
08-28-2013, 04:34 PM
Find
JohnnyMedieval Offline
Junior Member

Posts: 5
Threads: 1
Joined: Aug 2013
Reputation: 0
#9
RE: Script for traumatic/fear visual effects

(08-28-2013, 04:34 PM)FlawlessHair Wrote: I think "player" must be capitalized.

lol, that did it, now it's working. Thanks alot!

I can stop bugging you guys with my noob questions now Smile thanks for all the help everyone.
08-28-2013, 04:37 PM
Find




Users browsing this thread: 1 Guest(s)