Frictional Games Forum (read-only)
SetEntityPlayerLookAtCallback HUGE PROBLEM! - 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: SetEntityPlayerLookAtCallback HUGE PROBLEM! (/thread-18951.html)



SetEntityPlayerLookAtCallback HUGE PROBLEM! - lllDash - 10-27-2012

Let me cut to the chase. This is what I did


void OnEnter()
{
SetEntityPlayerLookAtCallback("ritual_prisoner_1", "bodysound", true);
}

void bodysound(string &in asEntity, int alState)
{
SetEntityActive("ritual_prisoner_1", false);
PlaySoundAtEntity("", "scare_male_terrified5.snt", "ScriptArea_26", 0, false);
}



Nothing happens. I did a search on google for: "SetEntityPlayerLookAtCallback" And I found many post on this same problem: Nothing happens.

Does SetEntityPlayerLookAtCallback even work? Or is it a just dud? Am I doing anything wrong? Help would be appreciated


RE: SetEntityPlayerLookAtCallback HUGE PROBLEM! - Unearthlybrutal - 10-27-2012

This should work Smile

void OnEnter()

{
SetEntityPlayerLookAtCallback("ritual_prisoner_1", "bodysound", true);
}

void bodysound(string &in asEntity, int alState)
{

if(alState == 1)
{

SetEntityActive("ritual_prisoner_1", false);
PlaySoundAtEntity("", "scare_male_terrified5.snt", "ScriptArea_26", 0, false);
}

}


RE: SetEntityPlayerLookAtCallback HUGE PROBLEM! - lllDash - 10-27-2012

(10-27-2012, 11:52 AM)Unearthlybrutal Wrote: This should work Smile

void OnEnter()

{
SetEntityPlayerLookAtCallback("ritual_prisoner_1", "bodysound", true);
}

void bodysound(string &in asEntity, int alState)
{

if(alState == 1)
{

SetEntityActive("ritual_prisoner_1", false);
PlaySoundAtEntity("", "scare_male_terrified5.snt", "ScriptArea_26", 0, false);
}

}
(FacePalm) Oh, thanks. I'm an idiot Rolleyes . But it still didn't work! However I eventually did get it to work. Looking at ritual_prisoner_1 does nothing, but looking at a scriptarea does. Dodgy Why is it even called SetEntityPlayerLookAtCallback if it doesn't even work with entities?!

Although I'm still soooooo angry that this problem had wasted so much of my time, I am still grateful for your help. thanx


RE: SetEntityPlayerLookAtCallback HUGE PROBLEM! - FlawlessHappiness - 10-27-2012

I guess the scripts area has something that the prisoner doesn't have... Like when grunts doesn't have bodies...

Though, just cover the prisoner in a script area. Also remember that the callback only triggers if the CROSSHAIR is on the area. Therefor the player can still see the prisoner, but without triggering the event, except if you make the area big enough so that the prisoner is only just inside the screen, when the crosshair touches the area


RE: SetEntityPlayerLookAtCallback HUGE PROBLEM! - lllDash - 10-27-2012

Yea, took me a while to get the size of the area right.


RE: SetEntityPlayerLookAtCallback HUGE PROBLEM! - FlawlessHappiness - 10-27-2012

(10-27-2012, 09:42 PM)lllDash Wrote: Yea, took me a while to get the size of the area right.
But when you got it, it's goooold!


RE: SetEntityPlayerLookAtCallback HUGE PROBLEM! - The chaser - 10-27-2012

(10-27-2012, 01:22 PM)beecake Wrote: I guess the scripts area has something that the prisoner doesn't have... Like when grunts doesn't have bodies...
The script area has a center, while the prisoner doesn't have it. When you choose an area, you click the name, right? The prisoner doesn't have anything special, while the area was especifically designed to be that way.


RE: SetEntityPlayerLookAtCallback HUGE PROBLEM! - Ongka - 10-27-2012

(10-27-2012, 10:19 PM)The chaser Wrote:
(10-27-2012, 01:22 PM)beecake Wrote: I guess the scripts area has something that the prisoner doesn't have... Like when grunts doesn't have bodies...
The script area has a center, while the prisoner doesn't have it. When you choose an area, you click the name, right? The prisoner doesn't have anything special, while the area was especifically designed to be that way.
Actually, every entity has a center. That's where the arrows in the level editor are placed.


RE: SetEntityPlayerLookAtCallback HUGE PROBLEM! - The chaser - 10-27-2012

(10-27-2012, 11:36 PM)Ongka Wrote:
(10-27-2012, 10:19 PM)The chaser Wrote:
(10-27-2012, 01:22 PM)beecake Wrote: I guess the scripts area has something that the prisoner doesn't have... Like when grunts doesn't have bodies...
The script area has a center, while the prisoner doesn't have it. When you choose an area, you click the name, right? The prisoner doesn't have anything special, while the area was especifically designed to be that way.
Actually, every entity has a center. That's where the arrows in the level editor are placed.
I meant that the engine turns mad when having to look at there. Areas were designed for that.