Frictional Games Forum (read-only)
PlayerLookAtEntiy error? - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: PlayerLookAtEntiy error? (/thread-7959.html)



PlayerLookAtEntiy error? - X4anco - 05-12-2011

Hellos people N00B here:
Code:
SetEntityPlayerLookAtCallback("sofa_2", "scare1", true);
Code:
void scare1(string &in entity, int alState)
{
    PlayGuiSound("react/react_scare6.ogg", 1);
    GiveSanityDamage(20, true);
}

I'm trying to make the player react when he looks at something
but nothing happens Sad

Thx


RE: PlayerLookAtEntiy error? - Khyrpa - 05-12-2011

I don't know exactly how to use the callback from the LookAt function, but you create:
SetEntityPlayerLookAtCallback(string& asName, string& asCallback, bool abRemoveWhenLookedAt);
at the same time as the LookAt is triggered.


RE: PlayerLookAtEntiy error? - Acies - 05-12-2011

void scare1(string &in entity, int alState)
{
if(alState == -1) AddDebugMessage("DebugMessage", false);
else if (alState == 1)
{
PlayGuiSound("react/react_scare6.ogg", 1);
GiveSanityDamage(20, true);
return;
}
}

alstate = -1 not looking
alstate = 1 looking