Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved SetEntityPlayerLookAtCallback Problem
Author Message
MrCookieh Offline
Member

Posts: 157
Joined: Jul 2011
Reputation: 0
Post: #1
SetEntityPlayerLookAtCallback Problem
Hello guys!

Here's my problem:
If you look at an arm, lying in the drawer, the SetEntityPlayerLookAtCallback should trigger.
Now you can't see the arm (because it's in the drawer, which is closed), but the function gets called, and triggers my actions.

Is there any way to only run the function, if I really can SEE the arm, and
not looking at the point where the arm is (Doesn't matter if you see it or not)?
(This post was last modified: 07-07-2011 04:20 PM by MrCookieh.)
07-06-2011 10:45 PM
Find all posts by this user Quote this message in a reply
Apjjm Offline
Super Moderator

Posts: 444
Joined: Apr 2011
Reputation: 42
Post: #2
RE: SetEntityPlayerLookAtCallback Problem
(07-06-2011 10:45 PM)MrCookieh Wrote:  Hello guys!

Here's my problem:
If you look at an arm, lying in the drawer, the SetEntityPlayerLookAtCallback should trigger.
Now you can't see the arm (because it's in the drawer, which is closed), but the function gets called, and triggers my actions.

Is there any way to only run the function, if I really can SEE the arm, and
not looking at the point where the arm is (Doesn't matter if you see it or not)?

No, but from your situation what you really want to happen is to alter the sanity when the drawer is opened, right?
There are probably several ways to do this, but a collision callback between the chest-of-drawers entity and a script area (positioned such that it is triggered when the drawer with the arm is pulled out) should achieve this in a very simple, robust manner without creating new entities.

For example:
void OnStart()
{
AddEntityCollideCallback("chest_of_drawers_42", "AreaDraw", "collideAreaDraw", true, 1);
}

void collideAreaDraw(string &in asParent, string &in asChild, int alState)
{
AddDebugMessage(" BOO! ", false);
//Sanity stuff
}

You might also want to look at CH01/11_study.hps for how the scripted skulls sanity effect is done (note that the desk entity is split into a desk & a desk door, which isn't the case for drawers).

(This post was last modified: 07-07-2011 12:07 AM by Apjjm.)
07-07-2011 12:05 AM
Find all posts by this user Quote this message in a reply
Paulpolska Offline
Member

Posts: 129
Joined: Jun 2011
Reputation: 0
Post: #3
RE: SetEntityPlayerLookAtCallback Problem
I was have similar problem. You must for example next to drawer create area which is called when drawer is ejected. After SetEnttiyActive (arm) on true and call SetEntityPlayerLookAtCallback. Simple (function on function ;p)
(This post was last modified: 07-07-2011 12:20 PM by Paulpolska.)
07-07-2011 12:19 PM
Find all posts by this user Quote this message in a reply
MrCookieh Offline
Member

Posts: 157
Joined: Jul 2011
Reputation: 0
Post: #4
RE: SetEntityPlayerLookAtCallback Problem
Thanks to both of you, it works perfectly!
07-07-2011 04:19 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)