Frictional Games Forum (read-only)
Jump scare script problem - 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: Jump scare script problem (/thread-17005.html)



Jump scare script problem - liamthespy - 07-16-2012

this is the relevant part of the script


AddEntityCollideCallback("Player", "firstscare", "closetcorpse", true, 1);
}

void closetcorpse(string &in item)
{
SetEntityActive("closetcorpse", true);
PlaySoundAtEntity("", "guardian_activated.snt", "closetcorpse", 0, false);
}

the player walks into the firstscare scriptarea and the closetcorpse activates, or at least that's what is supposed to happen. I have everything punctuated right, what is wrong?


RE: Jump scare script problem - Ongka - 07-16-2012

void closetcorpse(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("closetcorpse", true);
PlaySoundAtEntity("", "guardian_activated.snt", "closetcorpse", 0, false);
}

It should be like this


RE: Jump scare script problem - liamthespy - 07-16-2012

oh, I see! thanks mate! one more question if you please,

SetEntityPlayerInteractCallback("firstkey", "keyfunc", true);




void keyfunc(string &in asItem, string &in asEntity)
{
SetSwingDoorClosed("prison_1", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}

this doesn't seem to work, either.


RE: Jump scare script problem - Ongka - 07-16-2012

You want a key to unlock a door, right?
Code:
void OnStart()
{
AddUseItemCallback("UnlockDoor", "firstkey", "prison_1","UseKeyOnDoor", true);
}

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("prison_1", false, false);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
This way you can use the key on the door and it will open.


RE: Jump scare script problem - liamthespy - 07-16-2012

nope, I want a door to slam when the key is picked up. the key is for a different door than the one mentioned in the code.


RE: Jump scare script problem - Ongka - 07-16-2012

Code:
void OnStart()
{
SetEntityCallbackFunc("firstkey", "keyfunc");
}

void keyfunc(string &in asEntity, string &in type)
{
SetSwingDoorClosed("prison_1", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
This should do the job.
I'm not sure if you can close the door with this function, tell me if it's not working.


RE: Jump scare script problem - liamthespy - 07-16-2012

yeah that worked Big Grin thanks a ton man!

one final question, for the original script, how could I get the corpse to disappear after just a second or two?


RE: Jump scare script problem - Ongka - 07-16-2012

Here you go!
Code:
void closetcorpse(string &in item)
{
SetEntityActive("closetcorpse", true);
PlaySoundAtEntity("", "guardian_activated.snt", "closetcorpse", 0, false);
AddTimer("DisableCorpse", 2.5f, "TimerDisableCorpse");    //2.5f defines how long it takes to disappear
}

void TimerDisableCorpse(string &in asTimer)
{    
    SetEntityActive("closetcorpse", false);
}
Have fun Big Grin


RE: Jump scare script problem - liamthespy - 07-16-2012

thanks a ton mate! you've done me a great deal of good here


RE: Jump scare script problem - Ongka - 07-16-2012

No problem!
If you still have some questions feel free to ask Wink