Frictional Games Forum (read-only)

Full Version: Nkmols' question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
my script doesnt work :S instead of an area could it be an object to, like a corpse?

script :

void Onstart()
{
StartPlayerLookAt("ritual_prisoner_1", 2, 2, "");

AddTimer("Donelook", 2.5f, "TimerDoneLookAt");
}

void TimerDoneLookAt(string &in asTimer)
{
StopPlayerLookAt();
}

but when i start the game, the player doesnt look. and i was wondering if i didnt need area to active this script? like if i'm at x position StartPlayerLookAt is true.
Quote:StartPlayerLookAt("ritual_prisoner_1", 2, 2, "");

AddTimer("Donelook", 2.5f, "TimerDoneLookAt");

Put this inside the onEnter instead of the onStart.
(02-21-2011, 07:31 PM)Mofo Wrote: [ -> ]
Quote:StartPlayerLookAt("ritual_prisoner_1", 2, 2, "");

AddTimer("Donelook", 2.5f, "TimerDoneLookAt");

Put this inside the onEnter instead of the onStart.
thanks it works now Big Grin
but could i improve it, when i'm in an area the script will be activated?
You have to add a collide back.
Like, you need to make a script area, then add a code, like this:
Code:
void OnStart()
{
     AddEntityCollideCallback("Player", "ScriptArea_6", "TeleportToNormal1", true, 1);
}

void TeleportToNormal1(string &in asParent, string &in asChild, int alState)
{
    StartPlayerLookAt("ScriptArea_14", 100, 100, "");
    AddTimer("LookStopper", 0.1f, "StopLookAt");
    TeleportPlayer("PlayerStartArea_3");
}
it worked Big Grin

maybe to improve it a lil bit more, is it possible to zoom in, like a shock effect?
ill look to play the shock sound of daniel by myself and reduce sanity


edited : got it worked now Big Grin i added the slow walking/looking and running to Big Grin it feels good that i found out some thing by my self, lol. really thanks for helping Big Grin code so far :
PHP Code:
void Onstart()
{

}

void OnEnter()
{
AddEntityCollideCallback("Player""InsanityArea_1""AreaLookAt"true1);    
}

void AreaLookAt(string &in asParentstring &in asChildint alState)
{
    
StartPlayerLookAt("ritual_prisoner_1"22"");
    
AddTimer("Donelook"2.5f"TimerDoneLookAt"); 
    
PlaySoundAtEntity("player_shock""react_scare""Player"0false);
    
GiveSanityDamage(50true);
    
SetPlayerMoveSpeedMul(0.4f);
    
SetPlayerRunSpeedMul(0.4f);
    
SetPlayerLookSpeedMul(0.4f);
}

void TimerDoneLookAt(string &in asTimer)
{
    
StopPlayerLookAt();
    
SetPlayerMoveSpeedMul(1.0f);
    
SetPlayerRunSpeedMul(1.0f);
    
SetPlayerLookSpeedMul(1.0f);

I know this is off-topic, but i keep getting question :p i where wondering how to play the scary noises? Like footsteps, flashback sound and closing doors etc. Because im not sure if it is a .snt or .ogg file :p and how to play 2 sounds after each other in 1 callback?
Stuff doesn't work when you put it into void Onstart() because it is case-sensitive. It has to be OnStart() if you want anything to work in there.
I'll take your script:
Code:
void OnEnter()
{
AddEntityCollideCallback("Player", "InsanityArea_1", "AreaLookAt", true, 1);    
}

void AreaLookAt(string &in asParent, string &in asChild, int alState)
{
    PlaySoundAtEntity("sound", "insanity_baby_cry", "AreaSound", 0, false); //AreaSound is where you want the sound to be played
    AddTimer("Donelook", 2.5f, "TimerDoneLookAt");
}

void TimerDoneLookAt(string &in asTimer)
{
    PlaySoundAtEntity("sound", "scare_slam_door", "castle_1", 0, false); //castle_1 is the name of the door
}

Just an example.
@Pando thanks for seeing such a little mistake Smile

@Ongka but where did you got the name (insanity_baby_cry) of the audio file from? And why no insanity_baby_cry.snt? :p
found them already Tongue
1. but i can't find the insanity effects in the Debug Toolbar (when i touch F1 in-game). i know it's, like Steps_SlimeyRun01, made of different chronologic sounds and different volume of sound. But i doubt i can make by my self such thing xD so i where wondering where that insanity sound pack is?

2. how could i play multiple sounds after each other? like first playing sound 1, after 1,7sec play sound 2. probably has to do whith timers, but don't exacly know how they work :S

sorry i ask so much Blush if you don't understand my question please reply

here picture of the insanity effect in the Debug Toolbar
[Image: 88734349.png]
Pages: 1 2 3