03-14-2012, 02:15 PM
I dont want the grunt to move away until I look at him. This is what Frictional Games say about this callback:
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
So, what I did was this:
This means that when I look at "Entity" the script calls "Function" and then removes the callback, right?
Now here's the function:
Doesnt work. My error message: Expected Data Type (pointed at the ,1 in void Funtion)
So I figured, ok, I need to declare data type as Integer:
Nope. THen I got the error "Expected ) or ," pointing right after the "int". So I added a ,
After which I get the data error again.
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
So, what I did was this:
Code:
void OnStart()
{
SetEntityPlayerLookAtCallback("Entity", "Function", true);
}
This means that when I look at "Entity" the script calls "Function" and then removes the callback, right?
Now here's the function:
Code:
void Function(string &in asEntity, 1)
{
AddEnemyPatrolNode("Entity","PathNodeArea_4",1,"idle");
AddEnemyPatrolNode("Entity","PathNodeArea_5",0,"idle");
}
Doesnt work. My error message: Expected Data Type (pointed at the ,1 in void Funtion)
So I figured, ok, I need to declare data type as Integer:
Code:
void Function(string &in asEntity,int 1)
Nope. THen I got the error "Expected ) or ," pointing right after the "int". So I added a ,
Code:
void Function(string &in asEntity,int, 1)
After which I get the data error again.