Frictional Games Forum (read-only)
How to script Fainting? - 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: How to script Fainting? (/thread-19042.html)



How to script Fainting? - taylor122002 - 11-02-2012

Hello everyone!

I have a question for scripting. I'm making a custom story, and I set up the map so in one room, right when you open the door, you see a torso with some blood. And I want to make a script area so when you enter the script area, you collapse or faint for a moment.

I don't know how I would script this, could someone help me?
I don't know how to even begin the part of fainting when walking into a scripted area.


But, I tried anyways.
Here's what I did:

AddEntityCollideCallback("Player", "Faint", "Faint", true, 1);
void SetPlayerSanity(float afSanity);
{
SetPlayerSanity(0);
}
See, I don't even know where to begin. Lol

Originally, I had this before I set it to "void SetPlayerSanity...":

void Faint(string &in asParent, string &in asChild, int alState)
{
SetPlayerSanity(0);
}

and that did nothing.

I apologize if this didn't make sense.


RE: How to script Fainting? - FlawlessHappiness - 11-02-2012

Look what fricitonal games did.
What i would use is:

FadePlayerRollTo(float afX, float afSpeedMul, float afMaxSpeed);
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(bool abCrouch);

SetPlayerActive(bool abActive);

FadeImageTrailTo(float afAmount, float afSpeed);
Applies the image trail effect to the screen.
afAmount - intensity (default: 0)
afSpeed - time in seconds until full effect



FadeRadialBlurTo(float afSize, float afSpeed);
Applies radial blur effects to the screen.
afSize - intensity (default: 0)
afSpeed - time in seconds until full effect


RE: How to script Fainting? - naseem142 - 11-02-2012

For a newbie i would i use this simple script :p
When the player collides with the "Faint" Script area he will get a 5 sanity damage ( you can edit it as much as you want til 100 )



void OnStart()
{
AddEntityCollideCallback("Player", "Faint", "Faint", true, 1);
}

void Faint(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(5.0f, true);
}