Frictional Games Forum (read-only)

Full Version: Scripting Player reaction
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to script my custom story so that when the Player reads the first note, a body appears before them, along with a little jerking of the camera so it feels as if the character is jarred and frightened by this sight.

I believe I know how to do the second part, it is scripting the body to appear after reading the note. I know this is probably really simple but I've tried several kinds of callback functions and none of them work properly.

Any ideas?
void OnStart()
{
SetEntityPlayerInteractCallback("", "FUNC", true);
}

void FUNC(string &in asEntity)
{
SetEntityActive("NAMEOFBODY", true);

*put the screen shaking script here*
}


Go to the note you've placed. Press the Entity tab>PlayerInteractCallback.
and write FUNC (or whatever you've replaced FUNC with)
goodcap ninja'd me :p oh well, I'll leave my post here :3

SetEntityPlayerInteractCallback(); is what I believe you'll want. Don't know if you'll need to use an if-then-else conditional, but something like this should work:

PHP Code:
void KeyPickup(string &in asEntity)
{
    if(
asType == "OnPickup")
    {
    
SetEntityActive("Body"true);
    
//Player Reaction Scripting
    
}


If the body pops up "too" instantly, add a timer that triggers your script about 0.08f after picking up the note. Do so by scripting an AddTimer inside the if's {} code block, then script the sequence in the void <Timer> code block. Smile
And I thought I'll never see Screaming Naked Guys again.