Frictional Games Forum (read-only)
[SCRIPT] Screen effects won't stop - 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] Screen effects won't stop (/thread-29671.html)



Screen effects won't stop - Aletho - 02-27-2015

Hey guys!

Here's the thing: I have 2 maps. The first one ends with the player fainting and then loading the next map. In the first map, there's a lot of screen effects as you can see in the script below.
Now, the problem is that when the second map has loaded, it keeps the blurred slow-mo-ish screen effect. I can't seem to fix it no matter what I try, so I hope you know how to solve this.

Here's the script for map 1:
Spoiler below!

void OnStart()

{
// AddEntityCollideBacks
AddEntityCollideCallback("Player", "Felldown", "Teleport1", true, 1);
AddEntityCollideCallback("Player", "Faint", "Faint", true, 1);










FadeOut(0); // Instantly fades the screen out. (Good for starting the game)
FadeIn(20); // Amount of seconds the fade in takes
//FadeImageTrailTo(3, 1);
FadeSepiaColorTo(100, 4);
SetPlayerActive(false);
FadePlayerRollTo(65, 100, 100); // "Tilts" the players head
FadeRadialBlurTo(0.4, 1);

SetPlayerCrouching(true); // Simulates being on the ground
AddTimer("trig1", 11.0f, "beginStory"); // Change '11.0f' to however long you want the 'unconciousness' to last
}

void beginStory(string &in asTimer){
ChangePlayerStateToNormal();
SetPlayerActive(true);
FadeSepiaColorTo(0.5f, 0.5f);
FadeRadialBlurTo(0.7f, 0.5f);
FadePlayerRollTo(0, 1.7, 50); // Change all settings to defaults
FadeRadialBlurTo(0.0, 1);
FadeSepiaColorTo(0, 4);
SetPlayerCrouching(false);
FadeImageTrailTo(0,1);
SetPlayerMoveSpeedMul(0.2);
PlayMusic("29_amb_end_daniel", false, 3, 3, 10, true);
AddTimer("", 1.0f, "SkidtTekst");
}

void SkidtTekst(string &in asTimer)
{
SetMessage("Thoughts", "skidt", 5.0f);
}




void OnEnter()
{

}


void Faint(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("sound", "react_sigh1.snt", "Faint", 0.0, false);
FadePlayerRollTo(65, 100, 100); //Rotates the position of the camera on the player's body.
//afX - angle of rotation of head, positive being counter-clockwise
//afSpeedMul - speed (possibly acceleration) multiplier of the rotation (default 1, which is really slow)
//afMaxSpeed - maximum speed of rotation
SetPlayerCrouching(true);
SetPlayerActive(false);
FadeImageTrailTo(3, 1);
FadeOut(5.0f);
AddTimer("fadeout", 5.5f, "TimerChangeMap");
//Applies the image trail effect to the screen.
//afAmount - intensity (default: 0)
//afSpeed - time in seconds until full effect
FadeRadialBlurTo(0.4, 1);
//Applies radial blur effects to the screen.
//afSize - intensity (default: 0)
//afSpeed - time in seconds until full effect
}

void TimerChangeMap(string &in asTimer)
{
ChangeMap("Brobyggerne2.map", "PlayerStartArea_1", "", ""); //Changes the map
}

// Functions
void Teleport1(string &in asParent, string &in asChild, int alState)
{

}








void OnLeave()
{
}


//////////////////////
//Functions
void test_this(string &in asEntity, string &in type)
{

}


As you can see, FadeToImageTrail, FadeIn/Out, SepiaColor and RadialBlur are the screen effects in use.
The commands i've tried so far without luck are:
FadeRadialBlurTo(0, 0);
FadeImageTrailTo(0, 0);
ChangePlayerStateToNormal();

Again, I hope you know how to fix it!
Thanks in advance,
Alex


RE: Screen effects won't stop - Darkfire - 02-27-2015

Well, as far as I can see you turn effects on, turn them off and then on again, so what's the problem ? You just have to turn them off again o_O
Btw, you sure that 0.0f AREN'T the deafult settings ?


RE: Screen effects won't stop - Neelke - 02-27-2015

I think you can reset the effects when leaving map instead. I did that in one of my maps and it worked just fine.

Code:
void OnLeave()
{
    FadeRadialBlurTo(0, 0);
    FadeImageTrailTo(0, 0);
    ChangePlayerStateToNormal();
}



RE: Screen effects won't stop - Aletho - 02-28-2015

(02-27-2015, 10:36 PM)Neelke Wrote: I think you can reset the effects when leaving map instead. I did that in one of my maps and it worked just fine.

Code:
void OnLeave()
{
    FadeRadialBlurTo(0, 0);
    FadeImageTrailTo(0, 0);
    ChangePlayerStateToNormal();
}

That's exactly the code I had in my "void OnStart()" in the following map, but it wouldn't turn it off. I can try again with using it in the "void OnLeave()" and post the results :-)


RE: Screen effects won't stop - FlawlessHappiness - 03-01-2015

It's very simple!

Copied from the engine scripts:
https://wiki.frictionalgames.com/doku.php?id=hpl2/amnesia/script_functions
Quote:FadeRadialBlurTo(float afSize, float afSpeed);
Applies radial blur effects to the screen.

afSize - intensity (default: 0)
afSpeed - time in seconds until full effect

Notice the second one is called speed?
If you set speed to 0, would anything every change?
You have to make speed more than 0.


RE: Screen effects won't stop - Mudbill - 03-01-2015

Well, I mean, it IS "time in seconds." Using 0 should theoretically make the effect fully enable over the course of 0 seconds, EG instantly. If this is not the actual case, that should be fixed.


RE: Screen effects won't stop - Aletho - 03-01-2015

(03-01-2015, 01:29 PM)FlawlessHappiness Wrote: It's very simple!

Copied from the engine scripts:
https://wiki.frictionalgames.com/doku.php?id=hpl2/amnesia/script_functions
Quote:FadeRadialBlurTo(float afSize, float afSpeed);
Applies radial blur effects to the screen.

afSize - intensity (default: 0)
afSpeed - time in seconds until full effect

Notice the second one is called speed?
If you set speed to 0, would anything every change?
You have to make speed more than 0.

Nothing seems to be working. This is what I have in the void OnStart in the second map:
FadeRadialBlurTo(0, 1);
FadeImageTrailTo(0, 0);
SetPlayerCrouching(false);
ChangePlayerStateToNormal();
StopPlayerLookAt();
SetPlayerMoveSpeedMul(1);
SetPlayerSanity(100);


RE: Screen effects won't stop - Mudbill - 03-01-2015

Are you sure your second map's hps file is properly loaded? Do you have other scripts in there that do work?


RE: Screen effects won't stop - Aletho - 03-01-2015

(03-01-2015, 04:51 PM)Mudbill Wrote: Are you sure your second map's hps file is properly loaded? Do you have other scripts in there that do work?

I have a lot of scripts in the second map's hps file, all of them work.
I've just decided to completely remove all the "FadeImageTrailTo" scripts in the first map and that worked.


RE: Screen effects won't stop - Darkfire - 03-01-2015

You shure that you executed that script ? I dunno put smth like SetEntityActive in there to make sure it is called at all