Frictional Games Forum (read-only)

Full Version: SetEntityPlayerLookAtCallback HUGE PROBLEM!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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);
}

}
(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
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
Yea, took me a while to get the size of the area right.
(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!
(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.
(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.
(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.