Frictional Games Forum (read-only)
Scripting Help with good idea - 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: Scripting Help with good idea (/thread-9693.html)

Pages: 1 2


Scripting Help with good idea - GreyFox - 08-10-2011

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


RE: Scripting Help with good idea - Khyrpa - 08-10-2011

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.


RE: Scripting Help with good idea - GreyFox - 08-10-2011

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


RE: Scripting Help with good idea - xiphirx - 08-10-2011

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.




RE: Scripting Help with good idea - GreyFox - 08-10-2011

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


RE: Scripting Help with good idea - xiphirx - 08-10-2011

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.


RE: Scripting Help with good idea - GreyFox - 08-10-2011

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


RE: Scripting Help with good idea - xiphirx - 08-10-2011

Okay then... its the same deal. Just apply the first look at callback to the chest.


RE: Scripting Help with good idea - GreyFox - 08-10-2011

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


RE: Scripting Help with good idea - xiphirx - 08-10-2011

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