Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
LookAtCallback
tonitoni1998 Offline
Member

Posts: 163
Threads: 54
Joined: Oct 2012
Reputation: 1
#1
LookAtCallback

actually thought i know how its working, but i always get an error
(" expected "," or ")" ") i dont knw how to solve. i have this
SetEntityPlayerLookAtCallback("diary_look_at", "SetMessage2", false);

void SetMessage2(string &in "diary_1", int 1)
{
   SetMessage("map1_messages", "DiaryInfo", 3);
}

it always tells me there should be "," or" ")" before "diary_1". but when i do that the data type is missing.

thanks for helping

When you are looking for someone, to do the scripting for your Custom Story, ask me!
02-14-2013, 03:55 PM
Find
MulleDK19 Offline
Senior Member

Posts: 545
Threads: 21
Joined: Jun 2009
Reputation: 10
#2
RE: LookAtCallback

(02-14-2013, 03:55 PM)tonitoni1998 Wrote: actually thought i know how its working, but i always get an error
(" expected "," or ")" ") i dont knw how to solve. i have this
SetEntityPlayerLookAtCallback("diary_look_at", "SetMessage2", false);

void SetMessage2(string &in "diary_1", int 1)
{
   SetMessage("map1_messages", "DiaryInfo", 3);
}

it always tells me there should be "," or" ")" before "diary_1". but when i do that the data type is missing.

thanks for helping

PHP Code: (Select All)
void SetMessage2(string &in "diary_1"int 1)
{
   
SetMessage("map1_messages""DiaryInfo"3);


That makes absolutely no sense.

It should be something like:
PHP Code: (Select All)
SetEntityPlayerLookAtCallback("diary1""SetMessage2"false);

void SetMessage2(string &in asEntityint alState)
{
   
SetMessage("map1_messages""DiaryInfo"3);


[Image: 16455.png]
02-14-2013, 03:56 PM
Find
tonitoni1998 Offline
Member

Posts: 163
Threads: 54
Joined: Oct 2012
Reputation: 1
#3
RE: LookAtCallback

it is working, thanks!

but how does the game know, what state (int alState) it is? its not given anywhere.

When you are looking for someone, to do the scripting for your Custom Story, ask me!
02-14-2013, 03:59 PM
Find
MulleDK19 Offline
Senior Member

Posts: 545
Threads: 21
Joined: Jun 2009
Reputation: 10
#4
RE: LookAtCallback

(02-14-2013, 03:59 PM)tonitoni1998 Wrote: it is working, thanks!

but how does the game know, what state (int alState) it is? its not given anywhere.

Doesn't matter. The callback will check for both looking at, and not looking at, and pass 1 or -1 respectively to your callback function.

[Image: 16455.png]
02-14-2013, 04:00 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#5
RE: LookAtCallback

If you put it like you did it, it will happen like if you wrote 0 = It will happen both when you look at it, and when you move the cursor out of the object.

To do it, only when you look at it, you put an if-statement inside the callback like this:

if(alState == 1)
{
//Do stuff
}

this way the game is asking: If the player looks onto the object //Do stuff, otherwise do what you wrote outside the if-statement

Trying is the first step to success.
02-14-2013, 04:03 PM
Find




Users browsing this thread: 1 Guest(s)