Frictional Games Forum (read-only)

Full Version: "Scarry Area"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
please i wanna set area whitch will makes my player SCARED using Sounds like his scream and some scary sounds and vision kolapses
I think an insanity-area will solve your problem. You can find it in the level editor in the area category.

This area is permanent active or inactive, until you use a script function to activate it for a special event and deactivate it afterwards.

Hope this will help you.
Greetings
Dr4konite
okey now how to write it in SCRIPT so it will triger when i enter that area?
By default it should be set to active when placing it in the map editor. So it will be automaticaly triggered when the player enters that area. Note that wether the player get insanity visions or not depends on how good his sanity is.

When you deactivate the area in the map editor because you want to activate it later ingame bound to an event you can use the "SetEntityActive" function paired with a "CollideCallback". It may look like this:

Spoiler below!
Code:
//Collide Callback
void onStart()
{
AddEntityCollideCallback("Player", "TriggerArea", "ActivateInsanity", true, 1);    
}

//Area function:
void ActivateInsanity(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("InsanityArea", true);
}


If you want to deactivate this area after a period of time or after an event just call the "SetEntityActive" function again, but set the second parameter to false.

This may look like this:
Spoiler below!
Code:
//Area function:
void ActivateInsanity(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("InsanityArea", true);
AddTimer("DeInsanity", 10.0f, "TimerDeactivateInanity");
//In this example I use the timer function that will call the deactivate function after 10 seconds.
}

//Timer function:
void TimerDeactivateInsanity(string &in asTimer)
{
SetEntityActive("InsanityArea", false);
}


If you want to add sanity damage to make sure the player will get insanity visions you can additionally type:
Spoiler below!
Code:
GiveSanityDamage(*VALUE BETWEEN 0-100*, true);
//EXAMPLE:
GiveSanityDamage(50, true);

The value will determines how much sanity the player will lose (type it without **). Additionally you can choose if there will be an effect or not by setting the second parameter to true (effect) or false (no effect).

Greetings
Dr4konite
Okey Sanity Area wont work but i need that player will scream and his vision will shake when he enter area i choosed so gimme PLEASE scrit for it
The functions for these kinds of effects are:

1. PlaySoundAtEntity
EXAMPLE:
PlaySoundAtEntity("", "05_event_door_bang.ogg", "Player", 0, false);

The first parameter will name your sound function (needed when you want to deactivate the sound later, but can be empty if it is not looped).
The second is the sound which is meant to be played.
The third is the entity the sound will be played at (in this case it's the player).
The fourth is the fading time (e.g. if you want to fade in).
The fifth defines if the sound should be save (looped).

2. StartScreenShake
EXAMPLE:
StartScreenShake(0.1, 4.7, 0.05, 0.5);

The first will set the amount the screen is shaking.
The second will set the lengh the screen is actually shaking.
The third and fourth define the fadeIN and fadeOUT times.

Trigger this with a CollideCallback and you will be fine.
Try this for yourself - I gave you all you need in my answers.

Greetings
Dr4konite
(10-30-2010, 04:31 PM)Dr4konite Wrote: [ -> ]The functions for these kinds of effects are:

1. PlaySoundAtEntity
EXAMPLE:
PlaySoundAtEntity("", "05_event_door_bang.ogg", "Player", 0, false);

The first parameter will name your sound function (needed when you want to deactivate the sound later, but can be empty if it is not looped).
The second is the sound which is meant to be played.
The third is the entity the sound will be played at (in this case it's the player).
The fourth is the fading time (e.g. if you want to fade in).
The fifth defines if the sound should be save (looped).

2. StartScreenShake
EXAMPLE:
StartScreenShake(0.1, 4.7, 0.05, 0.5);

The first will set the amount the screen is shaking.
The second will set the lengh the screen is actually shaking.
The third and fourth define the fadeIN and fadeOUT times.

Trigger this with a CollideCallback and you will be fine.
Try this for yourself - I gave you all you need in my answers.

Greetings
Dr4konite
okey now how to put it in one ? so when player enter area it will play that sound and shake camera
Check this tutorial. And don't just ask people to give you ready script.
Figure out how functions work, or ask how they work, if you can't figure it out. And read that tutorial.
I LOLed at how Exit types. To be honest, I think he is a little too young to be scripting all together. Well, I can't really say that for myself, I'm only 13. The only exception is that I know how to script.
(11-04-2010, 12:29 AM)Kyle Wrote: [ -> ]I LOLed at how Exit types. To be honest, I think he is a little too young to be scripting all together. Well, I can't really say that for myself, I'm only 13. The only exception is that I know how to script.

Age doesn't have anything to do with knowing how to script or not.
I'm 18 and I never did a single script in my life.
Pages: 1 2