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
SetEntityPlayerLookAtCallback Problem
MrCookieh Offline
Member

Posts: 157
Threads: 8
Joined: Jul 2011
Reputation: 0
#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
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#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
Paulpolska Offline
Member

Posts: 144
Threads: 29
Joined: Jun 2011
Reputation: 0
#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)

MY CUSTOM STORY - - STILL ALIVE - -
http://www.moddb.com/mods/still-alive
(This post was last modified: 07-07-2011, 12:20 PM by Paulpolska.)
07-07-2011, 12:19 PM
Find
MrCookieh Offline
Member

Posts: 157
Threads: 8
Joined: Jul 2011
Reputation: 0
#4
RE: SetEntityPlayerLookAtCallback Problem

Thanks to both of you, it works perfectly!
07-07-2011, 04:19 PM
Find




Users browsing this thread: 1 Guest(s)