Frictional Games Forum (read-only)

Full Version: Scripting Help with good idea
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
hey Guys. I got a good Idea with my custom story but I don't know if it's possible or how to do it.

I got the idea from the Mod "Nightmare House 2", theres a part where this door is locked so you turn around and a girl is standing right there and then she disappears and the door unlocks.

I want to do something similar with Alexander (SPOILER ALERT)




Since He's a ghost. I have a distraction in the room to hopefully make the person stare at what not until he appears and then when you look at him make him disappear really quickly (Jump Scare?)

I Just don't know how to do this in the script

Any Help Appreciated Hopefully this is Possible

-Grey Fox
Sure is possible! I'm not gonna give full script, but just some functions what to use.

Just use AddEntityCollideCallback to start the event when the player is past the point where alexander spawns spawning alexander behind him. Then just use SetEntityPlayerLookAtCallback to check when player looks behind him (I suggest using an area) and use a timer to time the fade out of alexander.

I'm not sure if you can use SetPropActiveAndFade to fade him out smoothly or should you just use some particle effects.
Okay i'm Completely lost on how to use the SetEntityPlayerLookAtCallback Syntax Function

this is what I have so far.

void OnStart()
{
SetEntityPlayerLookAtCallback("Alexander1", "Alexander1", true);
}

void Alexander1(string &in asEntity, int alState)
{
What Do I Put Here!?? I'm So Confused hhaa
}

I have the trigger for him Activating behind perfect.

Thank you

-Grey Fox
You would activate the ghost alexander entity and add a look at callback for the alexander entity. For the alexander entity's look at callback, just deactivate.

Uhh Xiphirx? I'm Sorry But you confused me? Lol could you possibly type it and elabrate a little? Or anyone? Is my script so far correct?

Thank you
-Grey Fox
Your script is a little wrong.

First, you want to have a look at callback (SetEntityPlayerLookAtCallback()) on the door you want to trigger the event.

The callback function associated with the door should activate the alexander entity you have (behind the player) and add a look at callback (SetEntityPlayerLookAtCallback()) to alexander.

The callback function associated with alexander should just simply deactivate alexander.
Ohh!, xiphirx I think i got you confused. that thing with the door was just with that mod,(Nightmare house)

I'll give you my setup.

I have a trigger, when you walk past the trigger it activates Alexander. (Theres a chest that I the player will open and grab the thing inside hopefully) When the play turns around I want Alexander to be floating there for a split second (or whatever) and disappear/Deactivate.

I've tried serveral other things but all seem to fail (Not giving me the correct idea I had, IE I turned around and he just sat there.....)

Thank you
-Grey Fox
Okay then... its the same deal. Just apply the first look at callback to the chest.
Okay I tried it, it didn't work. so I did it another way so when you open the chest Alexander Spawns. But whenever I look at him he doesn't disappear.

Don't Know what else to do.

I have

Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
SetEntityPlayerInteractCallback("chest_small_1", "CollideActivateAlex", true);
SetEntityPlayerLookAtCallback("alexander_1", "Alexander1", false);
}

void CollideActivateAlex(string &in Entity)
{
    SetEntityActive("alexander_1", true);
}

void Alexander1(string &in asEntity, int alState)
{
    SetEntityActive("alexander_1", false);
}


Thank you and Sorry For Not Understanding

-Grey Fox
try


Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
SetEntityPlayerInteractCallback("chest_small_1", "CollideActivateAlex", true);
}

void CollideActivateAlex(string &in Entity)
{
    SetEntityActive("alexander_1", true);
    SetEntityPlayerLookAtCallback("alexander_1", "Alexander1", false);
}

void Alexander1(string &in asEntity, int alState)
{
    SetEntityActive("alexander_1", false);
}
Pages: 1 2