Frictional Games Forum (read-only)
Look At - 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: Look At (/thread-19210.html)



Look At - tonitoni1998 - 11-13-2012

i want to set an entity active, when the player looks at an area. i saw this http://www.frictionalgames.com/forum/thread-18368.html

but i didnt understand it. i always get fatal error.

my code now:

SetEntityPlayerLookAtCallback("area_lookat_1", true, 1);



void area_lookat_1(string &in asEntity, int alState)
{
SetEntityActive ("armour_nice_complete_4", true);
SetEntityActive ("armour_nice_complete_5", true);
SetEntityActive ("armour_nice_complete_6", true);
SetEntityActive ("armour_nice_complete_7", true);
SetEntityActive ("armour_nice_complete_8", true);
}


RE: Look At - FlawlessHappiness - 11-13-2012

You are close.

If you know basic scripting then you should know that a .hps file should have

void OnEnter()
{

}


void OnLeave()
{

}


void OnStart()
{

}

What you need now is to place the first line in void OnStart() and then add the rest of the script like this:

EDIT: I just realized you haven't specified what entity you want to look at. The script line is:


SetEntityPlayerLookAtCallback("ENTITY", "CALLBACK", "false/true")

void OnStart()
{
SetEntityPlayerLookAtCallback("area_lookat_1", "LookAtFunction", true);

}

void LookAtFunction(string &in asEntity, int alState)
{
if(alState == 1)
{
SetEntityActive ("armour_nice_complete_4", true);
SetEntityActive ("armour_nice_complete_5", true);
SetEntityActive ("armour_nice_complete_6", true);
SetEntityActive ("armour_nice_complete_7", true);
SetEntityActive ("armour_nice_complete_8", true);
}

}


I added a little but to the script, so it works better. What i did was saying, if > only when the player crosshair goes into the area > call the script
(Not when it goes outside)
This can always be useful later on Wink


RE: Look At - tonitoni1998 - 11-14-2012

sure i know that i need void on start enter leave etc. i just piceked up the needed lines for this thread Wink but thanks i will try it out