04-05-2011, 04:19 PM
04-05-2011, 04:26 PM
There should be a PlayerLookAtCallback for entities. For areas...
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 entity, 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
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 entity, 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
04-05-2011, 04:31 PM
(04-05-2011, 04:26 PM)Tanshaydar Wrote: [ -> ]There should be a PlayerLookAtCallback for entities. For areas...
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 entity, 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
I dont understand? Could you give me an example or is it something like:
void SetEntityPlayerLookAtCallback("AREA", "FUNCTION", true);
04-05-2011, 04:49 PM
Let's say your area is named "AreaScare". Let's call the Function "LookScare".
So, in your OnStart() function, you need what Tanshaydar posted above:
SetEntityPlayerLookAtCallback("AreaScare", "LookScare", true);
Then you would have your function later on in the code:
void LookScare(string &in asEntity, int alState)
{
//Whatever you want to happen goes here
}
You can use if statements to check the state by using:
if(alState==1)
{
//Whatever you want to happen goes here
}
-1 is also a valid number for alState.
So, in your OnStart() function, you need what Tanshaydar posted above:
SetEntityPlayerLookAtCallback("AreaScare", "LookScare", true);
Then you would have your function later on in the code:
void LookScare(string &in asEntity, int alState)
{
//Whatever you want to happen goes here
}
You can use if statements to check the state by using:
if(alState==1)
{
//Whatever you want to happen goes here
}
-1 is also a valid number for alState.
04-06-2011, 06:40 AM
I have a question, i have it so when my guy looks at a pig which is in the cabinet, he gets scared, but before my guy even opens the cabinet he gets scared from look at the pig. i dont get how to fix it so he gets scared by just looking at the pig, not the cabinet
04-06-2011, 12:06 PM
Hmm, that's strange. Game takes it as player actually sees the pig, where he does not.