Frictional Games Forum (read-only)

Full Version: Callback for when you look at a specific place
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Callback for when you look at a specific place. What script function would you use for it?
void SetEntityPlayerLookAtCallback(string& asName, string& asCallback, bool abRemoveWhenLookedAt);

Calls a function when the player looks at a certain entity.
Callback syntax: void MyFunc(string &in asEntity, int alState)
alState: 1 = looking, -1 = not looking

asName - internal name
asCallback - function to call
abRemoveWhenLookedAt - determines whether the callback should be removed when the player looked at the entity
There is also an option on all of the entities:

"PlayerLookAtCallback"
Put whatever you want in there.

Syntax for the lookat function:

void FuncName(string &in asEntity, int alState)
{
}

- I edit because there was misunderstanding, the (funcname) was just a placement Tongue
(08-21-2011, 10:38 PM)Juby Wrote: [ -> ]There is also an option on all of the entities:

"PlayerLookAtCallback"
Put whatever you want in there.

Syntax for the lookat function:

void LookAt(funcname)(string &in asEntity, int alState)
{
}

I dont think the Function name goes in "()" so use this I guess:
void LookAt YourFuncName(string &in asEntity, int alState)
As Obliviator Stated it would be

SetEntityPlayerLookAtCallback(string& asName, string& asCallback, bool abRemoveWhenLookedAt);

not PlayerLookAtCallback (That Forces a Player to look somewhere)

-Grey Fox