Frictional Games Forum (read-only)
Nkmols' question - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Nkmols' question (/thread-6676.html)

Pages: 1 2 3


Nkmols' question - nkmol - 02-21-2011

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.


RE: Forge to look at object script - Mofo - 02-21-2011

Quote:StartPlayerLookAt("ritual_prisoner_1", 2, 2, "");

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

Put this inside the onEnter instead of the onStart.


RE: Forge to look at object script - nkmol - 02-21-2011

(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?


RE: Forge to look at object script - Tanshaydar - 02-21-2011

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");
}



RE: Forge to look at object script - nkmol - 02-21-2011

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);




RE: Forge to look at object script - nkmol - 02-21-2011

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?


RE: Forge to look at object script - Pandemoneus - 02-21-2011

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.


RE: Forge to look at object script - Ongka - 02-21-2011

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.


RE: Forge to look at object script - nkmol - 02-21-2011

@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


RE: Forge to look at object script - nkmol - 02-22-2011

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]