Frictional Games Forum (read-only)

Full Version: How to script Fainting?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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
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);
}